Skip to content

Commit a3b2371

Browse files
[ENH] Minor bugs (#73)
* bug if negative values for histogram * nofullskullmask
1 parent 24fdb51 commit a3b2371

7 files changed

Lines changed: 55 additions & 35 deletions

File tree

skullTo3d/nodes/skull.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def calculate_mean(data):
233233
print("X max : ", np.max(X))
234234

235235
print("Round X max : ", np.round(np.max(X)))
236-
nb_bins = (np.rint(np.max(X)/sample_bins)).astype(int)
236+
nb_bins = (np.rint((np.max(X) - np.min(X))/sample_bins)).astype(int)
237237
print("Nb bins: ", nb_bins)
238238

239239
f.write("X shape : {}\n".format(X.shape))

skullTo3d/pipelines/skull_pipe.py

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,51 +1778,43 @@ def create_skull_ct_pipe(name="skull_ct_pipe", params={}):
17781778
else:
17791779

17801780
# align_ct_on_T1
1781-
align_ct_on_T1 = pe.Node(
1781+
aladin_CT_on_T1 = pe.Node(
17821782
interface=RegAladin(),
1783-
name="align_ct_on_T1")
1783+
name="aladin_CT_on_T1")
17841784

1785-
align_ct_on_T1.inputs.rig_only_flag = True
1785+
aladin_CT_on_T1.inputs.rig_only_flag = True
17861786

17871787
skull_ct_pipe.connect(
17881788
inputnode, 'ct',
1789-
align_ct_on_T1, "flo_file")
1789+
aladin_CT_on_T1, "flo_file")
17901790

17911791
skull_ct_pipe.connect(
17921792
inputnode, "native_T1",
1793-
align_ct_on_T1, "ref_file")
1793+
aladin_CT_on_T1, "ref_file")
17941794

1795-
if "align_ct_on_T1_2" in params:
1796-
1797-
# align_ct_on_T1
1798-
align_ct_on_T1_2 = pe.Node(
1799-
interface=RegAladin(),
1800-
name="align_ct_on_T1_2")
1795+
# align_ct_on_T1
1796+
aladin_CT_on_T1_2 = pe.Node(
1797+
interface=RegAladin(),
1798+
name="aladin_CT_on_T1_2")
18011799

1802-
align_ct_on_T1_2.inputs.rig_only_flag = True
1800+
aladin_CT_on_T1_2.inputs.rig_only_flag = True
18031801

1804-
skull_ct_pipe.connect(
1805-
align_ct_on_T1, 'res_file',
1806-
align_ct_on_T1_2, "flo_file")
1802+
skull_ct_pipe.connect(
1803+
aladin_CT_on_T1, 'res_file',
1804+
aladin_CT_on_T1_2, "flo_file")
18071805

1808-
skull_ct_pipe.connect(
1809-
inputnode, "native_T1",
1810-
align_ct_on_T1_2, "ref_file")
1806+
skull_ct_pipe.connect(
1807+
inputnode, "native_T1",
1808+
aladin_CT_on_T1_2, "ref_file")
18111809

18121810
# align_ct_on_stereo_T1
18131811
align_ct_on_stereo_T1 = pe.Node(
18141812
interface=RegResample(pad_val=0.0),
18151813
name="align_ct_on_stereo_T1")
18161814

1817-
if "align_ct_on_T1_2" in params:
1818-
skull_ct_pipe.connect(
1819-
align_ct_on_T1_2, 'res_file',
1820-
align_ct_on_stereo_T1, "flo_file")
1821-
1822-
else:
1823-
skull_ct_pipe.connect(
1824-
align_ct_on_T1, 'res_file',
1825-
align_ct_on_stereo_T1, "flo_file")
1815+
skull_ct_pipe.connect(
1816+
aladin_CT_on_T1_2, 'res_file',
1817+
align_ct_on_stereo_T1, "flo_file")
18261818

18271819
skull_ct_pipe.connect(
18281820
inputnode, 'native_to_stereo_trans',

skullTo3d/utils/utils_params.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
def update_skull_params(ssoft, params):
33

44
if "noheadmask" in ssoft:
5-
print("Found nohead in soft")
5+
print("Found noheadmask in soft")
66

77
if "skull_petra_pipe" in params:
88
spp = params["skull_petra_pipe"]
@@ -62,7 +62,7 @@ def update_skull_params(ssoft, params):
6262

6363
elif "noskullmask" in ssoft:
6464

65-
print("Found noskull in soft")
65+
print("Found noskullmask in soft")
6666

6767
if "skull_petra_pipe" in params:
6868
spp = params["skull_petra_pipe"]
@@ -105,6 +105,31 @@ def update_skull_params(ssoft, params):
105105
print('deleting skullmask_ct_pipe')
106106
del spp["skullmask_ct_pipe"]
107107

108+
elif "nofullskullmask" in ssoft:
109+
110+
print("Found nofullskullmask in soft")
111+
112+
if "skull_petra_pipe" in params:
113+
spp = params["skull_petra_pipe"]
114+
115+
if "fullskullmask_petra_pipe" in spp:
116+
print('deleting fullskullmask_petra_pipe')
117+
del spp["fullskullmask_petra_pipe"]
118+
119+
if "skull_megre_pipe" in params:
120+
smp = params["skull_megre_pipe"]
121+
122+
if "fullskullmask_megre_pipe" in smp:
123+
print('deleting fullskullmask_megre_pipe')
124+
del smp["fullskullmask_megre_pipe"]
125+
126+
if "skull_t1_pipe" in params:
127+
spp = params["skull_t1_pipe"]
128+
129+
if "fullskullmask_t1_pipe" in spp:
130+
print('deleting fullskullmask_t1_pipe')
131+
del spp["fullskullmask_t1_pipe"]
132+
108133
# if no brain seg mask, removed fullskullmask
109134
if "noseg" in ssoft or "prep" in ssoft:
110135

workflows/params_segment_marmo_ants_4animal_skull.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
"use_T2":
302302
{
303303
},
304-
"align_ct_on_T1_2":
304+
"aladin_CT_on_T1":
305305
{
306306
},
307307
"skullmask_ct_pipe":

workflows/params_segment_marmo_ants_quick_skull.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
"use_T2":
300300
{
301301
},
302-
"align_ct_on_T1_2":
302+
"aladin_CT_on_T1":
303303
{
304304
},
305305
"skullmask_ct_pipe":

workflows/params_segment_marmo_ants_skull.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
"use_T2":
305305
{
306306
},
307-
"align_ct_on_T1_2":
307+
"aladin_CT_on_T1":
308308
{
309309
},
310310
"skullmask_ct_pipe":

workflows/segment_skull.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,14 @@ def create_main_workflow(cmd, data_dir, process_dir, soft, species, subjects,
180180
if 'prep' in ssoft:
181181
new_ssoft.remove('prep')
182182

183+
if 'noheadmask' in ssoft:
184+
new_ssoft.remove('noheadmask')
185+
183186
if 'noskullmask' in ssoft:
184187
new_ssoft.remove('noskullmask')
185188

186-
if 'noheadmask' in ssoft:
187-
new_ssoft.remove('noheadmask')
189+
if 'nofullskullmask' in ssoft:
190+
new_ssoft.remove('nofullskullmask')
188191

189192
if 'noseg' in ssoft:
190193
new_ssoft.remove('noseg')

0 commit comments

Comments
 (0)