From f0d23cdba849a31fb6f41da3098ab6d6e891a561 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Fri, 22 Nov 2024 14:46:27 -0500 Subject: [PATCH 1/3] Remove unused transform connections. --- qsiprep/workflows/base.py | 6 ------ qsiprep/workflows/dwi/base.py | 5 ----- qsiprep/workflows/dwi/finalize.py | 6 ------ qsiprep/workflows/dwi/hmc_sdc.py | 3 --- qsiprep/workflows/dwi/intramodal_template.py | 3 --- qsiprep/workflows/fieldmap/base.py | 5 ----- qsiprep/workflows/fieldmap/syn.py | 4 +--- 7 files changed, 1 insertion(+), 31 deletions(-) diff --git a/qsiprep/workflows/base.py b/qsiprep/workflows/base.py index 6812ac19..9a48e6dc 100644 --- a/qsiprep/workflows/base.py +++ b/qsiprep/workflows/base.py @@ -387,8 +387,6 @@ def init_single_subject_wf(subject_id: str, session_ids: list): ('outputnode.t1_seg', 'inputnode.t1_seg'), ('outputnode.t1_aseg', 'inputnode.t1_aseg'), ('outputnode.t1_aparc', 'inputnode.t1_aparc'), - ('outputnode.t1_2_mni_forward_transform', 'inputnode.t1_2_mni_forward_transform'), - ('outputnode.t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform'), ('outputnode.dwi_sampling_grid', 'inputnode.dwi_sampling_grid'), ]), ]) # fmt:skip @@ -402,7 +400,6 @@ def init_single_subject_wf(subject_id: str, session_ids: list): output_prefix=output_fname, source_file=source_file, t2w_sdc=bool(subject_data.get('t2w')), - anatomical_template=anatomical_template, ) dwi_finalize_wf = init_dwi_finalize_wf( scan_groups=dwi_info, @@ -420,7 +417,6 @@ def init_single_subject_wf(subject_id: str, session_ids: list): ('outputnode.t1_seg', 'inputnode.t1_seg'), ('outputnode.t1_aseg', 'inputnode.t1_aseg'), ('outputnode.t1_aparc', 'inputnode.t1_aparc'), - ('outputnode.t1_2_mni_forward_transform', 'inputnode.t1_2_mni_forward_transform'), ('outputnode.t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform'), ('outputnode.dwi_sampling_grid', 'inputnode.dwi_sampling_grid'), ('outputnode.t2w_unfatsat', 'inputnode.t2w_unfatsat'), @@ -432,8 +428,6 @@ def init_single_subject_wf(subject_id: str, session_ids: list): ('outputnode.t1_seg', 'inputnode.t1_seg'), ('outputnode.t1_aseg', 'inputnode.t1_aseg'), ('outputnode.t1_aparc', 'inputnode.t1_aparc'), - ('outputnode.t1_2_mni_forward_transform', 'inputnode.t1_2_mni_forward_transform'), - ('outputnode.t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform'), ('outputnode.dwi_sampling_grid', 'inputnode.dwi_sampling_grid'), ]), (dwi_preproc_wf, dwi_finalize_wf, [ diff --git a/qsiprep/workflows/dwi/base.py b/qsiprep/workflows/dwi/base.py index 5c97f921..bf4965b1 100644 --- a/qsiprep/workflows/dwi/base.py +++ b/qsiprep/workflows/dwi/base.py @@ -37,7 +37,6 @@ def init_dwi_preproc_wf( t2w_sdc, output_prefix, source_file, - anatomical_template, ) -> Workflow: """ This workflow controls the dwi preprocessing stages of qsiprep. @@ -77,8 +76,6 @@ def init_dwi_preproc_wf( t1_seg Segmentation of preprocessed structural image, including gray-matter (GM), white-matter (WM) and cerebrospinal fluid (CSF) - t1_2_mni_forward_transform - ANTs-compatible affine-and-warp transform file t1_2_mni_reverse_transform ANTs-compatible affine-and-warp transform file (inverse) subjects_dir @@ -198,7 +195,6 @@ def init_dwi_preproc_wf( 't1_seg', 't1_aseg', 't1_aparc', - 't1_2_mni_forward_transform', 't2w_unfatsat', 't1_2_mni_reverse_transform', 't1_2_fsnative_forward_transform', @@ -261,7 +257,6 @@ def init_dwi_preproc_wf( source_file=source_file, dwi_metadata=dwi_metadata, t2w_sdc=t2w_sdc, - anatomical_template=anatomical_template, ) elif config.workflow.hmc_model == 'eddy': diff --git a/qsiprep/workflows/dwi/finalize.py b/qsiprep/workflows/dwi/finalize.py index 2c7152bf..9c6680de 100644 --- a/qsiprep/workflows/dwi/finalize.py +++ b/qsiprep/workflows/dwi/finalize.py @@ -101,10 +101,6 @@ def init_dwi_finalize_wf( t1_seg Segmentation of preprocessed structural image, including gray-matter (GM), white-matter (WM) and cerebrospinal fluid (CSF) - t1_2_mni_forward_transform - ANTs-compatible affine-and-warp transform file - t1_2_mni_reverse_transform - ANTs-compatible affine-and-warp transform file (inverse) subjects_dir FreeSurfer SUBJECTS_DIR subject_id @@ -178,7 +174,6 @@ def init_dwi_finalize_wf( 'b0_to_intramodal_template_transforms', 'intramodal_template_to_t1_affine', 'intramodal_template_to_t1_warp', - 't1_2_mni_forward_transform', 'hmc_optimization_data', 'dwi_files', 'cnr_map', @@ -201,7 +196,6 @@ def init_dwi_finalize_wf( 't1_seg', 't1_aseg', 't1_aparc', - 't1_2_mni_reverse_transform', 't1_2_fsnative_forward_transform', 't1_2_fsnative_reverse_transform', 'dwi_sampling_grid', diff --git a/qsiprep/workflows/dwi/hmc_sdc.py b/qsiprep/workflows/dwi/hmc_sdc.py index 171d4304..c663f05f 100644 --- a/qsiprep/workflows/dwi/hmc_sdc.py +++ b/qsiprep/workflows/dwi/hmc_sdc.py @@ -26,7 +26,6 @@ def init_qsiprep_hmcsdc_wf( scan_groups, source_file, t2w_sdc, - anatomical_template, dwi_metadata=None, ): """ @@ -46,7 +45,6 @@ def init_qsiprep_hmcsdc_wf( source_file='/data/sub-1/dwi/sub-1_dwi.nii.gz', t2w_sdc=False, dwi_metadata={}, - anatomical_template='MNI152NLin2009cAsym', ) """ inputnode = pe.Node( @@ -264,7 +262,6 @@ def init_qsiprep_hmcsdc_wf( scan_groups['fieldmap_info'], dwi_metadata, ) - b0_sdc_wf.inputs.inputnode.template = anatomical_template workflow.connect([ (dwi_hmc_wf, b0_sdc_wf, [ diff --git a/qsiprep/workflows/dwi/intramodal_template.py b/qsiprep/workflows/dwi/intramodal_template.py index 9ee8d192..6a2be482 100644 --- a/qsiprep/workflows/dwi/intramodal_template.py +++ b/qsiprep/workflows/dwi/intramodal_template.py @@ -75,11 +75,8 @@ def init_intramodal_template_wf( 't1_aseg', 't1_aparc', 't1_tpms', - 't1_2_mni_forward_transform', 'dwi_sampling_grid', - 't1_2_fsnative_forward_transform', 't1_2_fsnative_reverse_transform', - 't1_2_mni_reverse_transform', ] ), name='inputnode', diff --git a/qsiprep/workflows/fieldmap/base.py b/qsiprep/workflows/fieldmap/base.py index 868d655e..9d96f818 100644 --- a/qsiprep/workflows/fieldmap/base.py +++ b/qsiprep/workflows/fieldmap/base.py @@ -101,9 +101,6 @@ def init_sdc_wf(fieldmap_info, dwi_meta): t1_2_mni_reverse_transform MNI-to-T1w transform to map prior knowledge to the T1w fo the fieldmap-less SyN method - template : str - Name of template targeted by ``template`` output space - Outputs ------- @@ -132,7 +129,6 @@ def init_sdc_wf(fieldmap_info, dwi_meta): 'b0_mask', 't1_brain', 't1_2_mni_reverse_transform', - 'template', ] ), name='inputnode', @@ -273,7 +269,6 @@ def init_sdc_wf(fieldmap_info, dwi_meta): ('t1_brain', 'inputnode.t1_brain'), ('t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform'), ('b0_ref', 'inputnode.bold_ref'), - ('template', 'inputnode.template'), ]), ]) # fmt:skip outputnode.inputs.method = 'FLB ("fieldmap-less", SyN-based)' diff --git a/qsiprep/workflows/fieldmap/syn.py b/qsiprep/workflows/fieldmap/syn.py index 84c36723..5541eff1 100644 --- a/qsiprep/workflows/fieldmap/syn.py +++ b/qsiprep/workflows/fieldmap/syn.py @@ -105,8 +105,6 @@ def init_syn_sdc_wf(bold_pe=None, atlas_threshold=2): b0_ref reference image - template : str - Name of template targeted by ``template`` output space t1_brain skull-stripped, bias-corrected structural image t1_2_mni_reverse_transform @@ -145,7 +143,7 @@ def init_syn_sdc_wf(bold_pe=None, atlas_threshold=2): template [@fieldmapless3]. """ inputnode = pe.Node( - niu.IdentityInterface(['bold_ref', 'template', 't1_brain', 't1_2_mni_reverse_transform']), + niu.IdentityInterface(['bold_ref', 't1_brain', 't1_2_mni_reverse_transform']), name='inputnode', ) outputnode = pe.Node( From dc6d1a23c7ce619a73c13ab54707395af259cef3 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Fri, 22 Nov 2024 14:48:52 -0500 Subject: [PATCH 2/3] Add comments. --- qsiprep/workflows/fieldmap/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qsiprep/workflows/fieldmap/base.py b/qsiprep/workflows/fieldmap/base.py index 9d96f818..c0633002 100644 --- a/qsiprep/workflows/fieldmap/base.py +++ b/qsiprep/workflows/fieldmap/base.py @@ -260,6 +260,7 @@ def init_sdc_wf(fieldmap_info, dwi_meta): # FIELDMAP-less path if fieldmap_info['suffix'] == 'syn': + # XXX: Should be replaced with SynB0. syn_sdc_wf = init_syn_sdc_wf( bold_pe=dwi_meta.get('PhaseEncodingDirection', None), ) @@ -267,6 +268,7 @@ def init_sdc_wf(fieldmap_info, dwi_meta): workflow.connect([ (inputnode, syn_sdc_wf, [ ('t1_brain', 'inputnode.t1_brain'), + # Only place a template transform is used on DWI data ('t1_2_mni_reverse_transform', 'inputnode.t1_2_mni_reverse_transform'), ('b0_ref', 'inputnode.bold_ref'), ]), From f69f0e3016ab8c1d3a7844da3f83b557ed2752f9 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Fri, 22 Nov 2024 14:58:42 -0500 Subject: [PATCH 3/3] Ignore fresh linting errors. --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 25c00e7c..4a12c64d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -160,12 +160,14 @@ ignore = [ "DTZ005", # TODO: Fix these "B904", # TODO: Fix these "A001", # TODO: Fix these + "A004", # TODO: Fix these "B006", # TODO: Fix these "S607", # TODO: Fix these "S108", # TODO: Fix these "S602", # TODO: Fix these "E402", # TODO: Fix these "UP028", # TODO: Fix these + "UP031", # TODO: Fix these "BLE001", # TODO: Fix these ]