Skip to content

Commit

Permalink
dwifslpreproc: Fix for PE direction, but not readout time, in header
Browse files Browse the repository at this point in the history
If the phase encoding information present in the header is only the phase encoding direction, but not readout time is present, then the constructed phase encoding matrix will possess only three columns, not four. If this happens, but an attempt is then made to cross-reference the readout time in the phase encoding table generated from header content against what the user has specified at the command-line, then an unhandled exception will occur. This change prevents specifically the comparison of readout times from being made if no such information is present.
  • Loading branch information
Lestropie committed Sep 25, 2023
1 parent fdec23d commit faf0788
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/dwifslpreproc
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def execute(): #pylint: disable=unused-variable
overwrite_dwi_pe_scheme = True
if manual_trt:
# Compare manual specification to that read from the header
if not scheme_times_match(dwi_pe_scheme, dwi_manual_pe_scheme):
if len(dwi_pe_scheme[0]) == 3 and app.ARGS.readout_time is not None and not scheme_times_match(dwi_pe_scheme, dwi_manual_pe_scheme):
app.warn('User-defined total readout time does not match what is stored in DWI image header; proceeding with user specification')
overwrite_dwi_pe_scheme = True
if overwrite_dwi_pe_scheme:
Expand Down Expand Up @@ -549,7 +549,7 @@ def execute(): #pylint: disable=unused-variable
app.warn('User-defined phase-encoding direction design does not match what is stored in SE EPI image header; proceeding with user specification')
overwrite_se_epi_pe_scheme = True
if manual_trt:
if not scheme_times_match(se_epi_pe_scheme, se_epi_manual_pe_scheme):
if len(se_epi_pe_scheme[0]) == 3 and not scheme_times_match(se_epi_pe_scheme, se_epi_manual_pe_scheme):
app.warn('User-defined total readout time does not match what is stored in SE EPI image header; proceeding with user specification')
overwrite_se_epi_pe_scheme = True
if overwrite_se_epi_pe_scheme:
Expand Down

0 comments on commit faf0788

Please sign in to comment.