From 2636310b352bd0f6d3b58668b66f156a4fd8d139 Mon Sep 17 00:00:00 2001 From: Granville Matheson Date: Tue, 19 Aug 2025 13:53:04 +0200 Subject: [PATCH 1/4] Change TAC outputs from _timeseries.tsv to _tacs.tsv --- docs/outputs.rst | 4 ++-- petprep/interfaces/tacs.py | 4 ++-- petprep/interfaces/tests/test_tacs.py | 2 +- petprep/utils/bids.py | 1 + petprep/workflows/pet/tacs.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/outputs.rst b/docs/outputs.rst index da218755..7af6efc8 100644 --- a/docs/outputs.rst +++ b/docs/outputs.rst @@ -309,7 +309,7 @@ from an anatomical segmentation. The resulting table has ``FrameTimesStart`` and sub-/ pet/ - sub-_[specifiers]_seg-_desc-preproc_timeseries.tsv + sub-_[specifiers]_seg-_desc-preproc_tacs.tsv The ``desc-preproc`` entity indicates that the curves were derived from the preprocessed PET series. @@ -323,7 +323,7 @@ table containing the mean uptake within that region:: sub-/ pet/ - sub-_[specifiers]_seg-_ref-_desc-preproc_timeseries.tsv + sub-_[specifiers]_seg-_ref-_desc-preproc_tacs.tsv The ``ref`` entity captures the reference region identifier provided via the :ref:`CLI options ` ``--ref-mask-name`` and ``--ref-mask-index``. diff --git a/petprep/interfaces/tacs.py b/petprep/interfaces/tacs.py index fac26656..19fb71d3 100644 --- a/petprep/interfaces/tacs.py +++ b/petprep/interfaces/tacs.py @@ -80,7 +80,7 @@ def _run_interface(self, runtime): out_file = fname_presuffix( self.inputs.in_file, - suffix='_timeseries.tsv', + suffix='_tacs.tsv', newpath=runtime.cwd, use_ext=False, ) @@ -138,7 +138,7 @@ def _run_interface(self, runtime): out_file = fname_presuffix( self.inputs.in_file, - suffix='_timeseries.tsv', + suffix='_tacs.tsv', newpath=runtime.cwd, use_ext=False, ) diff --git a/petprep/interfaces/tests/test_tacs.py b/petprep/interfaces/tests/test_tacs.py index 61f97d42..1276627a 100644 --- a/petprep/interfaces/tests/test_tacs.py +++ b/petprep/interfaces/tests/test_tacs.py @@ -164,7 +164,7 @@ def test_tacs_workflow(tmp_path): inputs = pickle.load(f) assert inputs['in_file'] == str(resampled_pet) - assert Path(tmp_path / 'pet_tacs_wf' / 'tac' / 'pet_resampled_timeseries.tsv').exists() + assert Path(tmp_path / 'pet_tacs_wf' / 'tac' / 'pet_resampled_tacs.tsv').exists() def test_ExtractRefTAC(tmp_path): diff --git a/petprep/utils/bids.py b/petprep/utils/bids.py index c4b7d23a..e0a38122 100644 --- a/petprep/utils/bids.py +++ b/petprep/utils/bids.py @@ -103,6 +103,7 @@ def write_bidsignore(deriv_dir): '*_pet.pet.gii', '*_mixing.tsv', '*_timeseries.tsv', + '*_tacs.tsv', ) ignore_file = Path(deriv_dir) / '.bidsignore' diff --git a/petprep/workflows/pet/tacs.py b/petprep/workflows/pet/tacs.py index 39541058..6d1f36a4 100644 --- a/petprep/workflows/pet/tacs.py +++ b/petprep/workflows/pet/tacs.py @@ -30,7 +30,7 @@ def init_pet_tacs_wf(*, name: str = 'pet_tacs_wf') -> pe.Workflow: niu.IdentityInterface(fields=['pet_anat', 'segmentation', 'dseg_tsv', 'metadata']), name='inputnode', ) - outputnode = pe.Node(niu.IdentityInterface(fields=['timeseries']), name='outputnode') + outputnode = pe.Node(niu.IdentityInterface(fields=['tacs']), name='outputnode') # Resample PET to segmentation space resample_pet = pe.Node( @@ -68,7 +68,7 @@ def init_pet_tacs_wf(*, name: str = 'pet_tacs_wf') -> pe.Workflow: ('metadata', 'metadata'), ], ), - (tac, outputnode, [('out_file', 'timeseries')]), + (tac, outputnode, [('out_file', 'tacs')]), ] ) From 8d6a76c0cb53b115853343a453748f9cc16f5f7b Mon Sep 17 00:00:00 2001 From: mnoergaard Date: Sun, 24 Aug 2025 20:21:34 +0200 Subject: [PATCH 2/4] FIX: Rename timeseries.tsv to tacs.tsv --- petprep/workflows/pet/base.py | 4 ++-- petprep/workflows/pet/fit.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/petprep/workflows/pet/base.py b/petprep/workflows/pet/base.py index 43267b2a..7705163d 100644 --- a/petprep/workflows/pet/base.py +++ b/petprep/workflows/pet/base.py @@ -699,7 +699,7 @@ def init_pet_wf( ds_pet_tacs = pe.Node( DerivativesDataSink( base_directory=petprep_dir, - suffix='timeseries', + suffix='tacs', seg=config.workflow.seg, desc='preproc', allowed_entities=('seg',), @@ -733,7 +733,7 @@ def init_pet_wf( ds_ref_tacs = pe.Node( DerivativesDataSink( base_directory=petprep_dir, - suffix='timeseries', + suffix='tacs', seg=config.workflow.seg, desc='preproc', ref=config.workflow.ref_mask_name, diff --git a/petprep/workflows/pet/fit.py b/petprep/workflows/pet/fit.py index cb8efc04..cbca88f0 100644 --- a/petprep/workflows/pet/fit.py +++ b/petprep/workflows/pet/fit.py @@ -461,7 +461,7 @@ def init_pet_fit_wf( ds_ref_tacs = pe.Node( DerivativesDataSink( base_directory=config.execution.petprep_dir, - suffix='timeseries', + suffix='tacs', seg=config.workflow.seg, desc='preproc', ref=config.workflow.ref_mask_name, From 09ff343bedce4df19a868fab0c00d99e95af7a77 Mon Sep 17 00:00:00 2001 From: mnoergaard Date: Sun, 24 Aug 2025 21:00:34 +0200 Subject: [PATCH 3/4] FIX: add tacs suffix to nipreps.json --- petprep/data/nipreps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/petprep/data/nipreps.json b/petprep/data/nipreps.json index 2e28de20..b96b805c 100644 --- a/petprep/data/nipreps.json +++ b/petprep/data/nipreps.json @@ -183,7 +183,7 @@ "sub-{subject}[/ses-{session}]/{datatype|pet}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_den-{density}][_desc-{desc}]_{suffix}{extension<.dscalar.nii|.json>}", "sub-{subject}[/ses-{session}]/{datatype|pet}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_res-{resolution}]_desc-{desc}_{suffix|mask}{extension<.nii|.nii.gz|.json>|.nii.gz}", "sub-{subject}[/ses-{session}]/{datatype|pet}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_res-{resolution}]_label-{label}[_desc-{desc}]_{suffix|probseg}{extension<.nii|.nii.gz|.json>|.nii.gz}", - "sub-{subject}[/ses-{session}]/{datatype|pet}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_dir-{direction}][_run-{run}][_part-{part}][_space-{space}][_atlas-{atlas}][_cohort-{cohort}][_desc-{desc}]_{suffix|timeseries}{extension<.json|.tsv>|.tsv}", + "sub-{subject}[/ses-{session}]/{datatype|pet}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_dir-{direction}][_run-{run}][_part-{part}][_space-{space}][_atlas-{atlas}][_cohort-{cohort}][_desc-{desc}]_{suffix|timeseries}{extension<.json|.tsv>|.tsv}", "sub-{subject}/{datatype}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_desc-{desc}]_{suffix}{extension<.html|.svg>|.svg}", "sub-{subject}/{datatype}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][_fmapid-{fmapid}][_desc-{desc}]_{suffix}{extension<.html|.svg>|.svg}", "sub-{subject}/{datatype}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_dir-{direction}][_run-{run}][_echo-{echo}][_part-{part}][_space-{space}][_cohort-{cohort}][_desc-{desc}]_{suffix}{extension<.html|.svg>|.svg}", From f284e8822fc18ccbd7ec724d669d62b1e9934b03 Mon Sep 17 00:00:00 2001 From: mnoergaard Date: Sun, 24 Aug 2025 21:00:48 +0200 Subject: [PATCH 4/4] FIX: update nodes from timeseries to tacs --- petprep/workflows/pet/base.py | 4 ++-- petprep/workflows/pet/ref_tacs.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/petprep/workflows/pet/base.py b/petprep/workflows/pet/base.py index 7705163d..eccf0e90 100644 --- a/petprep/workflows/pet/base.py +++ b/petprep/workflows/pet/base.py @@ -720,7 +720,7 @@ def init_pet_wf( ('outputnode.segmentation', 'inputnode.segmentation'), ('outputnode.dseg_tsv', 'inputnode.dseg_tsv'), ]), - (pet_tacs_wf, ds_pet_tacs, [('outputnode.timeseries', 'in_file')]), + (pet_tacs_wf, ds_pet_tacs, [('outputnode.tacs', 'in_file')]), ]) # fmt:skip if config.workflow.ref_mask_name: @@ -752,7 +752,7 @@ def init_pet_wf( workflow.connect([ (pet_t1w_src, pet_ref_tacs_wf, [(pet_t1w_field, 'inputnode.pet_anat')]), (pet_fit_wf, pet_ref_tacs_wf, [('outputnode.refmask', 'inputnode.mask_file')]), - (pet_ref_tacs_wf, ds_ref_tacs, [('outputnode.timeseries', 'in_file')]), + (pet_ref_tacs_wf, ds_ref_tacs, [('outputnode.tacs', 'in_file')]), ]) # fmt:skip pet_confounds_wf = init_pet_confs_wf( diff --git a/petprep/workflows/pet/ref_tacs.py b/petprep/workflows/pet/ref_tacs.py index e29d2c7a..a50ab096 100644 --- a/petprep/workflows/pet/ref_tacs.py +++ b/petprep/workflows/pet/ref_tacs.py @@ -27,7 +27,7 @@ def init_pet_ref_tacs_wf(*, name: str = 'pet_ref_tacs_wf') -> pe.Workflow: niu.IdentityInterface(fields=['pet_anat', 'mask_file', 'metadata', 'ref_mask_name']), name='inputnode', ) - outputnode = pe.Node(niu.IdentityInterface(fields=['timeseries']), name='outputnode') + outputnode = pe.Node(niu.IdentityInterface(fields=['tacs']), name='outputnode') resample_pet = pe.Node( Function( @@ -57,7 +57,7 @@ def init_pet_ref_tacs_wf(*, name: str = 'pet_ref_tacs_wf') -> pe.Workflow: ('ref_mask_name', 'ref_mask_name'), ], ), - (tac, outputnode, [('out_file', 'timeseries')]), + (tac, outputnode, [('out_file', 'tacs')]), ] )