Skip to content

Commit

Permalink
added explicit output names for vesselsignal and globalsignal and task
Browse files Browse the repository at this point in the history
  • Loading branch information
arovai committed Jun 3, 2024
1 parent f64f604 commit 0c6a1de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cvrmap/cvrmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def main():

basic_filter = dict(subject=subject_label, return_type='filename', space=space, res=res, task=task)

outputs = setup_subject_output_paths(output_dir, subject_label, space, res, args, custom_label)
outputs = setup_subject_output_paths(output_dir, subject_label, space, res, task, args, custom_label)

preproc, mni_preproc = get_preproc(basic_filter, layout)
mask = get_mask(basic_filter, layout)
Expand Down Expand Up @@ -197,7 +197,7 @@ def main():
global_signal_shift, corrected_noise, parameters, outputs)

from nireports.assembler.tools import run_reports
run_reports(output_dir, subject_label, 'madeoutuuid', bootstrap_file=get_report_config(),
run_reports(output_dir, subject_label + 'TEST', 'madeoutuuid', bootstrap_file=get_report_config(),
reportlets_dir=output_dir)

# running group level
Expand Down
27 changes: 21 additions & 6 deletions cvrmap/utils/io_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def set_flags(args):
return flags


def setup_subject_output_paths(output_dir, subject_label, space, res, args, custom_label):
def setup_subject_output_paths(output_dir, subject_label, space, res, task, args, custom_label):
"""
Setup various paths for subject output. Also creates subject output dir.
Expand All @@ -296,6 +296,7 @@ def setup_subject_output_paths(output_dir, subject_label, space, res, args, cust
subject_label: str, subject label
space: str, space entity
res: int, resolution entity
task: str, task entity
args: output of arguments_manager
custom_label: str, custom label for outputs
Expand Down Expand Up @@ -330,10 +331,24 @@ def setup_subject_output_paths(output_dir, subject_label, space, res, args, cust

subject_prefix = os.path.join(subject_output_dir,
"sub-" + subject_label)

label = ''
suffix = '_cvr'


if args.vesselsignal:
label = '_label-vesselsignal'
suffix = '_rcvr'

if args.globalsignal:
label = '_label-globalsignal'
suffix = '_rcvr'

if res is None:
prefix = subject_prefix + "_space-" + space + denoise_label + custom_label
prefix = subject_prefix + "_space-" + space + '_task-' + task + label + denoise_label + custom_label
else:
prefix = subject_prefix + "_space-" + space + '_res-' + res + denoise_label + custom_label
prefix = subject_prefix + "_space-" + space + '_task-' + task + label + '_res-' + res + denoise_label + custom_label

nifti_extension = '.nii.gz'
report_extension = '.html'
figures_extension = '.svg'
Expand All @@ -343,7 +358,7 @@ def setup_subject_output_paths(output_dir, subject_label, space, res, args, cust
"sub-" + subject_label + '_report' + report_extension)

# principal outputs (CVR and Delay map)
outputs['cvr'] = prefix + '_cvr' + nifti_extension
outputs['cvr'] = prefix + suffix + nifti_extension
outputs['delay'] = prefix + '_delay' + nifti_extension

# supplementary data (extras)
Expand All @@ -365,7 +380,7 @@ def setup_subject_output_paths(output_dir, subject_label, space, res, args, cust

if res is None:
outputs['cvr_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space + denoise_label
+ custom_label + '_cvr' + figures_extension)
+ custom_label + suffix + figures_extension)
outputs['delay_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space + denoise_label
+ custom_label + '_delay' + figures_extension)
outputs['vesselmask_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space
Expand All @@ -374,7 +389,7 @@ def setup_subject_output_paths(output_dir, subject_label, space, res, args, cust
+ custom_label + '_globalmask' + figures_extension)
else:
outputs['cvr_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space + '_res-' + res + denoise_label
+ custom_label + '_cvr' + figures_extension)
+ custom_label + suffix + figures_extension)
outputs['delay_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space + '_res-' + res + denoise_label
+ custom_label + '_delay' + figures_extension)
outputs['vesselmask_figure'] = os.path.join(figures_dir, 'sub-' + subject_label + "_space-" + space + '_res-' + res
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def read_requirements():

setup(
name='cvrmap',
version='2.0.23',
version='2.0.24',
url='https://github.com/ln2t/cvrmap',
author='Antonin Rovai',
author_email='[email protected]',
Expand Down

0 comments on commit 0c6a1de

Please sign in to comment.