Skip to content
Merged
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
2 changes: 1 addition & 1 deletion skullTo3d/nodes/skull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
46 changes: 19 additions & 27 deletions skullTo3d/pipelines/skull_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
name="aladin_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(
aladin_CT_on_T1_2, 'res_file',
align_ct_on_stereo_T1, "flo_file")

skull_ct_pipe.connect(
inputnode, 'native_to_stereo_trans',
Expand Down
29 changes: 27 additions & 2 deletions skullTo3d/utils/utils_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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 "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 "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 "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:

Expand Down
2 changes: 1 addition & 1 deletion workflows/params_segment_marmo_ants_4animal_skull.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
"use_T2":
{
},
"align_ct_on_T1_2":
"aladin_CT_on_T1":
{
},
"skullmask_ct_pipe":
Expand Down
2 changes: 1 addition & 1 deletion workflows/params_segment_marmo_ants_quick_skull.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"use_T2":
{
},
"align_ct_on_T1_2":
"aladin_CT_on_T1":
{
},
"skullmask_ct_pipe":
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 @@ -304,7 +304,7 @@
"use_T2":
{
},
"align_ct_on_T1_2":
"aladin_CT_on_T1":
{
},
"skullmask_ct_pipe":
Expand Down
7 changes: 5 additions & 2 deletions workflows/segment_skull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down