Skip to content

Commit

Permalink
Use the STCed data.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Sep 1, 2024
1 parent 849103f commit e689043
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/fmripost_aroma/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ class workflow(_Config):
"""Generate HCP Grayordinates, accepts either ``'91k'`` (default) or ``'170k'``."""
dummy_scans = None
"""Set a number of initial scans to be considered nonsteady states."""
slice_time_ref = 0.5
"""The time of the reference slice to correct BOLD values to, as a fraction
acquisition time. 0 indicates the start, 0.5 the midpoint, and 1 the end
of acquisition. The alias `start` corresponds to 0, and `middle` to 0.5.
The default value is 0.5."""


class loggers:
Expand Down
37 changes: 15 additions & 22 deletions src/fmripost_aroma/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,7 @@ def init_single_run_wf(bold_file):
ica_aroma_wf.inputs.inputnode.confounds = functional_cache['confounds']
ica_aroma_wf.inputs.inputnode.skip_vols = skip_vols

mni6_buffer = pe.Node(
niu.IdentityInterface(
fields=['bold_mni152nlin6asym', 'bold_mask_mni152nlin6asym'],
),
name='mni6_buffer',
)
mni6_buffer = pe.Node(niu.IdentityInterface(fields=['bold', 'bold_mask']), name='mni6_buffer')

Check warning on line 371 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L371

Added line #L371 was not covered by tests

if ('bold_mni152nlin6asym' not in functional_cache) and ('bold_raw' in functional_cache):
# Resample to MNI152NLin6Asym:res-2, for ICA-AROMA classification
Expand Down Expand Up @@ -401,9 +396,8 @@ def init_single_run_wf(bold_file):
bold_stc_wf = init_bold_stc_wf(

Check warning on line 396 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L396

Added line #L396 was not covered by tests
mem_gb=mem_gb,
metadata=bold_metadata,
name='resample_stc_wf',
name='bold_stc_wf',
)
# TODO: Grab skip-vols from confounds file
bold_stc_wf.inputs.inputnode.skip_vols = skip_vols
workflow.connect([

Check warning on line 402 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L401-L402

Added lines #L401 - L402 were not covered by tests
(validate_bold, bold_stc_wf, [('out_file', 'inputnode.bold_file')]),
Expand All @@ -430,7 +424,6 @@ def init_single_run_wf(bold_file):
jacobian='fmap-jacobian' not in config.workflow.ignore,
name='bold_MNI6_wf',
)
bold_MNI6_wf.inputs.inputnode.bold_file = functional_cache['bold_raw']
bold_MNI6_wf.inputs.inputnode.motion_xfm = functional_cache['hmc']
bold_MNI6_wf.inputs.inputnode.boldref2fmap_xfm = functional_cache['boldref2fmap']
bold_MNI6_wf.inputs.inputnode.boldref2anat_xfm = functional_cache['boldref2anat']
Expand All @@ -449,9 +442,11 @@ def init_single_run_wf(bold_file):
# ('fmap_coeff', 'inputnode.fmap_coeff'),
# ('fmap_id', 'inputnode.fmap_id'),
# ]),
(bold_MNI6_wf, mni6_buffer, [('outputnode.bold_file', 'bold_mni152nlin6asym')]),
(stc_buffer, bold_MNI6_wf, [('bold_file', 'inputnode.bold_file')]),
(bold_MNI6_wf, mni6_buffer, [('outputnode.bold_file', 'bold')]),
]) # fmt:skip

# Warp the mask as well
mask_to_mni6 = pe.Node(

Check warning on line 450 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L450

Added line #L450 was not covered by tests
ApplyTransforms(
interpolation='MultiLabel',
Expand All @@ -464,25 +459,23 @@ def init_single_run_wf(bold_file):
),
name='mask_to_mni6',
)
workflow.connect([
(mask_to_mni6, mni6_buffer, [('output_image', 'bold_mask_mni152nlin6asym')]),
]) # fmt:skip
workflow.connect([(mask_to_mni6, mni6_buffer, [('output_image', 'bold_mask')])])

Check warning on line 462 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L462

Added line #L462 was not covered by tests

else:
elif 'bold_mni152nlin6asym' in functional_cache:
workflow.__desc__ += """\

Check warning on line 465 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L465

Added line #L465 was not covered by tests
Preprocessed BOLD series in MNI152NLin6Asym:res-2 space were collected for ICA-AROMA
classification.
"""
mni6_buffer.inputs.bold = functional_cache['bold_mni152nlin6asym']
mni6_buffer.inputs.bold_mask = functional_cache['bold_mask_mni152nlin6asym']

Check warning on line 470 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L469-L470

Added lines #L469 - L470 were not covered by tests

mni6_buffer.inputs.bold_mni152nlin6asym = functional_cache['bold_mni152nlin6asym']
mni6_buffer.inputs.bold_mask_mni152nlin6asym = functional_cache[
'bold_mask_mni152nlin6asym'
]
else:
raise ValueError('No valid BOLD series found for ICA-AROMA classification.')

Check warning on line 473 in src/fmripost_aroma/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L473

Added line #L473 was not covered by tests

workflow.connect([
(mni6_buffer, ica_aroma_wf, [
('bold_mni152nlin6asym', 'inputnode.bold_std'),
('bold_mask_mni152nlin6asym', 'inputnode.bold_mask_std'),
('bold', 'inputnode.bold_std'),
('bold_mask', 'inputnode.bold_mask_std'),
]),
]) # fmt:skip

Expand All @@ -496,8 +489,8 @@ def init_single_run_wf(bold_file):

workflow.connect([
(mni6_buffer, denoise_wf, [
('bold_mni152nlin6asym', 'inputnode.bold_file'),
('bold_mask_mni152nlin6asym', 'inputnode.bold_mask'),
('bold', 'inputnode.bold_file'),
('bold_mask', 'inputnode.bold_mask'),
]),
(ica_aroma_wf, denoise_wf, [
('outputnode.mixing', 'inputnode.mixing'),
Expand Down

0 comments on commit e689043

Please sign in to comment.