diff --git a/src/fmripost_aroma/interfaces/resampler.py b/src/fmripost_aroma/interfaces/resampler.py index 61a30f8..cf56900 100644 --- a/src/fmripost_aroma/interfaces/resampler.py +++ b/src/fmripost_aroma/interfaces/resampler.py @@ -10,29 +10,29 @@ class _ResamplerInputSpec(BaseInterfaceInputSpec): - bold_file = File(exists=True, desc="BOLD file to resample.") + bold_file = File(exists=True, desc='BOLD file to resample.') derivs_path = traits.Directory( exists=True, - desc="Path to derivatives.", + desc='Path to derivatives.', ) output_dir = traits.Directory( exists=True, - desc="Output directory.", + desc='Output directory.', ) space = traits.Str( - "MNI152NLin6Asym", + 'MNI152NLin6Asym', usedefault=True, - desc="Output space.", + desc='Output space.', ) resolution = traits.Str( - "2", + '2', usedefault=True, - desc="Output resolution.", + desc='Output resolution.', ) class _ResamplerOutputSpec(TraitedSpec): - output_file = File(exists=True, desc="Resampled BOLD file.") + output_file = File(exists=True, desc='Resampled BOLD file.') class Resampler(SimpleInterface): @@ -57,6 +57,6 @@ def _run_interface(self, runtime): resolution=self.inputs.resolution, ) - self._results["output_file"] = output_file + self._results['output_file'] = output_file return runtime diff --git a/src/fmripost_aroma/utils/resampler.py b/src/fmripost_aroma/utils/resampler.py index 00dcc28..dcc5ad3 100644 --- a/src/fmripost_aroma/utils/resampler.py +++ b/src/fmripost_aroma/utils/resampler.py @@ -1,3 +1,7 @@ +"""Resampler methods for fMRI data.""" + +from __future__ import annotations + import asyncio import os from functools import partial @@ -19,7 +23,6 @@ from templateflow import api as tf from typing_extensions import Annotated - R = TypeVar('R') nipreps_cfg = niworkflows.data.load('nipreps.json') diff --git a/src/fmripost_aroma/workflows/base.py b/src/fmripost_aroma/workflows/base.py index 2c01975..76b8948 100644 --- a/src/fmripost_aroma/workflows/base.py +++ b/src/fmripost_aroma/workflows/base.py @@ -321,7 +321,7 @@ def init_single_subject_wf(subject_id: str): for bold_file in subject_data['bold']: ica_aroma_wf = init_ica_aroma_wf(bold_file=bold_file) - ica_aroma_wf.__desc__ = func_pre_desc + (ica_aroma_wf.__desc__ or "") + ica_aroma_wf.__desc__ = func_pre_desc + (ica_aroma_wf.__desc__ or '') functional_cache = {} if config.execution.derivatives: @@ -344,8 +344,8 @@ def init_single_subject_wf(subject_id: str): ) workflow.connect([ (resample_raw_wf, ica_aroma_wf, [ - ("outputnode.bold_std", "inputnode.bold_std"), - ("outputnode.bold_mask_std", "inputnode.bold_mask_std"), + ('outputnode.bold_std', 'inputnode.bold_std'), + ('outputnode.bold_mask_std', 'inputnode.bold_mask_std'), ]), ]) # fmt:skip else: @@ -358,13 +358,13 @@ def init_single_subject_wf(subject_id: str): entities=entities, ) ) - ica_aroma_wf.inputs.inputnode.bold_std = functional_cache["bold_std"] - ica_aroma_wf.inputs.inputnode.bold_mask_std = functional_cache["bold_mask_std"] + ica_aroma_wf.inputs.inputnode.bold_std = functional_cache['bold_std'] + ica_aroma_wf.inputs.inputnode.bold_mask_std = functional_cache['bold_mask_std'] workflow.add_nodes([ica_aroma_wf]) - ica_aroma_wf.inputs.inputnode.movpar_file = functional_cache["movpar_file"] - ica_aroma_wf.inputs.inputnode.skip_vols = functional_cache["skip_vols"] - ica_aroma_wf.inputs.inputnode.spatial_reference = functional_cache["spatial_reference"] + ica_aroma_wf.inputs.inputnode.movpar_file = functional_cache['movpar_file'] + ica_aroma_wf.inputs.inputnode.skip_vols = functional_cache['skip_vols'] + ica_aroma_wf.inputs.inputnode.spatial_reference = functional_cache['spatial_reference'] # Now denoise the native-space BOLD data using ICA-AROMA diff --git a/src/fmripost_aroma/workflows/resampling.py b/src/fmripost_aroma/workflows/resampling.py index 15d00ad..ae4753c 100644 --- a/src/fmripost_aroma/workflows/resampling.py +++ b/src/fmripost_aroma/workflows/resampling.py @@ -11,21 +11,21 @@ def init_resample_raw_wf(bold_file, functional_cache): from fmripost_aroma.interfaces.resampler import Resampler - workflow = Workflow(name="resample_raw_wf") + workflow = Workflow(name='resample_raw_wf') inputnode = pe.Node( - niu.IdentityInterface(fields=["bold_file", "mask_file"]), - name="inputnode", + niu.IdentityInterface(fields=['bold_file', 'mask_file']), + name='inputnode', ) inputnode.inputs.bold_file = bold_file - inputnode.inputs.mask_file = functional_cache["bold_mask"] + inputnode.inputs.mask_file = functional_cache['bold_mask'] outputnode = pe.Node( - niu.IdentityInterface(fields=["bold_std", "bold_mask_std"]), - name="outputnode", + niu.IdentityInterface(fields=['bold_std', 'bold_mask_std']), + name='outputnode', ) - stc_wf = init_bold_stc_wf(name="resample_stc_wf") + stc_wf = init_bold_stc_wf(name='resample_stc_wf') workflow.connect([ (inputnode, stc_wf, [ ('bold_file', 'inputnode.bold_file'), @@ -34,8 +34,8 @@ def init_resample_raw_wf(bold_file, functional_cache): ]) # fmt:skip resample_bold = pe.Node( - Resampler(space="MNI152NLin6Asym", resolution="2"), - name="resample_bold", + Resampler(space='MNI152NLin6Asym', resolution='2'), + name='resample_bold', ) workflow.connect([ (stc_wf, resample_bold, [('outputnode.bold_file', 'bold_file')]), @@ -43,8 +43,8 @@ def init_resample_raw_wf(bold_file, functional_cache): ]) # fmt:skip resample_bold_mask = pe.Node( - Resampler(space="MNI152NLin6Asym", resolution="2"), - name="resample_bold_mask", + Resampler(space='MNI152NLin6Asym', resolution='2'), + name='resample_bold_mask', ) workflow.connect([ (inputnode, resample_bold_mask, [('mask_file', 'bold_file')]),