Skip to content

Commit

Permalink
Keep working.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed May 4, 2024
1 parent 259356b commit 4994a10
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/fmripost_aroma/interfaces/resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
from nipype.interfaces.base import (
BaseInterfaceInputSpec,
File,
InputMultiObject,
SimpleInterface,
TraitedSpec,
isdefined,
traits,
)

Expand Down
4 changes: 3 additions & 1 deletion src/fmripost_aroma/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from fmripost_aroma import config
from fmripost_aroma.interfaces.bids import DerivativesDataSink
from fmripost_aroma.interfaces.reportlets import AboutSummary, SubjectSummary
from fmripost_aroma.workflows.resampling import init_resample_raw_wf


def init_fmripost_aroma_wf():
Expand Down Expand Up @@ -256,7 +257,8 @@ def init_single_subject_wf(subject_id: str):
)

bids_info = pe.Node(
BIDSInfo(bids_dir=config.execution.bids_dir, bids_validate=False), name="bids_info"
BIDSInfo(bids_dir=config.execution.bids_dir, bids_validate=False),
name="bids_info",
)

summary = pe.Node(
Expand Down
54 changes: 54 additions & 0 deletions src/fmripost_aroma/workflows/resampling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Workflows to resample data."""

from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe


def init_resample_raw_wf(bold_file, functional_cache):
"""Resample raw BOLD data to MNI152NLin6Asym:res-2mm space."""
from fmriprep.workflows.bold.stc import init_bold_stc_wf
from niworkflows.engine.workflows import LiterateWorkflow as Workflow

from fmripost_aroma.interfaces.resampler import Resampler

workflow = Workflow(name="resample_raw_wf")

inputnode = pe.Node(
niu.IdentityInterface(fields=["bold_file", "mask_file"]),
name="inputnode",
)
inputnode.inputs.bold_file = bold_file
inputnode.inputs.mask_file = functional_cache["bold_mask"]

outputnode = pe.Node(
niu.IdentityInterface(fields=["bold_std", "bold_mask_std"]),
name="outputnode",
)

stc_wf = init_bold_stc_wf(name="resample_stc_wf")
workflow.connect([
(inputnode, stc_wf, [
('bold_file', 'inputnode.bold_file'),
('mask_file', 'inputnode.mask_file'),
]),
]) # fmt:skip

resample_bold = pe.Node(
Resampler(space="MNI152NLin6Asym", resolution="2"),
name="resample_bold",
)
workflow.connect([
(stc_wf, resample_bold, [('outputnode.bold_file', 'bold_file')]),
(resample_bold, outputnode, [('output_file', 'bold_std')]),
]) # fmt:skip

resample_bold_mask = pe.Node(
Resampler(space="MNI152NLin6Asym", resolution="2"),
name="resample_bold_mask",
)
workflow.connect([
(inputnode, resample_bold_mask, [('mask_file', 'bold_file')]),
(resample_bold_mask, outputnode, [('output_file', 'bold_mask_std')]),
]) # fmt:skip

return workflow

0 comments on commit 4994a10

Please sign in to comment.