File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -490,18 +490,12 @@ def apply(
490490 ro_time *= n_volumes
491491
492492 pe_info = []
493- for volid in range (n_volumes ):
494- pe_axis = 'ijk' .index (pe_dir [volid ][0 ])
495- axis_flip = axcodes [pe_axis ] in ('LPI' )
496- pe_flip = pe_dir [volid ].endswith ('-' )
497-
498- pe_info .append (
499- (
500- pe_axis ,
501- # Displacements are reversed if either is true (after ensuring positive cosines)
502- - ro_time [volid ] if (axis_flip ^ pe_flip ) else ro_time [volid ],
503- )
504- )
493+ for vol_pe_dir , vol_ro_time in zip (pe_dir , ro_time ):
494+ pe_axis = 'ijk' .index (vol_pe_dir [0 ])
495+ # Displacements are reversed if either is true (after ensuring positive cosines)
496+ flip = (axcodes [pe_axis ] in 'LPI' ) ^ vol_pe_dir .endswith ('-' )
497+
498+ pe_info .append ((pe_axis , - vol_ro_time if flip else vol_ro_time ))
505499
506500 # Reference image's voxel coordinates (in voxel units)
507501 voxcoords = (
You can’t perform that action at this time.
0 commit comments