Skip to content

Commit

Permalink
fix: correct the position of the echo tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremie-fouquet committed Jun 22, 2024
1 parent 6a02a07 commit 894eaa2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion brkraw/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,11 @@ def build_bids_json(dset, row, fname, json_path, slope=False, offset=False):
crop = None
if dset.is_multi_echo(row.ScanID, row.RecoID): # multi_echo
nii_objs = dset.get_niftiobj(row.ScanID, row.RecoID, crop=crop, slope=slope, offset=offset)
n_echo = len(nii_objs)
n_digit = len(str(n_echo))
for echo, nii in enumerate(nii_objs):
# caught a bug here for multiple echo, changed fname to currentFileName
currentFileName = '{}_echo-{}_{}'.format(fname, echo + 1, row.modality)
currentFileName = fname.replace('echo.index',str(echo + 1).zfill(n_digit))
output_path = os.path.join(row.Dir, currentFileName)
nii.to_filename('{}.nii.gz'.format(output_path))
if json_path:
Expand Down
2 changes: 2 additions & 0 deletions brkraw/scripts/brkraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ def completeFieldsCreateFolders (df, filtered_dset, dset, multi_session, root_pa
if pd.notnull(row.run):
if bids_validation(df, i, 'run', row.run, 2):
fname = '{}_run-{}'.format(fname, row.run)
if dset.is_multi_echo(row.ScanID, row.RecoID):
fname = '{}_echo-echo.index'.format(fname)
if pd.notnull(row.flip):
if bids_validation(df, i, 'flip', row.flip, 2):
fname = '{}_flip-{}'.format(fname, row.flip)
Expand Down

0 comments on commit 894eaa2

Please sign in to comment.