Skip to content

Commit 8dd81ee

Browse files
[Enh] mesh rawskull (#60)
* t1_rawskull_stl/mask * IsoSurface_tissues_pipe (macapype)
1 parent 0d20249 commit 8dd81ee

19 files changed

Lines changed: 213 additions & 4 deletions

skullTo3d/pipelines/rename.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,41 @@ def rename_all_skull_t1_derivatives(params, main_workflow,
281281
rename_t1_skull_stl, 'out_file',
282282
datasink, '@t1_skull_stl')
283283

284+
# rename t1_rawskull_mask
285+
rename_t1_rawskull_mask = pe.Node(
286+
niu.Rename(), name="rename_t1_rawskull_mask")
287+
288+
rename_t1_rawskull_mask.inputs.format_string = \
289+
pref_deriv + "_space-stereo_desc-t1_rawskullmask"
290+
rename_t1_rawskull_mask.inputs.parse_string = parse_str
291+
rename_t1_rawskull_mask.inputs.keep_ext = True
292+
293+
main_workflow.connect(
294+
skull_t1_pipe, "outputnode.t1_rawskull_mask",
295+
rename_t1_rawskull_mask, 'in_file')
296+
297+
main_workflow.connect(
298+
rename_t1_rawskull_mask, 'out_file',
299+
datasink, '@t1_rawskull_mask')
300+
301+
# rename t1_rawskull_stl
302+
rename_t1_rawskull_stl = pe.Node(
303+
niu.Rename(),
304+
name="rename_t1_rawskull_stl")
305+
306+
rename_t1_rawskull_stl.inputs.format_string = \
307+
pref_deriv + "_desc-t1_rawskullmask"
308+
rename_t1_rawskull_stl.inputs.parse_string = parse_str
309+
rename_t1_rawskull_stl.inputs.keep_ext = True
310+
311+
main_workflow.connect(
312+
skull_t1_pipe, 'outputnode.t1_rawskull_stl',
313+
rename_t1_rawskull_stl, 'in_file')
314+
315+
main_workflow.connect(
316+
rename_t1_rawskull_stl, 'out_file',
317+
datasink, '@t1_rawskull_stl')
318+
284319
if "t1_skull_fov" in params["skull_t1_pipe"]:
285320

286321
# rename robustt1_skull_stl
@@ -339,6 +374,24 @@ def rename_all_skull_t1_derivatives(params, main_workflow,
339374
rename_t1_head_mask, 'out_file',
340375
datasink, '@t1_head_mask')
341376

377+
# rename t1_head_stl
378+
rename_t1_head_stl = pe.Node(
379+
niu.Rename(),
380+
name="rename_t1_head_stl")
381+
382+
rename_t1_head_stl.inputs.format_string = \
383+
pref_deriv + "_desc-t1_headmask"
384+
rename_t1_head_stl.inputs.parse_string = parse_str
385+
rename_t1_head_stl.inputs.keep_ext = True
386+
387+
main_workflow.connect(
388+
skull_t1_pipe, 'outputnode.t1_head_stl',
389+
rename_t1_head_stl, 'in_file')
390+
391+
main_workflow.connect(
392+
rename_t1_head_stl, 'out_file',
393+
datasink, '@t1_head_stl')
394+
342395

343396
# ############################# ANGIO
344397
def rename_all_angio_derivatives(params, main_workflow, angio_pipe, datasink,

skullTo3d/pipelines/skull_pipe.py

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ def _create_headmask_t1_pipe(name="headmask_t1_pipe", params={}):
222222
inputnode, ('indiv_params', parse_key, "t1_head_erode"),
223223
t1_head_erode, "indiv_params")
224224

225+
# mesh_t1_skull #######
226+
mesh_t1_head = pe.Node(
227+
IsoSurface(),
228+
name="mesh_t1_head")
229+
230+
headmask_t1_pipe.connect(
231+
t1_head_erode, "out_file",
232+
mesh_t1_head, "nii_file")
233+
225234
# t1_hmasked
226235
t1_hmasked = pe.Node(interface=ApplyMask(),
227236
name="t1_hmasked")
@@ -325,6 +334,26 @@ def _create_skullmask_t1_pipe(name="skullmask_t1_pipe", params={}):
325334
t1_head_erode_skin, "out_file",
326335
t1_head_skin_masked, "mask_file")
327336

337+
# mesh_t1_rawskull #######
338+
mesh_t1_rawskull = pe.Node(
339+
IsoSurface(),
340+
name="mesh_t1_rawskull")
341+
342+
skullmask_t1_pipe.connect(
343+
t1_head_skin_masked, "out_file",
344+
mesh_t1_rawskull, "nii_file")
345+
346+
else:
347+
348+
# mesh_t1_rawskull #######
349+
mesh_t1_rawskull = pe.Node(
350+
IsoSurface(),
351+
name="mesh_t1_rawskull")
352+
353+
skullmask_t1_pipe.connect(
354+
t1_skull_mask_binary, "out_file",
355+
mesh_t1_rawskull, "nii_file")
356+
328357
if "t1_skull_gcc_erode" in params and \
329358
"t1_skull_gcc_dilate" in params:
330359

@@ -497,8 +526,9 @@ def create_skull_t1_pipe(name="skull_t1_pipe", params={}):
497526
outputnode = pe.Node(
498527
niu.IdentityInterface(
499528
fields=["t1_skull_mask", "t1_skull_stl",
529+
"t1_rawskull_mask", "t1_rawskull_stl",
500530
"robustt1_skull_mask", "robustt1_skull_stl",
501-
"t1_head_mask"]),
531+
"t1_head_mask", "t1_head_stl",]),
502532
name='outputnode')
503533

504534
# Creating headmask_t1_pipe
@@ -528,6 +558,10 @@ def create_skull_t1_pipe(name="skull_t1_pipe", params={}):
528558
headmask_t1_pipe, "t1_head_erode.out_file",
529559
outputnode, "t1_head_mask")
530560

561+
skull_t1_pipe.connect(
562+
headmask_t1_pipe, "mesh_t1_head.stl_file",
563+
outputnode, "t1_head_stl")
564+
531565
# Creating skullmask_t1_pipe
532566
if "skullmask_t1_pipe" in params:
533567
skullmask_t1_pipe = _create_skullmask_t1_pipe(
@@ -544,14 +578,30 @@ def create_skull_t1_pipe(name="skull_t1_pipe", params={}):
544578
else:
545579
return skull_t1_pipe
546580

581+
# outputnode
547582
skull_t1_pipe.connect(
548583
skullmask_t1_pipe, "mesh_t1_skull.stl_file",
549584
outputnode, "t1_skull_stl")
550585

551586
skull_t1_pipe.connect(
552-
skullmask_t1_pipe, "t1_skull_erode.out_file",
587+
skullmask_t1_pipe, "t1_skull_mask_binary.out_file",
553588
outputnode, "t1_skull_mask")
554589

590+
# rawskull t1
591+
skull_t1_pipe.connect(
592+
skullmask_t1_pipe, "mesh_t1_rawskull.stl_file",
593+
outputnode, "t1_rawskull_stl")
594+
595+
if "t1_head_erode_skin" in params.keys():
596+
skull_t1_pipe.connect(
597+
skullmask_t1_pipe, "t1_head_skin_masked.out_file",
598+
outputnode, "t1_rawskull_mask")
599+
600+
else:
601+
skull_t1_pipe.connect(
602+
skullmask_t1_pipe, "t1_skull_mask_binary.out_file",
603+
outputnode, "t1_rawskull_mask")
604+
555605
if "t1_skull_fov" in params.keys():
556606
skull_t1_pipe.connect(
557607
skullmask_t1_pipe, "t1_skull_fov.out_roi",

workflows/params_segment_macaque_0p5_ants_4animal_skull.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@
7171
}
7272
},
7373
"export_5tt_pipe": {},
74+
7475
"IsoSurface_brain_pipe":
7576
{
7677
"merge_brain_tissues":
7778
{
7879
"keep_indexes": [2, 3, 4]
7980
}
81+
},
82+
83+
"IsoSurface_tissues_pipe":
84+
{
8085
}
8186
},
8287

workflows/params_segment_macaque_0p5_ants_4animal_skullnoisypetra.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@
7171
}
7272
},
7373
"export_5tt_pipe": {},
74+
7475
"IsoSurface_brain_pipe":
7576
{
7677
"merge_brain_tissues":
7778
{
7879
"keep_indexes": [2, 3, 4]
7980
}
81+
},
82+
83+
"IsoSurface_tissues_pipe":
84+
{
8085
}
8186
},
8287
"skull_t1_pipe":

workflows/params_segment_macaque_0p5_ants_quick_skull.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,17 @@
7070
}
7171
},
7272
"export_5tt_pipe": {},
73+
7374
"IsoSurface_brain_pipe":
7475
{
7576
"merge_brain_tissues":
7677
{
7778
"keep_indexes": [2, 3, 4]
7879
}
80+
},
81+
82+
"IsoSurface_tissues_pipe":
83+
{
7984
}
8085
},
8186

workflows/params_segment_macaque_0p5_ants_quick_skullnoisypetra.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
{
7777
"keep_indexes": [2, 3, 4]
7878
}
79+
},
80+
81+
"IsoSurface_tissues_pipe":
82+
{
7983
}
8084
},
8185
"skull_t1_pipe":

workflows/params_segment_macaque_0p5_ants_skull.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@
8282
{
8383
"keep_indexes": [2, 3, 4]
8484
}
85+
},
86+
87+
"IsoSurface_tissues_pipe":
88+
{
8589
}
8690
},
8791

workflows/params_segment_macaque_0p5_ants_skullnoisypetra.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@
8282
{
8383
"keep_indexes": [2, 3, 4]
8484
}
85+
},
86+
87+
"IsoSurface_tissues_pipe":
88+
{
8589
}
8690
},
8791
"skull_t1_pipe":

workflows/params_segment_macaque_ants_4animal_skull.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
{
7777
"keep_indexes": [2, 3, 4]
7878
}
79+
},
80+
81+
"IsoSurface_tissues_pipe":
82+
{
7983
}
8084
},
8185

@@ -140,8 +144,6 @@
140144

141145
"skull_petra_pipe":
142146
{
143-
144-
145147
"headmask_petra_pipe":
146148
{
147149

workflows/params_segment_macaque_ants_4animal_skullnoisypetra.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@
7676
{
7777
"keep_indexes": [2, 3, 4]
7878
}
79+
},
80+
"IsoSurface_tissues_pipe":
81+
{
7982
}
83+
8084
},
8185
"skull_t1_pipe":
8286
{

0 commit comments

Comments
 (0)