Skip to content

Commit 7cb3353

Browse files
committed
make mni2009c normalization optional
1 parent 4cdcb4b commit 7cb3353

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

ingress2qsirecon/cli/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def _ingress2qsirecon(**kwargs):
2525
input_pipeline = kwargs["input_pipeline"]
2626
participant_label = kwargs["participant_label"]
2727
work_dir = Path(kwargs["work_dir"])
28+
skip_mni2009c_norm = kwargs["skip_mni2009c_norm"]
2829
check_gradients = kwargs["check_gradients"]
2930
dry_run = kwargs["dry_run"]
3031
symlink = kwargs["symlink"]
@@ -55,7 +56,7 @@ def _ingress2qsirecon(**kwargs):
5556
layouts = create_layout(input_dir, output_dir, input_pipeline, participant_label)
5657

5758
# Create and run overall workflow, which will be broken down to single subject workflows
58-
ingress2qsirecon_wf = create_ingress2qsirecon_wf(layouts, base_dir=work_dir)
59+
ingress2qsirecon_wf = create_ingress2qsirecon_wf(layouts, base_dir=work_dir, skip_mni2009c_norm=skip_mni2009c_norm)
5960
ingress2qsirecon_wf.run()
6061

6162

ingress2qsirecon/cli/parser.py

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ def _drop_sub(value):
7676
help="The working directory for the processing. "
7777
"If not specified, the current working directory will be used.",
7878
)
79+
optional.add_argument(
80+
"--skip-mni2009c-norm",
81+
"--skip_mni2009c_norm",
82+
action="store_true",
83+
default=False,
84+
help="Skip MNI normalization step. MNI normalization is not required for all pipelines in QSIRecon.",
85+
)
7986
optional.add_argument(
8087
"--check_gradients",
8188
"--check-gradients",

ingress2qsirecon/utils/workflows.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def parse_layout(subject_layout):
2626
return tuple(subject_layout.values())
2727

2828

29-
def create_single_subject_wf(subject_layout):
29+
def create_single_subject_wf(subject_layout, skip_mni2009c_norm=False):
3030
"""
3131
Create a nipype workflow to ingest a single subject.
3232
@@ -252,7 +252,7 @@ def create_single_subject_wf(subject_layout):
252252

253253
# Now get transform to MNI2009cAsym
254254
MNI_template = subject_layout["MNI_template"]
255-
if MNI_template != "MNI152NLin2009cAsym":
255+
if MNI_template != "MNI152NLin2009cAsym" and skip_mni2009c_norm == False:
256256
# Get MNI brain and mask
257257
MNI2009cAsym_brain_path = str(
258258
tflow.get('MNI152NLin2009cAsym', desc="brain", suffix="T1w", resolution=1, extension=".nii.gz")
@@ -333,7 +333,7 @@ def save_xfm_outputs(
333333
return wf
334334

335335

336-
def create_ingress2qsirecon_wf(layouts, name="ingress2qsirecon_wf", base_dir=os.getcwd()):
336+
def create_ingress2qsirecon_wf(layouts, name="ingress2qsirecon_wf", base_dir=os.getcwd(), skip_mni2009c_norm=False):
337337
"""
338338
Creates the overall ingress2qsirecon workflow.
339339
@@ -361,7 +361,7 @@ def create_ingress2qsirecon_wf(layouts, name="ingress2qsirecon_wf", base_dir=os.
361361
print(f"Subject(s) to run: {subjects_to_run}")
362362

363363
for subject_layout in layouts:
364-
single_subject_wf = create_single_subject_wf(subject_layout)
364+
single_subject_wf = create_single_subject_wf(subject_layout, skip_mni2009c_norm=skip_mni2009c_norm)
365365
wf.add_nodes([single_subject_wf])
366366

367367
return wf

0 commit comments

Comments
 (0)