Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Nov 27, 2023
1 parent 1d7d0d6 commit 8e2dbb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion aslprep/interfaces/cbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class _ExtractCBFInputSpec(BaseInterfaceInputSpec):
m0scan = traits.Either(
File(exists=True),
None,
mandatory=True,
mandatory=False,
desc="m0scan file associated with the ASL file. Only defined if M0Type is 'Separate'.",
)
m0scan_metadata = traits.Either(
Expand Down
28 changes: 7 additions & 21 deletions aslprep/workflows/asl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,17 @@ def init_validate_asl_wf(asl_file=None, name="validate_asl_wf"):

asl_1st = pe.Node(niu.Select(index=[0]), name="asl_1st", run_without_submitting=True)

# fmt:off
workflow.connect([
(val_asl, asl_1st, [(("out_file", listify), "inlist")]),
(asl_1st, outputnode, [("out", "asl_file")]),
])
# fmt:on
]) # fmt:skip

validate_1st = pe.Node(niu.Select(index=[0]), name="validate_1st", run_without_submitting=True)

# fmt:off
workflow.connect([
(val_asl, validate_1st, [(("out_report", listify), "inlist")]),
(validate_1st, outputnode, [("out", "validation_report")]),
])
# fmt:on
]) # fmt:skip

return workflow

Expand Down Expand Up @@ -403,14 +399,12 @@ def init_asl_reference_wf(
name="select_reference_volumes",
)

# fmt:off
workflow.connect([
(inputnode, select_reference_volumes, [
("asl_file", "asl_file"),
("aslcontext", "aslcontext"),
]),
])
# fmt:on
]) # fmt:skip

val_asl = pe.MapNode(
ValidateImage(),
Expand All @@ -423,19 +417,16 @@ def init_asl_reference_wf(

gen_ref = pe.Node(EstimateReferenceImage(), name="gen_ref", mem_gb=1)

# fmt:off
workflow.connect([
(val_asl, gen_ref, [("out_file", "in_file")]),
(gen_ref, outputnode, [
("ref_image", "raw_ref_image"),
("n_volumes_to_discard", "algo_dummy_scans"),
]),
])
# fmt:on
]) # fmt:skip

enhance_and_skullstrip_asl_wf = init_enhance_and_skullstrip_asl_wf(pre_mask=pre_mask)

# fmt:off
workflow.connect([
(inputnode, enhance_and_skullstrip_asl_wf, [("asl_mask", "inputnode.pre_mask")]),
(gen_ref, enhance_and_skullstrip_asl_wf, [("ref_image", "inputnode.in_file")]),
Expand All @@ -444,31 +435,26 @@ def init_asl_reference_wf(
("outputnode.mask_file", "asl_mask"),
("outputnode.skull_stripped_file", "ref_image_brain"),
]),
])
# fmt:on
]) # fmt:skip

calc_dummy_scans = pe.Node(
niu.Function(function=pass_dummy_scans, output_names=["skip_vols_num"]),
name="calc_dummy_scans",
run_without_submitting=True,
mem_gb=DEFAULT_MEMORY_MIN_GB,
)
# fmt:off
workflow.connect([
(inputnode, calc_dummy_scans, [("dummy_scans", "dummy_scans")]),
(gen_ref, calc_dummy_scans, [("n_volumes_to_discard", "algo_dummy_scans")]),
(calc_dummy_scans, outputnode, [("skip_vols_num", "skip_vols")]),
])
# fmt:on
]) # fmt:skip

asl_1st = pe.Node(niu.Select(index=[0]), name="asl_1st", run_without_submitting=True)

# fmt:off
workflow.connect([
(val_asl, asl_1st, [(("out_file", listify), "inlist")]),
(asl_1st, outputnode, [("out", "asl_file")]),
])
# fmt:on
]) # fmt:skip

validate_1st = pe.Node(niu.Select(index=[0]), name="validate_1st", run_without_submitting=True)

Expand Down
8 changes: 2 additions & 6 deletions aslprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,11 @@ def init_single_subject_wf(subject_id: str):
run_without_submitting=True,
)
if any(estimator.method == fm.EstimatorType.ANAT for estimator in fmap_estimators):
# fmt:off
workflow.connect([
(anat_fit_wf, fmap_select_std, [
("outputnode.std2anat_xfm", "std2anat_xfm"),
("outputnode.template", "keys")]),
])
# fmt:on
]) # fmt:skip

for estimator in fmap_estimators:
config.loggers.workflow.info(
Expand Down Expand Up @@ -564,7 +562,6 @@ def init_single_subject_wf(subject_id: str):
syn_preprocessing_wf.inputs.inputnode.in_epis = sources
syn_preprocessing_wf.inputs.inputnode.in_meta = source_meta

# fmt:off
workflow.connect([
(anat_fit_wf, syn_preprocessing_wf, [
("outputnode.t1w_preproc", "inputnode.in_anat"),
Expand All @@ -580,8 +577,7 @@ def init_single_subject_wf(subject_id: str):
("outputnode.anat_mask", f"in_{estimator.bids_id}.anat_mask"),
("outputnode.sd_prior", f"in_{estimator.bids_id}.sd_prior"),
]),
])
# fmt:on
]) # fmt:skip

# Append the functional section to the existing anatomical excerpt
# That way we do not need to stream down the number of asl datasets
Expand Down

0 comments on commit 8e2dbb9

Please sign in to comment.