Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Petra itk debias optional #30

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading