Skip to content

Commit e96a4fe

Browse files
committed
update args and remove extra file
1 parent f52f6ec commit e96a4fe

4 files changed

Lines changed: 30 additions & 20 deletions

File tree

affine.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/rbc/cli/longitudinal.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6-
from typing import TYPE_CHECKING
6+
from typing import TYPE_CHECKING, Literal
77

88
if TYPE_CHECKING:
99
import argparse
@@ -17,7 +17,7 @@
1717
from rbc.cli.base import BaseArgs
1818
from rbc.cli.query import iter_session_files, load_session
1919
from rbc.context import PipelineContext
20-
from rbc.core.bids import Datatype, Extension, Suffix, extract_entities
20+
from rbc.core.bids import Datatype, Extension, Suffix, bids_safe_label, extract_entities
2121
from rbc.core.bids2table import load_table
2222
from rbc.core.niwrap import setup_runner
2323
from rbc.workflows.anatomical import longitudinal_process as anatomical_longitudinal
@@ -30,7 +30,7 @@ class LongitudinalArgs(BaseArgs):
3030

3131
anatomical: bool
3232
functional: bool
33-
regressor: Literal[36 - parameter, aCompCor]
33+
regressor: Literal["36-parameter", "aCompCor"]
3434

3535
@classmethod
3636
def validate_namespace(cls, ns: argparse.Namespace) -> LongitudinalArgs:
@@ -107,7 +107,7 @@ def _process_func(
107107
pipe_ctx: PipelineContext,
108108
func_df: pl.DataFrame,
109109
tpl_df: pl.DataFrame,
110-
regressor: Literal[36 - parameter, aCompCor],
110+
regressor: Literal["36-parameter", "aCompCor"],
111111
) -> None:
112112
"""Handle functional longitudinal processing."""
113113
row = func_df.filter(suffix=Suffix.BOLD).row(0, named=True)
@@ -135,8 +135,18 @@ def _process_func(
135135
bold=func_q.expect(
136136
func_df, suffix=Suffix.BOLD, desc="preproc", without=["space"]
137137
),
138-
bold_mask=func_q.find(
139-
func_df, suffix=Suffix.MASK, desc="brain", without=["space"]
138+
bold_mask=_require_file(
139+
func_q.find(func_df, suffix=Suffix.MASK, desc="brain", without=["space"]),
140+
"bold_mask",
141+
),
142+
regressor_file=_require_file(
143+
func_q.find(
144+
func_df,
145+
suffix="regressors",
146+
desc=bids_safe_label(regressor),
147+
extension=".1D",
148+
),
149+
"regressor_file",
140150
),
141151
)
142152

@@ -205,7 +215,12 @@ def main(args: LongitudinalArgs) -> int:
205215

206216
if args.functional:
207217
for func_df, _ in iter_session_files(session, groupby=_FUNC_GROUP_ENTITIES):
208-
_process_func(pipe_ctx=pipe_ctx, func_df=func_df, tpl_df=tpl_df)
218+
_process_func(
219+
pipe_ctx=pipe_ctx,
220+
func_df=func_df,
221+
tpl_df=tpl_df,
222+
regressor=args.regressor,
223+
)
209224
pipe_ctx.ensure_dataset_description()
210225

211226
return 0

src/rbc/workflows/functional.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ def longitudinal_process(
427427
sbref: Motion reference (single-band reference) volume.
428428
bold: Preprocessed bold image.
429429
bold_mask: Bold brain mask in native BOLD space.
430-
regressor_file: Bandpass-filtered nuisance regressor file (.1D) in native BOLD space.
430+
regressor_file: Bandpass-filtered nuisance regressor file (.1D)
431+
in native BOLD space.
431432
432433
Returns:
433434
:class:`FunctionalLongOutputs` with all non-null inputs transformed to template

tests/unit/cli/test_longitudinal.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,5 +639,10 @@ def test_optional_bold_mask_file_not_found(
639639
),
640640
patch("rbc.core.bids.shutil.copy2") as mock_copy,
641641
):
642-
_process_func(pipe_ctx=pipe_ctx, func_df=func_df, tpl_df=tpl_df)
642+
_process_func(
643+
pipe_ctx=pipe_ctx,
644+
func_df=func_df,
645+
tpl_df=tpl_df,
646+
regressor="36-parameter",
647+
)
643648
assert mock_copy.call_count == 3

0 commit comments

Comments
 (0)