Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split regressor estimation and denoising steps #17

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a3c44a4
Work on memory issues.
tsalo Sep 5, 2024
e00778c
Don't run GLM within rapidtide call.
tsalo Sep 6, 2024
52b702d
Update rapidtide.py
tsalo Sep 6, 2024
1bde248
Try tracking outputs.
tsalo Sep 6, 2024
b97bff1
Run rapidtide on boldref-space data.
tsalo Sep 6, 2024
9003dbc
Write out delay map and regressor.
tsalo Sep 6, 2024
7e62346
Fix filenames.
tsalo Sep 6, 2024
358bd2f
Fix stuff.
tsalo Sep 6, 2024
9b55cf3
Work on denoising step.
tsalo Sep 7, 2024
15da054
Merge branch 'main' into memory-issues
tsalo Sep 7, 2024
c16841d
Update.
tsalo Sep 7, 2024
adf5c40
Update.
tsalo Sep 7, 2024
806bc5d
Keep working.
tsalo Sep 7, 2024
b0475c4
Fix import.
tsalo Sep 18, 2024
ab3b7fa
Update rapidtide.py
tsalo Sep 18, 2024
4df6124
Work on rapidtide interfaces.
tsalo Sep 26, 2024
c7315d3
Update rapidtide.py
tsalo Sep 26, 2024
8bfd10e
A bit more work.
tsalo Sep 28, 2024
320718d
Fix some stuff up.
tsalo Oct 9, 2024
5e9c610
Merge branch 'main' into memory-issues
tsalo Oct 9, 2024
db47088
Minor fix.
tsalo Oct 9, 2024
a7068a5
Update rapidtide version.
tsalo Oct 9, 2024
4abb7e2
Fix?
tsalo Oct 9, 2024
d4db0b5
update
tsalo Oct 9, 2024
743affb
[DATALAD] Added subdataset
tsalo Oct 9, 2024
7832f03
[DATALAD] Added subdataset
tsalo Oct 9, 2024
6fb425b
[DATALAD] Added subdataset
tsalo Oct 9, 2024
5c027da
Update.
tsalo Oct 9, 2024
387ea91
Remove old submodules.
tsalo Oct 9, 2024
b5cf819
Update.
tsalo Oct 9, 2024
430a676
Update.
tsalo Oct 9, 2024
eec3bc8
Update test_base.py
tsalo Oct 9, 2024
22be228
Update test_base.py
tsalo Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some stuff up.
tsalo committed Oct 9, 2024
commit 320718db6b4597ee74c458c648a44d878f7401a4
67 changes: 36 additions & 31 deletions src/fmripost_rapidtide/interfaces/rapidtide.py
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ class _RapidtideInputSpec(CommandLineInputSpec):
mandatory=False,
)
nprocs = traits.Int(
default=1,
1,
usedefault=True,
argstr='--nprocs %d',
mandatory=False,
@@ -333,14 +333,14 @@ class _RetroLagTCSInputSpec(CommandLineInputSpec):
desc='Output root.',
)
glmderivs = traits.Int(
0,
argstr='--glmderivs %d',
mandatory=False,
desc='When doing final GLM, include derivatives up to NDERIVS order. Default is 0.',
default=0,
usedefault=True,
)
nprocs = traits.Int(
default=1,
1,
usedefault=True,
argstr='--nprocs %d',
mandatory=False,
@@ -350,23 +350,23 @@ class _RetroLagTCSInputSpec(CommandLineInputSpec):
),
)
numskip = traits.Int(
0,
argstr='--numskip %d',
default=0,
usedefault=True,
mandatory=False,
desc='Skip NUMSKIP points at the beginning of the fmri file.',
)
noprogressbar = traits.Bool(
True,
argstr='--noprogressbar',
mandatory=False,
default=True,
usedefault=True,
desc='Will disable showing progress bars (helpful if stdout is going to a file).',
)
debug = traits.Bool(
False,
argstr='--debug',
mandatory=False,
default=False,
usedefault=True,
desc='Output lots of helpful information.',
)
@@ -419,34 +419,27 @@ class _RetroGLMInputSpec(CommandLineInputSpec):
'(everything up to but not including the underscore.)'
),
)
runoptionsfile = File(
exists=True,
argstr='--runoptionsfile %s',
mandatory=False,
)
procmaskfile = File(
exists=True,
argstr='--procmaskfile %s',
mandatory=False,
)
corrmaskfile = File(
exists=True,
argstr='--corrmaskfile %s',
prefix = traits.Str(
argstr='--alternateoutput %s',
mandatory=False,
genfile=True,
desc='Output name',
)
lagtimesfile = File(
exists=True,
argstr='--lagtimesfile %s',
glmderivs = traits.Int(
0,
argstr='--glmderivs %d',
usedefault=True,
mandatory=False,
desc='When doing final GLM, include derivatives up to NDERIVS order.',
)
lagtcgeneratorfile = File(
exists=True,
argstr='--lagtcgeneratorfile %s',
nprocs = traits.Int(
1,
usedefault=True,
argstr='--nprocs %d',
mandatory=False,
)
meanfile = File(
exists=True,
argstr='--meanfile %s',
numskip = traits.Int(
argstr='--numskip %d',
mandatory=False,
)

@@ -459,13 +452,25 @@ class _RetroGLMOutputSpec(TraitedSpec):
class RetroGLM(CommandLine):
"""Run the retroglm command-line interface to denoise BOLD with existing rapidtide outputs."""

_cmd = 'retroglm'
_cmd = 'retroglm --noprogressbar'
input_spec = _RetroGLMInputSpec
output_spec = _RetroGLMOutputSpec

def _gen_filename(self, name):
if name == 'prefix':
return os.path.join(os.getcwd(), 'retroglm')

return None

def _list_outputs(self):
outputs = self._outputs().get()
prefix_dir = self.inputs.prefix
datafileroot = self.inputs.datafileroot
outputs['denoised'] = f'{datafileroot}_desc-lfofilterCleaned_bold.nii.gz'
outputs['denoised_json'] = f'{datafileroot}_desc-lfofilterCleaned_bold.json'
file_prefix = os.path.basename(datafileroot)
outputs['denoised'] = os.path.join(
prefix_dir, f'{file_prefix}_desc-lfofilterCleaned_bold.nii.gz'
)
outputs['denoised_json'] = os.path.join(
prefix_dir, f'{file_prefix}_desc-lfofilterCleaned_bold.json'
)
return outputs
3 changes: 2 additions & 1 deletion src/fmripost_rapidtide/workflows/rapidtide.py
Original file line number Diff line number Diff line change
@@ -310,6 +310,7 @@ def init_rapidtide_denoise_wf(
retroglm = pe.Node(
RetroGLM(
nprocs=config.nipype.omp_nthreads,
glmderivs=config.workflow.glmderivs,
),
name='retroglm',
mem_gb=mem_gb['filesize'] * 6,
@@ -424,7 +425,7 @@ def init_rapidtide_confounds_wf(
name='inputnode',
)

# Remove the traveling wave artifact
# Generate the traveling wave artifact voxel-wise regressor
retrolagtcs = pe.Node(
RetroLagTCS(
nprocs=config.nipype.omp_nthreads,