Skip to content

Commit 83211c4

Browse files
author
Félix C. Morency
committed
BF: Fixed ECAT7 reader (sub)header and offset issues
1 parent f20392f commit 83211c4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

nibabel/ecat.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
('well_counter_corr_factor', np.float32),
7878
('data_units', '32S'),
7979
('septa_state',np.uint16),
80-
('fill', np.uint16)
80+
('fill', '12S')
8181
]
8282
hdr_dtype = np.dtype(main_header_dtd)
8383

@@ -142,7 +142,8 @@
142142
('scatter_type', np.uint16),
143143
('recon_type', np.uint16),
144144
('recon_views', np.uint16),
145-
('fill', '135S')]
145+
('fill', '174S'),
146+
('fill2', '96S')]
146147
subhdr_dtype = np.dtype(subheader_dtd)
147148

148149
# Ecat Data Types
@@ -422,7 +423,7 @@ def get_mlist(self, fileobj):
422423
if not self.hdr.endianness is native_code:
423424
dt = dt.newbyteorder(self.hdr.endianness)
424425
nframes = self.hdr['num_frames']
425-
mlist = np.zeros((nframes,4))
426+
mlist = np.zeros((nframes,4), dtype='uint32')
426427
record_count = 0
427428
done = False
428429

@@ -658,7 +659,7 @@ def raw_data_from_fileobj(self, frame=0):
658659
if not self._header.endianness is native_code:
659660
dtype=dtype.newbyteorder(self._header.endianness)
660661
shape = self.get_shape(frame)
661-
offset = self._get_frame_offset(frame)
662+
offset = self._get_frame_offset(frame) + 512
662663
fid_obj = self.fileobj
663664
raw_data = array_from_file(shape, dtype, fid_obj, offset=offset)
664665
## put data into neurologic orientation
@@ -672,9 +673,10 @@ def data_from_fileobj(self, frame=0):
672673
header = self._header
673674
subhdr = self.subheaders[frame]
674675
raw_data = self.raw_data_from_fileobj(frame)
675-
data = raw_data * header['ecat_calibration_factor']
676-
data = data * subhdr['scale_factor']
677-
return data
676+
return raw_data
677+
#data = raw_data * header['ecat_calibration_factor']
678+
#data = data * subhdr['scale_factor']
679+
#return data
678680

679681

680682

0 commit comments

Comments
 (0)