Skip to content

Commit

Permalink
It runs but doesn't denoise.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed May 17, 2024
1 parent 4cf1e7e commit bcbd117
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/fmripost_aroma/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def collect_derivatives(

# Search for requested output spaces
if spaces is not None:
# Put the output-space files/transforms in lists so they can be parallelized with
# template_iterator_wf.
spaces_found, bold_outputspaces, bold_mask_outputspaces = [], [], []

Check warning on line 151 in src/fmripost_aroma/utils/bids.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/utils/bids.py#L151

Added line #L151 was not covered by tests
for space in spaces.references:
# First try to find processed BOLD+mask files in the requested space
Expand Down Expand Up @@ -179,9 +181,7 @@ def collect_derivatives(
# First try to find processed BOLD+mask files in the requested space
anat2space_query = {**entities, **spec['transforms']['anat2mni152nlin6asym']}
anat2space_query['to'] = space.space
print(anat2space_query)
item = layout.get(return_type='filename', **anat2space_query)
print(item)
anat2outputspaces_xfm.append(item[0] if item else None)
spaces_found.append(bool(item))

Check warning on line 186 in src/fmripost_aroma/utils/bids.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/utils/bids.py#L182-L186

Added lines #L182 - L186 were not covered by tests

Expand Down
49 changes: 27 additions & 22 deletions src/fmripost_aroma/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,23 @@ def init_single_run_wf(bold_file):
template_iterator_wf.inputs.inputnode.anat2std_xfm = functional_cache[

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L407

Added line #L407 was not covered by tests
'anat2outputspaces_xfm'
]

# Now denoise the output-space BOLD data using ICA-AROMA
denoise_wf = init_denoise_wf(bold_file=bold_file)
denoise_wf.inputs.inputnode.skip_vols = skip_vols

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L412-L413

Added lines #L412 - L413 were not covered by tests

workflow.connect([

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L415

Added line #L415 was not covered by tests
(ica_aroma_wf, denoise_wf, [
('outputnode.mixing', 'inputnode.mixing'),
('outputnode.aroma_features', 'inputnode.classifications'),
]),
(template_iterator_wf, denoise_wf, [
('outputnode.space', 'inputnode.space'),
('outputnode.cohort', 'inputnode.cohort'),
('outputnode.resolution', 'inputnode.resolution'),
]),
]) # fmt:skip

if functional_cache['bold_outputspaces']:
# No transforms necessary
std_buffer = pe.Node(
Expand All @@ -418,6 +435,13 @@ def init_single_run_wf(bold_file):
)
std_buffer.inputs.bold = functional_cache['bold_outputspaces']
std_buffer.inputs.bold_mask = functional_cache['bold_mask_outputspaces']

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L436-L437

Added lines #L436 - L437 were not covered by tests
workflow.connect([
(template_iterator_wf, std_buffer, [('outputnode.space', 'key')]),
(std_buffer, denoise_wf, [
('bold', 'inputnode.bold_file'),
('bold_mask', 'inputnode.bold_mask'),
]),
]) # fmt:skip
else:
# Warp native BOLD to requested output spaces
xfms = [

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L447

Added line #L447 was not covered by tests
Expand All @@ -436,31 +460,12 @@ def init_single_run_wf(bold_file):
)
workflow.connect([

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L461

Added line #L461 was not covered by tests
(all_xfms, resample_std_wf, [('out', 'inputnode.transforms')]),
(resample_std_wf, std_buffer, [
('outputnode.bold_std', 'bold'),
('outputnode.bold_mask_std', 'bold_mask'),
(resample_std_wf, denoise_wf, [
('outputnode.bold_std', 'inputnode.bold'),
('outputnode.bold_mask_std', 'inputnode.bold_mask'),
]),
]) # fmt:skip

# Now denoise the output-space BOLD data using ICA-AROMA
denoise_wf = init_denoise_wf(bold_file=bold_file)
denoise_wf.inputs.inputnode.skip_vols = skip_vols
workflow.connect([
(ica_aroma_wf, denoise_wf, [
('outputnode.mixing', 'inputnode.mixing'),
('outputnode.aroma_features', 'inputnode.classifications'),
]),
(template_iterator_wf, denoise_wf, [
('outputnode.space', 'inputnode.space'),
('outputnode.cohort', 'inputnode.cohort'),
('outputnode.resolution', 'inputnode.resolution'),
]),
(std_buffer, denoise_wf, [
('bold', 'inputnode.bold_file'),
('bold_mask', 'inputnode.bold_mask'),
]),
]) # fmt:skip

return workflow

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

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/base.py#L469

Added line #L469 was not covered by tests


Expand Down

0 comments on commit bcbd117

Please sign in to comment.