Skip to content

Commit f29154a

Browse files
committed
BF: fix repetition time in PARREC header
1 parent ad26878 commit f29154a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: nibabel/parrec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,11 @@ def _calc_zooms(self):
897897
zooms[:2] = self._get_unique_image_prop('pixel spacing')
898898
slice_thickness = self._get_unique_image_prop('slice thickness')
899899
zooms[2] = slice_thickness + slice_gap
900-
# If 4D dynamic scan, convert time from milliseconds to seconds
900+
# If 4D dynamic scan, save repetition time in miliseconds
901901
if len(zooms) > 3 and self.general_info['dyn_scan']:
902902
if len(self.general_info['repetition_time']) > 1:
903903
warnings.warn("multiple TRs found in .PAR file")
904-
zooms[3] = self.general_info['repetition_time'][0] / 1000.
904+
zooms[3] = self.general_info['repetition_time'][0]
905905
return zooms
906906

907907
def get_affine(self, origin='scanner'):

Diff for: nibabel/tests/test_parrec.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
# We disagree with Philips about the right affine, for the moment, so
145145
# use our own affine as determined from a previous load in nibabel
146146
affine=AN_OLD_AFFINE,
147-
zooms=(3.75, 3.75, 8.0, 2.0),
147+
zooms=(3.75, 3.75, 8.0, 2000.0),
148148
data_summary=dict(
149149
min=0.0,
150150
max=2299.4110643863678,
@@ -179,7 +179,7 @@ def test_header():
179179
hdr = PARRECHeader(HDR_INFO, HDR_DEFS)
180180
assert_equal(hdr.get_data_shape(), (64, 64, 9, 3))
181181
assert_equal(hdr.get_data_dtype(), np.dtype('<u2'))
182-
assert_equal(hdr.get_zooms(), (3.75, 3.75, 8.0, 2.0))
182+
assert_equal(hdr.get_zooms(), (3.75, 3.75, 8.0, 2000.0))
183183
assert_equal(hdr.get_data_offset(), 0)
184184
si = np.array(
185185
[np.unique(x) for x in hdr.get_data_scaling()]).ravel()
@@ -548,7 +548,7 @@ def test_epi_params():
548548
with open(epi_par, 'rt') as fobj:
549549
epi_hdr = PARRECHeader.from_fileobj(fobj)
550550
assert_equal(len(epi_hdr.get_data_shape()), 4)
551-
assert_almost_equal(epi_hdr.get_zooms()[-1], 2.0)
551+
assert_almost_equal(epi_hdr.get_zooms()[-1], 2000.0)
552552

553553

554554
def test_truncations():
@@ -832,7 +832,7 @@ def test_dualTR():
832832
assert_array_equal(dualTR_hdr.general_info['repetition_time'],
833833
expected_TRs)
834834
# zoom on 4th dimensions is the first TR (in seconds)
835-
assert_equal(dualTR_hdr.get_zooms()[3], expected_TRs[0]/1000)
835+
assert_equal(dualTR_hdr.get_zooms()[3], expected_TRs[0])
836836

837837

838838
def test_ADC_map():

0 commit comments

Comments
 (0)