Skip to content

Commit

Permalink
Petra itk debias optional (#29)
Browse files Browse the repository at this point in the history
optional petra_itk_debias for marmoset only
  • Loading branch information
davidmeunier79 authored Dec 13, 2024
1 parent 5db30fe commit b313f46
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
16 changes: 15 additions & 1 deletion examples_doc/params_skull.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@

"skull_ct_pipe":
{
"align_ct_on_T1_2":
{

"comment": "OPTIONAL",
"comment": "Cannot be modified",
"params": "RegAladin (NiftyReg)"

},
"ct_head_mask_thr":
{
"params": "Threshold (FSL)",
Expand Down Expand Up @@ -149,12 +157,18 @@

"avg_reorient_pipe":
{

"comment": "OPTIONAL",
"params": "see corresponding doc in short_preparation_pipe in macapype"

},

"petra_itk_debias":
{
"comment": "OPTIONAL",
"params": "SimpleITK N4BiasFieldCorrectionImageFilter dirty wrap (defined in macapype.nodes.correc_bias)",
"comment": "Should be made a proper nipype node ",

},

"petra_head_mask_thr":
{
Expand Down
53 changes: 36 additions & 17 deletions skullTo3d/pipelines/skull_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,17 +682,18 @@ def create_skull_petra_pipe(name="skull_petra_pipe", params={}):
skull_petra_pipe.connect(inputnode, "stereo_T1",
align_petra_on_stereo_T1, "ref_file")

# Adding early petra_debias
petra_itk_debias = NodeParams(
interface=niu.Function(
input_names=["img_file"],
output_names=["cor_img_file", "bias_img_file"],
function=itk_debias),
params=parse_key(params, "petra_itk_debias"),
name="petra_itk_debias")

skull_petra_pipe.connect(align_petra_on_stereo_T1, "out_file",
petra_itk_debias, "img_file")
if "petra_itk_debias" in params.keys():

# Adding early petra_debias
petra_itk_debias = pe.Node(
interface=niu.Function(
input_names=["img_file"],
output_names=["cor_img_file", "bias_img_file"],
function=itk_debias),
name="petra_itk_debias")

skull_petra_pipe.connect(align_petra_on_stereo_T1, "out_file",
petra_itk_debias, "img_file")

# ### head mask
# headmask_threshold
Expand All @@ -703,8 +704,14 @@ def create_skull_petra_pipe(name="skull_petra_pipe", params={}):
params=parse_key(params, 'petra_head_mask_thr'),
name="petra_head_mask_thr")

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_head_mask_thr, "in_file")
if "petra_itk_debias" in params.keys():

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_head_mask_thr, "in_file")
else:

skull_petra_pipe.connect(align_petra_on_stereo_T1, "out_file",
petra_head_mask_thr, "in_file")

skull_petra_pipe.connect(
inputnode, ('indiv_params', parse_key, "petra_head_mask_thr"),
Expand All @@ -720,8 +727,14 @@ def create_skull_petra_pipe(name="skull_petra_pipe", params={}):
params=parse_key(params, "petra_head_auto_mask"),
name="petra_head_auto_mask")

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_head_auto_mask, "img_file")
if "petra_itk_debias" in params.keys():

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_head_auto_mask, "img_file")
else:

skull_petra_pipe.connect(align_petra_on_stereo_T1, "out_file",
petra_head_auto_mask, "img_file")

skull_petra_pipe.connect(
inputnode, ('indiv_params', parse_key, "petra_head_auto_mask"),
Expand Down Expand Up @@ -791,8 +804,14 @@ def create_skull_petra_pipe(name="skull_petra_pipe", params={}):
petra_hmasked = pe.Node(interface=ApplyMask(),
name="petra_hmasked")

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_hmasked, "in_file")
if "petra_itk_debias" in params.keys():

skull_petra_pipe.connect(petra_itk_debias, "cor_img_file",
petra_hmasked, "in_file")
else:

skull_petra_pipe.connect(align_petra_on_stereo_T1, "out_file",
petra_hmasked, "in_file")

skull_petra_pipe.connect(petra_head_erode, "out_file",
petra_hmasked, "mask_file")
Expand Down
2 changes: 1 addition & 1 deletion workflows/params_segment_marmo_ants_skull.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}
},
"skull_petra_pipe":
{
{ "petra_itk_debias":{},
"petra_head_auto_mask":
{
"kmeans": true,
Expand Down

0 comments on commit b313f46

Please sign in to comment.