From f2b847de4796c13195b78a40f51796eb55dd99b3 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Wed, 28 May 2025 16:41:34 +0200 Subject: [PATCH 01/13] -skull option --- docs/command.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/command.rst b/docs/command.rst index 8992554..77af2a2 100644 --- a/docs/command.rst +++ b/docs/command.rst @@ -74,7 +74,8 @@ mandatory parameters * ``_4animal`` : will use bet4animal (FSL) for brain extraction, for faster computation (by default atlas_brex is used) * ``_quick`` : will use hd-bet (Deep Learning) for brain extraction, for faster computation (by default atlas_brex is used) - **NB: ** hd-bet requires a specific version of macapype/skullTo3d, not available by default + +**NB:** hd-bet requires a specific version of macapype/skullTo3d, not available by default This option should be used if the coregistration to template in preparation is not performed correctly: @@ -87,7 +88,11 @@ mandatory parameters * ``_noseg`` (at the end) will perform data preparation and brain extraction (no segmentation) **Some options are specific to skullTo3d:** - * ``_skull`` after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed) **NB : ** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra + * ``_skull`` after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed) + +**NB :** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra +**NB :** ``-soft skull`` without processing brain is possible, but is still experimental. It only works if ``-skull_dt CT petra`` and -deriv -padback are NOT defined + * ``_noskullmask`` (at the end) will perform realignement to stereo and headmask (only realignement for CT) * ``_noheadmask`` (at the end) will perform only realignement to stereo From 555cbe2217b8881adc0b4962d6beb5f346730edf Mon Sep 17 00:00:00 2001 From: David Meunier Date: Wed, 28 May 2025 16:46:52 +0200 Subject: [PATCH 02/13] NB --- docs/command.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/command.rst b/docs/command.rst index 77af2a2..db4820d 100644 --- a/docs/command.rst +++ b/docs/command.rst @@ -75,7 +75,7 @@ mandatory parameters * ``_4animal`` : will use bet4animal (FSL) for brain extraction, for faster computation (by default atlas_brex is used) * ``_quick`` : will use hd-bet (Deep Learning) for brain extraction, for faster computation (by default atlas_brex is used) -**NB:** hd-bet requires a specific version of macapype/skullTo3d, not available by default + **NB:** hd-bet requires a specific version of macapype/skullTo3d, not available by default This option should be used if the coregistration to template in preparation is not performed correctly: @@ -88,10 +88,12 @@ mandatory parameters * ``_noseg`` (at the end) will perform data preparation and brain extraction (no segmentation) **Some options are specific to skullTo3d:** + * ``_skull`` after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed) -**NB :** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra -**NB :** ``-soft skull`` without processing brain is possible, but is still experimental. It only works if ``-skull_dt CT petra`` and -deriv -padback are NOT defined + **NB :** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra + + **NB :** ``-soft skull`` without processing brain is possible, but is still experimental. It only works if ``-skull_dt CT petra`` and -deriv -padback are NOT defined * ``_noskullmask`` (at the end) will perform realignement to stereo and headmask (only realignement for CT) * ``_noheadmask`` (at the end) will perform only realignement to stereo From cf0f16e150eb602f880544af63a610279be3c0af Mon Sep 17 00:00:00 2001 From: David Meunier Date: Wed, 28 May 2025 16:52:47 +0200 Subject: [PATCH 03/13] `` --- docs/command.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/command.rst b/docs/command.rst index db4820d..4c8a472 100644 --- a/docs/command.rst +++ b/docs/command.rst @@ -93,7 +93,7 @@ mandatory parameters **NB :** ``_skullnoisypetra`` instead of ``_skull`` available for macaque with issues on petra - **NB :** ``-soft skull`` without processing brain is possible, but is still experimental. It only works if ``-skull_dt CT petra`` and -deriv -padback are NOT defined + **NB :** ``-soft skull`` without processing brain is possible, but is still experimental. It only works if ``-skull_dt CT petra`` and ``-deriv`` and ``-padback`` are NOT defined * ``_noskullmask`` (at the end) will perform realignement to stereo and headmask (only realignement for CT) * ``_noheadmask`` (at the end) will perform only realignement to stereo From e5f807c71201300e9ed1d6d40ec3020b5f2131c3 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Wed, 28 May 2025 17:13:33 +0200 Subject: [PATCH 04/13] | --- docs/command.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/command.rst b/docs/command.rst index 4c8a472..2b12162 100644 --- a/docs/command.rst +++ b/docs/command.rst @@ -77,16 +77,22 @@ mandatory parameters **NB:** hd-bet requires a specific version of macapype/skullTo3d, not available by default +| + This option should be used if the coregistration to template in preparation is not performed correctly: * ``_robustreg`` (at the end) to have a more robust registration (in two steps) +| + Finally, these option are available (to place after SPM or ANTS) and will modify the parameters but can be launched in sequence: * ``_test`` : (at the end) to check if the full pipeline is coherent (will only generate the graph.dot and graph.png) * ``_prep`` (at the end) will perform data preparation (no brain extraction and segmentation) * ``_noseg`` (at the end) will perform data preparation and brain extraction (no segmentation) +| + **Some options are specific to skullTo3d:** * ``_skull`` after SPM or ANTS if you want to process skull or angio *specific to skullTo3d*; otherwise the main pipelines of macapype will be launched (only brain segmentation will be performed) From 0db493303932d9b85c6d6d4ffb80d7d649432d38 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Mon, 6 Oct 2025 10:17:56 +0200 Subject: [PATCH 05/13] bug if negative values for histogram --- skullTo3d/nodes/skull.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skullTo3d/nodes/skull.py b/skullTo3d/nodes/skull.py index fb4c0cd..0e8377e 100644 --- a/skullTo3d/nodes/skull.py +++ b/skullTo3d/nodes/skull.py @@ -233,7 +233,7 @@ def calculate_mean(data): print("X max : ", np.max(X)) print("Round X max : ", np.round(np.max(X))) - nb_bins = (np.rint(np.max(X)/sample_bins)).astype(int) + nb_bins = (np.rint((np.max(X) - np.min(X))/sample_bins)).astype(int) print("Nb bins: ", nb_bins) f.write("X shape : {}\n".format(X.shape)) From 9557a6bb37a67b52eea6f98fbc65b37913c0fb03 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Mon, 6 Oct 2025 10:33:00 +0200 Subject: [PATCH 06/13] reg_aladin --- workflows/params_segment_marmo_ants_4animal_skull.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/params_segment_marmo_ants_4animal_skull.json b/workflows/params_segment_marmo_ants_4animal_skull.json index e1ddd09..b470049 100644 --- a/workflows/params_segment_marmo_ants_4animal_skull.json +++ b/workflows/params_segment_marmo_ants_4animal_skull.json @@ -301,7 +301,7 @@ "use_T2": { }, - "align_ct_on_T1_2": + "aladin_CT_on_T1": { }, "skullmask_ct_pipe": From be1e53aa8601be4c813f0978df60298ea371846f Mon Sep 17 00:00:00 2001 From: David Meunier Date: Mon, 6 Oct 2025 11:22:50 +0200 Subject: [PATCH 07/13] aladin_ct_on_T1 if no crop_CT --- skullTo3d/pipelines/skull_pipe.py | 44 +++++++++++++------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/skullTo3d/pipelines/skull_pipe.py b/skullTo3d/pipelines/skull_pipe.py index ad74a28..3f7b4bc 100644 --- a/skullTo3d/pipelines/skull_pipe.py +++ b/skullTo3d/pipelines/skull_pipe.py @@ -1778,51 +1778,43 @@ def create_skull_ct_pipe(name="skull_ct_pipe", params={}): else: # align_ct_on_T1 - align_ct_on_T1 = pe.Node( + aladin_CT_on_T1 = pe.Node( interface=RegAladin(), name="align_ct_on_T1") - align_ct_on_T1.inputs.rig_only_flag = True + aladin_CT_on_T1.inputs.rig_only_flag = True skull_ct_pipe.connect( inputnode, 'ct', - align_ct_on_T1, "flo_file") + aladin_CT_on_T1, "flo_file") skull_ct_pipe.connect( inputnode, "native_T1", - align_ct_on_T1, "ref_file") + aladin_CT_on_T1, "ref_file") - if "align_ct_on_T1_2" in params: - - # align_ct_on_T1 - align_ct_on_T1_2 = pe.Node( - interface=RegAladin(), - name="align_ct_on_T1_2") + # align_ct_on_T1 + aladin_CT_on_T1_2 = pe.Node( + interface=RegAladin(), + name="aladin_CT_on_T1_2") - align_ct_on_T1_2.inputs.rig_only_flag = True + aladin_CT_on_T1_2.inputs.rig_only_flag = True - skull_ct_pipe.connect( - align_ct_on_T1, 'res_file', - align_ct_on_T1_2, "flo_file") + skull_ct_pipe.connect( + aladin_CT_on_T1, 'res_file', + aladin_CT_on_T1_2, "flo_file") - skull_ct_pipe.connect( - inputnode, "native_T1", - align_ct_on_T1_2, "ref_file") + skull_ct_pipe.connect( + inputnode, "native_T1", + aladin_CT_on_T1_2, "ref_file") # align_ct_on_stereo_T1 align_ct_on_stereo_T1 = pe.Node( interface=RegResample(pad_val=0.0), name="align_ct_on_stereo_T1") - if "align_ct_on_T1_2" in params: - skull_ct_pipe.connect( - align_ct_on_T1_2, 'res_file', - align_ct_on_stereo_T1, "flo_file") - - else: - skull_ct_pipe.connect( - align_ct_on_T1, 'res_file', - align_ct_on_stereo_T1, "flo_file") + skull_ct_pipe.connect( + align_ct_on_T1_2, 'res_file', + align_ct_on_stereo_T1, "flo_file") skull_ct_pipe.connect( inputnode, 'native_to_stereo_trans', From 80ba0b0f99d6de173d9cc49c8f7ca06b64e67ceb Mon Sep 17 00:00:00 2001 From: David Meunier Date: Mon, 6 Oct 2025 11:23:36 +0200 Subject: [PATCH 08/13] aladin_CT_on_T1_2 --- skullTo3d/pipelines/skull_pipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skullTo3d/pipelines/skull_pipe.py b/skullTo3d/pipelines/skull_pipe.py index 3f7b4bc..4c029ce 100644 --- a/skullTo3d/pipelines/skull_pipe.py +++ b/skullTo3d/pipelines/skull_pipe.py @@ -1813,7 +1813,7 @@ def create_skull_ct_pipe(name="skull_ct_pipe", params={}): name="align_ct_on_stereo_T1") skull_ct_pipe.connect( - align_ct_on_T1_2, 'res_file', + aladin_CT_on_T1_2, 'res_file', align_ct_on_stereo_T1, "flo_file") skull_ct_pipe.connect( From 1f5187ced4a3f87fe8d7fee37716894375c4fc6f Mon Sep 17 00:00:00 2001 From: David Meunier Date: Mon, 6 Oct 2025 11:25:44 +0200 Subject: [PATCH 09/13] aladin_CT --- skullTo3d/pipelines/skull_pipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skullTo3d/pipelines/skull_pipe.py b/skullTo3d/pipelines/skull_pipe.py index 4c029ce..01454e0 100644 --- a/skullTo3d/pipelines/skull_pipe.py +++ b/skullTo3d/pipelines/skull_pipe.py @@ -1780,7 +1780,7 @@ def create_skull_ct_pipe(name="skull_ct_pipe", params={}): # align_ct_on_T1 aladin_CT_on_T1 = pe.Node( interface=RegAladin(), - name="align_ct_on_T1") + name="aladin_CT_on_T1") aladin_CT_on_T1.inputs.rig_only_flag = True From 8cfe7d269d66cda774f0f1141db793a8bff23313 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Tue, 7 Oct 2025 10:26:55 +0200 Subject: [PATCH 10/13] aladin_CT --- workflows/params_segment_marmo_ants_quick_skull.json | 2 +- workflows/params_segment_marmo_ants_skull.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workflows/params_segment_marmo_ants_quick_skull.json b/workflows/params_segment_marmo_ants_quick_skull.json index 9271e39..a076f96 100644 --- a/workflows/params_segment_marmo_ants_quick_skull.json +++ b/workflows/params_segment_marmo_ants_quick_skull.json @@ -299,7 +299,7 @@ "use_T2": { }, - "align_ct_on_T1_2": + "aladin_CT_on_T1": { }, "skullmask_ct_pipe": diff --git a/workflows/params_segment_marmo_ants_skull.json b/workflows/params_segment_marmo_ants_skull.json index 5dd454d..a733db0 100644 --- a/workflows/params_segment_marmo_ants_skull.json +++ b/workflows/params_segment_marmo_ants_skull.json @@ -304,7 +304,7 @@ "use_T2": { }, - "align_ct_on_T1_2": + "aladin_CT_on_T1": { }, "skullmask_ct_pipe": From f4885c7bc7e78c99742f3810e9b54b758171b152 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Thu, 20 Nov 2025 15:44:18 +0100 Subject: [PATCH 11/13] nofullskullmask --- skullTo3d/utils/utils_params.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/skullTo3d/utils/utils_params.py b/skullTo3d/utils/utils_params.py index 962a53e..1c986e8 100644 --- a/skullTo3d/utils/utils_params.py +++ b/skullTo3d/utils/utils_params.py @@ -2,7 +2,7 @@ def update_skull_params(ssoft, params): if "noheadmask" in ssoft: - print("Found nohead in soft") + print("Found noheadmask in soft") if "skull_petra_pipe" in params: spp = params["skull_petra_pipe"] @@ -62,7 +62,7 @@ def update_skull_params(ssoft, params): elif "noskullmask" in ssoft: - print("Found noskull in soft") + print("Found noskullmask in soft") if "skull_petra_pipe" in params: spp = params["skull_petra_pipe"] @@ -105,6 +105,31 @@ def update_skull_params(ssoft, params): print('deleting skullmask_ct_pipe') del spp["skullmask_ct_pipe"] + elif "nofullskullmask" in ssoft: + + print("Found nofullskullmask in soft") + + if "skull_petra_pipe" in params: + spp = params["skull_petra_pipe"] + + if "skullmask_petra_pipe" in spp: + print('deleting skullmask_petra_pipe') + del spp["skullmask_petra_pipe"] + + if "skull_megre_pipe" in params: + smp = params["skull_megre_pipe"] + + if "skullmask_megre_pipe" in smp: + print('deleting skullmask_megre_pipe') + del smp["skullmask_megre_pipe"] + + if "skull_t1_pipe" in params: + spp = params["skull_t1_pipe"] + + if "skullmask_t1_pipe" in spp: + print('deleting skullmask_t1_pipe') + del spp["skullmask_t1_pipe"] + # if no brain seg mask, removed fullskullmask if "noseg" in ssoft or "prep" in ssoft: From 294fd5767e0ff3e86d535e311f7c4fdb72ee03c5 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Thu, 20 Nov 2025 15:49:16 +0100 Subject: [PATCH 12/13] removed naming --- workflows/segment_skull.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workflows/segment_skull.py b/workflows/segment_skull.py index 584b509..6762f6a 100644 --- a/workflows/segment_skull.py +++ b/workflows/segment_skull.py @@ -180,11 +180,14 @@ def create_main_workflow(cmd, data_dir, process_dir, soft, species, subjects, if 'prep' in ssoft: new_ssoft.remove('prep') + if 'noheadmask' in ssoft: + new_ssoft.remove('noheadmask') + if 'noskullmask' in ssoft: new_ssoft.remove('noskullmask') - if 'noheadmask' in ssoft: - new_ssoft.remove('noheadmask') + if 'nofullskullmask' in ssoft: + new_ssoft.remove('nofullskullmask') if 'noseg' in ssoft: new_ssoft.remove('noseg') From 687499e3de52cf50e11a63ce713924ee0fa723c1 Mon Sep 17 00:00:00 2001 From: David Meunier Date: Thu, 20 Nov 2025 15:52:18 +0100 Subject: [PATCH 13/13] ok now --- skullTo3d/utils/utils_params.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/skullTo3d/utils/utils_params.py b/skullTo3d/utils/utils_params.py index 1c986e8..338b381 100644 --- a/skullTo3d/utils/utils_params.py +++ b/skullTo3d/utils/utils_params.py @@ -112,23 +112,23 @@ def update_skull_params(ssoft, params): if "skull_petra_pipe" in params: spp = params["skull_petra_pipe"] - if "skullmask_petra_pipe" in spp: - print('deleting skullmask_petra_pipe') - del spp["skullmask_petra_pipe"] + if "fullskullmask_petra_pipe" in spp: + print('deleting fullskullmask_petra_pipe') + del spp["fullskullmask_petra_pipe"] if "skull_megre_pipe" in params: smp = params["skull_megre_pipe"] - if "skullmask_megre_pipe" in smp: - print('deleting skullmask_megre_pipe') - del smp["skullmask_megre_pipe"] + if "fullskullmask_megre_pipe" in smp: + print('deleting fullskullmask_megre_pipe') + del smp["fullskullmask_megre_pipe"] if "skull_t1_pipe" in params: spp = params["skull_t1_pipe"] - if "skullmask_t1_pipe" in spp: - print('deleting skullmask_t1_pipe') - del spp["skullmask_t1_pipe"] + if "fullskullmask_t1_pipe" in spp: + print('deleting fullskullmask_t1_pipe') + del spp["fullskullmask_t1_pipe"] # if no brain seg mask, removed fullskullmask if "noseg" in ssoft or "prep" in ssoft: