Download presentation
Presentation is loading. Please wait.
1
Surface_fit_classify [Stage 18]
CIVET Surface_fit_classify [Stage 18]
2
Stages nuc_t1_native skull_masking_native stx_register stx_tal_to_7
nuc_inorm_t1 skull_removal nlfit mask_classify pve_curvature pve reclassify segment cls_volumes cortical_masking segment_volumes surface_classify artefact create_wm_hemispheres segment_mask expand_from_white_left expand_from_white_right slide_left_hemi_obj_back flip_right_hemi_obj_back slide_right_hemi_obj_back calibrate_left_white calibrate_right_white laplace_field gray_surface_left gray_surface_right mid_surface_left mid_surface_right surface_fit_error verify_image_nlfit gyrification_index_left verify_brain_mask classify_qc dataterm_left_surface brain_mask_qc gyrification_index_right dataterm_right_surface surface_registration_left surface_registration_right mean_curvature_20mm_left mean_curvature_20mm_right thickness_tlink_20mm_right thickness_tlink_20mm_left resample_left_mean_curvature resample_right_mean_curvature resample_right_thickness resample_left_thickness lobe_area_right lobe_area_left verify_clasp verify_image
3
Stage 18. surface_fit_classify
모듈 : Surface_fit.pm Label : “fix the classification for surface extraction” Usage command line /progs/surface_fit_classify bin/mincresample bin/minccalc bin/skel bin/mincblur bin/mincstats bin/mincdefrag Input : (1) mni_icbm_00100_classify.mnc (2) mni_icbm_00100_pve_wm.mnc (3) mni_icbm_00100_pve_csf.mnc Output : (1) final_callosum.mnc (2) final_classify.mnc (3)csf_skel.mnc 의존성 : cortical masking, reclassify
4
[args] Step 1: Application of the custom mask (ventricules, cerebellum, sub-cortical gray) and final classification for surface extraction. ${$pipeline_ref}->addStage( { name => "surface_classify", label => "fix the classification for surface extraction", inputs => [$cls_correct, $pve_wm, $pve_csf, $nl_transform ], outputs => [$final_callosum, $final_classify, $skel_csf], args => ["surface_fit_classify", $cls_correct, $pve_wm, $pve_csf, $final_callosum, $final_classify, $skel_csf, $nl_transform, $Second_model_Dir ], prereqs => $Prereqs } ); [command line] /usr/local/mni/Dec /CIVET /progs/surface_fit_classify ./classify/mni_icbm_00100_classify.mnc ./classify/mn i_icbm_00100_pve_wm.mnc ./classify/mni_icbm_00100_pve_csf.mnc ./stg_18/final_ca llosum.mnc ./stg_18/final_classify.mnc ./stg_18/csf_skel.mnc ./transforms/nonlinear/ mni_icbm_00100_nlfit_It.xfm /usr/local/mni/Dec /CIVET-1.1.9/models/
5
[surface_fit_classify procedure]
(1) create custom_mask make_custom_mask( $cls_correct, $nl_transform, $custom_mask, $Second_model_Dir ); (2) copy contiguous pieces of white matter from pve image and custom mask fix_wm( $cls_correct, $pve_wm, $custom_mask, $classified_wm_fixed ); (3) fix gray matter voxels fix_gm( $classified_wm_fixed, $classified_wm_gm_fixed ); (4) create a midline mask to separate the hemispheres create_midline_mask( $classified_wm_gm_fixed, $final_callosum ); (5) final classification run( "minccalc", "-clobber", "-expr", "if(A[1]>0){out=A[1];}else{out=A[0];}", $classified_wm_gm_fixed, $final_callosum, $final_classify ); (6) create the csf skeleton make_csf_skel( $final_classify, $pve_csf, $skel_csf, $tmpdir );
6
(1) create custom_mask make_custom_mask( $cls_correct, $nl_transform, $custom_mask, $Second_model_Dir ); ##create custom_mask to mask sub-cortical gray and fill up ventricles.## run( "mincresample", "-clobber", "-like", $cls_correct, "-invert_transformation", "-nearest_neighbour", "-transform", $nl_transform, $model_mask, $custom_mask ); mincresample -clobber -like ./classify/mni_icbm_00100_classify.mnc - invert_transformation -nearest_neighbour - transform ./transforms/nonlinear/mni_icbm_00100_nlfit_It.xfm /usr/local/mni/Dec /CIVET /models/Cerebellum_Ventricles_SubCortical_Mask.mnc ./custom_mask.mnc Usage: mincresample [<options>] <infile> <outfile> -transformation: File giving world transformation. (Default = identity). -invert_transformation: Invert the transformation before using it. -like: Specifies a model file for the resampling. -nearest_neighbour: Do nearest neighbour interpolation
7
(1) create custom_mask <model & custom_mask>
8
(1) create custom_mask <custom_mask & classify>
9
(1) create custom_mask <custom_mask (invert)& (non invert)>
10
(2) fix_wm fix_wm( classified.mnc, pve_wm, custom_mask.mnc, output.mnc ) fix_wm is a little bit of image processing alchemy that attempts // the following: 1) adds the wm skeleton to the wm image by removing any loose ends by blurring and cropping 2) blurs and crops the whole image, and its negative iteratively, to remove "nonsense" voxels fix_wm : (1) Combine custom mask for ventricles and sub-cortical gray into white. (2) First Pass, add the connected skeleton voxels to the image (3) now we have pruned the wm pve skeleton, we are going to add it to the classified white matter and then get rid of nonsense voxels (4) first defrag the gray and add the excluded voxels to csf unless they are surrounded by white
11
fix_wm (2)-1: ## Combine custom mask for ventricules and sub-cortical gray into white.## run( "minccalc", "-byte", "-clobber", "-expr", "if(abs(A[1]-1)<0.45||abs(A[1]-3)<0.45){out=1;}else{if(abs(A[1]-2)<0.45){out=0;}else{if(A[0]>1.0e- 06){out=1;}else{out=0;}}}", $pve_wm, $custom_mask, $pve_wm_temp ); run( "skel", $pve_wm_temp, $pve_wm_skel ); run( "minccalc", "-clobber", "-expr", "if(abs(A[1]-1)<0.45||abs(A[1]-3)<0.45){out=3;}else{if(abs(A[1]-2)<0.45){out=1;}else{out=A[0];}}", $classified, $custom_mask, $classified_temp) ; [1] minccalc -byte -clobber -expr 'if(abs(A[1]-1)<0.45||abs(A[1]- 3)<0.45){out=1;}else{if(abs(A[1]-2)<0.45){out=0;}else{if(A[0]>1.0e- 06){out=1;}else{out=0;}}}' ../classify/mni_icbm_00100_pve_wm.mnc ./custom_mask.m nc ./pve_plugged.mnc [Usage]: minccalc [options] [<in1.mnc> ...] <out.mnc> [options] -byte: Write out byte data. -expression: Expression to use in calculations. -clobber: Overwrite existing file.
12
fix_wm (2)-1-1 <pve_wm & pve_plugged>
13
fix_wm (2)-1-1 <custom_mask & pve_plugged>
14
fix_wm (2)-1-2: “ skel ” : Skeletonizes a binary thresholded minc volume
[2] skel ./pve_plugged.mnc ./temp_skel.mnc [Usage] : skel <input.mnc> <output.mnc>
15
fix_wm (2)-1-3: run( "minccalc", "-clobber", "-expr", "if(abs(A[1]-1)<0.45||abs(A[1]-3)<0.45){out=3;} else{if(abs(A[1]-2)<0.45){out=1;}else{out=A[0];}}", $classified, $custom_mask, $classified_temp) ; minccalc -clobber -expr 'if(abs(A[1]-1)<0.45||abs(A[1]-3)<0.45){out=3;}else{if(abs(A[1]- 2)<0.45){out=1;}else{out=A[0];}}' ../classify/mni_icbm_00100_classify.mnc ./custom_mask.mnc ./cl assified_plugged.mnc
16
fix_wm (2)-1-3: [custom_mask & classified_plugged]
17
fix_wm (2)-2: ### First Pass, add the connected skeleton voxels to the image ## run( "mincblur", "-clobber", "-fwhm", "2", $pve_wm_skel, $temp_blur ); run( "minccalc", "-clobber", "-expr", "out=(A[0]>${integrity}||A[2]==3)&&A[1];", $temp_blur, $pve_wm_skel, $classified_temp, $pve_wm_skel_new ); run( "minccalc", "-clobber", "-expr", "out=abs(A[0]-A[1]);", $pve_wm_skel, $pve_wm_skel_new, $temp_diff); "mincstats", "-sum", $temp_diff run( "mv", "-f", $pve_wm_skel_new, $pve_wm_skel ); [1] mincblur -clobber -fwhm 2 ./temp_skel.mnc ./temp_blur.mnc Usage: mincblur [<options>] <inputfile> <output_basename> [options] -fwhm: Full-width-half-maximum of gaussian kernel [2] minccalc -clobber -expr 'out=(A[0]>0.3||A[2]==3)&&A[1];' ./temp_blur.mnc ./temp_skel.mnc ./classified_plug ged.mnc ./temp_skel_new.mnc
18
fix_wm (2)-2-1: [temp_skel.mnc & temp_blur.mnc]
19
fix_wm (2)-2-2: [classified_plugged & temp_skel_new ]
20
[3] minccalc -clobber -expr 'out=abs(A[0]-A[1]);' ./temp_skel.mnc
./temp_skel_new.mnc ./temp_diff.mnc [4] mincstats -sum ./temp_diff.mnc ## Mincstats will calculate simple statistical measures across all voxels of a minc file. ## Usage: mincstats [options] <infile.mnc> [options] : -sum : SUM >> Statistics (Printed in this order) ** [4] “mincstats” result ** Iteration:0 Voxels changed:5775 -> temp_diff.mnc의 모든 voxel sum Iteration:1 Voxels changed:812 Iteration:2 Voxels changed:239 Iteration:3 Voxels changed:75 Iteration:4 Voxels changed:42 Iteration:5 Voxels changed:15 Iteration:6 Voxels changed:9 Iteration:7 Voxels changed:6 Iteration:8 Voxels changed:1 Iteration:9 Voxels changed:0
21
fix_wm (2)-2-3: [temp_skel_new.mnc & temp_diff.mnc]
22
fix_wm (2)-3: # now we have pruned the wm pve skeleton, we are going to add it to the classified white matter and then get rid of nonsense voxels. ## run( "minccalc", "-clobber", "-expr", "out=A[0]||(abs(A[1]-3)<0.45);", $pve_wm_skel, $classified_temp, $wm_with_skel) ; run( "mincblur", "-clobber", "-fwhm", "2", $wm_with_skel, $temp_blur ); run( "minccalc", "-clobber", "-expr", "out=if(A[0]<${integrity}&&A[1]>0.5){out==0;} else{if(A[0]>(1-${integrity})&&A[1]<0.5){out==1;}else{out=A[1];}};", $temp_blur, $wm_with_skel, $wm_with_skel_new ); run( "minccalc", "-clobber", "-expr", "out=abs(A[0]-A[1]);", $wm_with_skel, $wm_with_skel_new, $temp_diff ); "mincstats", "-sum", $temp_diff run( "mv", "-f", $wm_with_skel_new, $wm_with_skel ); [1] minccalc -clobber -expr 'out=A[0]||(abs(A[1]- 3)<0.45);' ./temp_skel_final.mnc ./classified_plugged.mnc ./wm_with_skel.mnc
23
fix_wm (2)-3-1: [classified_plugged & wm_with_skel.mnc]
24
fix_wm (2)-3-1: [temp_skel_final.mnc & wm_with_skel.mnc]
25
[2] mincblur -clobber -fwhm 2 ./wm_with_skel.mnc ./temp_blur_wm.mnc
26
[3] minccalc -clobber -expr 'out=if(A[0]<0. 3&&A[1]>0
[3] minccalc -clobber -expr 'out=if(A[0]<0.3&&A[1]>0.5){out==0;}else{if(A[0]>(1- 0.3)&&A[1]<0.5){out==1;}else{out=A[1];}};' ./temp_blur_wm.mnc ./wm_with_skel.mnc ./wm_with_skel_new.mnc
27
[4] minccalc -clobber -expr 'out=abs(A[0]-A[1]);'. /wm_with_skel. mnc
[4] minccalc -clobber -expr 'out=abs(A[0]-A[1]);' ./wm_with_skel.mnc ./wm_with_skel_new.mnc ./temp_diff_wm.mnc
28
[5] mincstats -sum. /temp_diff_wm. mnc. [5] “mincstats” result
[5] mincstats -sum ./temp_diff_wm.mnc ** [5] “mincstats” result ** Iteration B:0 Voxels changed:1540 ->> temp_diff_wm.mnc의 모든 voxel수 Iteration B:1 Voxels changed:345 Iteration B:2 Voxels changed:132 Iteration B:3 Voxels changed:66 Iteration B:4 Voxels changed:43 Iteration B:5 Voxels changed:21 Iteration B:6 Voxels changed:17 Iteration B:7 Voxels changed:6 Iteration B:8 Voxels changed:2 Iteration B:9 Voxels changed:1 Iteration B:10 Voxels changed:0
29
[fix_wm-(2)-3 final]
30
fix_wm (2)-4: # first defrag the gray and add the excluded voxels to csf unless they are surrounded by white run( "mincdefrag", $wm_with_skel, $wm_with_skel_new, "1", "27", "100000"); run( "minccalc", "-clobber", "-expr", "out=A[0]<0.5;", $wm_with_skel_new, $wm_with_skel ); run( "mincdefrag", $wm_with_skel, $wm_with_skel_new, "1", "27", "100000"); run( "minccalc", "-clobber", "-expr", "out=A[0]<0.5;", $wm_with_skel_new, $wm_with_skel ); run( "minccalc", "-clobber", "-expr", "if(abs(A[0]-1)>0.45&&abs(A[1]-3)<0.45){out=2;} else{if(abs(A[0]-1)<0.45&&abs(A[1]-3)>0.45){out=3}else{out=A[1];}};", $wm_with_skel, $classified_temp , $output ); [1] mincdefrag ./wm_with_skel_10.mnc ./wm_with_skel_defrag.mnc [Usage]: mincdefrag input.mnc output.mnc label stencil [max_connect] label = integer label for voxel intensity stencil = number of neighbours (6, 19, 27) max_connect = threshold for number of connected voxels >> ** “[1]mincdefrag” result ** Kept total of voxels of label 1 Removed total of 1670 voxels of label 1
31
fix_wm (2)-4-1: [wm_with_skel_10.mnc & wm_with_skel_defrag.mnc ]
32
[2] minccalc -clobber -expr 'out=A[0]<0. 5;'. /wm_with_skel_defrag
[2] minccalc -clobber -expr 'out=A[0]<0.5;' ./wm_with_skel_defrag.mnc ./wm_with_skel_defrag_modify.mnc
33
[3] mincdefrag ./wm_with_skel_defrag_modify.mnc
./wm_with_skel_defrag_modify_defrag.mnc **result** : Kept total of voxels of label 1, Removed total of 449 voxels of label 1
34
[4] minccalc -clobber -expr 'out=A[0]<0. 5;'
[4] minccalc -clobber -expr 'out=A[0]<0.5;' ./wm_with_skel_defrag_modify_defrag.mnc ./wm_with_skel_defrag_modify_defrag_modify.mnc
35
[5] minccalc -clobber -expr 'if(abs(A[0]-1)>0. 45&&abs(A[1]-3)<0
[5] minccalc -clobber -expr 'if(abs(A[0]-1)>0.45&&abs(A[1]-3)<0.45){out=2;}else{if(abs(A[0]- 1)<0.45&&abs(A[1]-3)>0.45){out=3}else{out=A[1];}};' ./wm_with_skel_defrag_modify_defrag_modify.mnc ./classified_plugged.mnc ./classified_wm_fixed.mnc
36
[5] wm_with_skel_defrag_modify_defrag_modify.mnc & classified_wm_fixed.mnc
37
(3) fix_gm fix_gm is “ fix gray matter voxels” >> fix_gm( $classified_wm_fixed, $classified_wm_gm_fixed ); fix_gm is a little bit of image processing alchemy that attempts the following: 1) adds the wm skeleton to the wm image by removing any loose ends by blurring and cropping 2) blurs and crops the whole image, and its negative iteratively, to remove "nonsense" voxels # fix_gm( classified.mnc, output.mnc ) fix_gm (3) -1: run( "minccalc", "-clobber", "-expr", 'out=abs(A[0]-3)<0.45;', $classified, $temp_white ); run( "mincblur", "-clobber", "-fwhm", "2", $temp_white, $temp_white_blur_prefix ); run( "minccalc", "-clobber", "-expr", 'out=abs(A[0]-2)<0.45;', $classified, $temp_gray ); fix_gm (3) -1-[1]: [1] minccalc -clobber -expr 'out=abs(A[0]-3)<0.45;' ./classified_wm_fixed.mnc ./temp_white.mnc
38
fix_gm (3)-1-[1] [classified_wm_fixed.mnc & temp_white.mnc]
39
fix_gm (3)-1-[2] : mincblur -clobber -fwhm 2. /temp_white. mnc
fix_gm (3)-1-[2] : mincblur -clobber -fwhm 2 ./temp_white.mnc ./temp_white
40
fix_gm (3)-1-[3] : minccalc -clobber -expr 'out=abs(A[0]-2)<0. 45;'
fix_gm (3)-1-[3] : minccalc -clobber -expr 'out=abs(A[0]-2)<0.45;' ./classified_wm_fixed.mnc ./temp_gray.mnc
41
fix_gm (3)-2: “mincdefrag” is ##first defrag the gray ## mincdefrag
fix_gm (3)-2: “mincdefrag” is ##first defrag the gray ## mincdefrag ./temp_gray.mnc ./temp_gray_defrag.mnc **result ** : Kept total of voxels of label 1, Removed total of 917 voxels of label 1
42
fix_gm (3)-3 ###then go through iterations of blur and remove until converged while (!$done && $count<50){ run( "mincblur", "-clobber", "-fwhm", "2", $temp_gray_defrag, $temp_gray_blur_prefix ); run( "minccalc", "-clobber", "-expr", 'out=(A[0]>0.45&&abs(A[1]-1)<0.45)||(A[0]>0.001&&A[2]>0.01&&abs(A[1]-1)<0.45);', $temp_gray_blur, $temp_gray_defrag, $temp_white_blur, $temp_gray_new); run( "minccalc", "-clobber", "-expr", 'out=abs(A[0]-A[1]);', $temp_gray_defrag, $temp_gray_new, $temp_gray_diff ); = ("mincstats", "-sum", $temp_gray_diff) ; print ; my $stats_result = ; = split/\s+/, $stats_result ; print ("Iteration:${count}\tVoxels changed:${line[1]}\n") ; if ($line[1]<20) { $done = 1 ; } $count = $count+1 ; run("mv", "-f", $temp_gray_new, $temp_gray_defrag) ; } fix_gm (3)-3 –[1] mincblur -clobber -fwhm 2 ./temp_gray_defrag.mnc ./temp_gray_defrag_1
43
fix_gm (3)-3-[1] : [temp_gray_defrag. mnc & temp_gray_defrag_1_blur
fix_gm (3)-3-[1] : [temp_gray_defrag.mnc & temp_gray_defrag_1_blur.mnc]
44
fix_gm (3)-3-[2] : minccalc -clobber -expr 'out=(A[0]>0
fix_gm (3)-3-[2] : minccalc -clobber -expr 'out=(A[0]>0.45&&abs(A[1]- 1)<0.45)||(A[0]>0.001&&A[2]>0.01&&abs(A[1]-1)<0.45);' ./temp_gray_defrag_1_blur.mnc ./temp_gray_defrag.mnc ./temp_white_blur.mnc ./temp_gray_defrag_new.mnc
45
fix_gm (3)-3-[3] : minccalc -clobber -expr 'out=abs(A[0]-A[1]);'
./temp_gray_defrag.mnc ./temp_gray_defrag_new.mnc ./temp_gray_diff.mnc
46
fix_gm (3)-3-[3] : minccalc -clobber -expr 'out=abs(A[0]-A[1]);'
./temp_gray_defrag.mnc ./temp_gray_defrag_new.mnc ./temp_gray_diff.mnc ** “mincstats” result ** Iteration:0 Voxels changed:5050 Iteration:1 Voxels changed:2214 Iteration:2 Voxels changed:1461 Iteration:3 Voxels changed:1123 Iteration:4 Voxels changed:877 Iteration:5 Voxels changed:677 Iteration:6 Voxels changed:525 . Iteration:49 Voxels changed:16
47
fix_gm (3)-3-final : [temp_gray_defrag_50.mnc & temp_gray_defrag.mnc]
48
fix_gm (3)-3-final] : [temp_gray_diff.mnc & temp_gray_diff_49.mnc]
49
fix_gm (3)-3-final : [temp_gray_defrag_50. mnc & sub
fix_gm (3)-3-final : [temp_gray_defrag_50.mnc & sub.mnc(final-initial)]
50
** “mincdefrag” result **
fix_gm_3_4 [1] run( "mincdefrag", $temp_gray_defrag, $temp_gray_new, "1", "27", "100000" ); mincdefrag ./temp_gray_defrag_50.mnc ./temp_gray_defrag_new.mnc ** “mincdefrag” result ** Kept total of voxels of label 1, Removed total of 0 voxels of label 1
51
fix_gm_3_4 [2] [temp_gray_defrag_new. mnc & classified_wm_gm_fixed
fix_gm_3_4 [2] [temp_gray_defrag_new.mnc & classified_wm_gm_fixed.mnc] run( "minccalc", "-clobber", "-expr", 'if(A[0]<0.5&&A[1]>0.5&&A[2]>0.25){out=2}else{if(A[0]<0.5&&A[1]>0.5&&A[2]<0.25){out=1}else{out=A [3];}}', $temp_gray_new, $temp_gray, $temp_white_blur, $classified, $result );
52
fix_gm_3_4 [2] : [classified_wm_fixed. mnc & classified_wm_gm_fixed
fix_gm_3_4 [2] : [classified_wm_fixed.mnc & classified_wm_gm_fixed.mnc]
53
# create_midline_mask extracts . >> create_midline_mask classified.mnc output.mnc # The creation of the midline mask below will work with any template (0.5mm, 1.0mm, for example), assuming that the centerline voxel is at x=0. run( "minccalc", "-clobber", "-byte", "-expr", "out=1;", $classify, $filled ); run( "mincresample", "-clobber", "-xstart", 0, "-xnelements", 1, $filled, $mid_tmp ); run( "mincresample", "-clobber", "-like", $classify, $mid_tmp, $midline_mask ); run( "minccalc", "-clobber", "-expr", "out=abs(A[0]-3)<0.45&&A[1];", $classify, $midline_mask, $callosum_with_bits ); run( "mincdefrag", $callosum_with_bits, $callosal_defrag, 1, 27, 1000 ); run( "mincblur", "-clobber", "-fwhm", 2, $callosal_defrag, $callosal_blur ); run( "minccalc", "-clobber", "-byte", "-expr", "if(A[0]>0.0001&&A[1]==1){out=1}else{if(A[0]>0.08){out=2}else{out=0;}};", $callosal_blur, $midline_mask, $output ); fix_gm_4 [1] : minccalc -clobber -byte -expr 'out=1;' ./classified_wm_gm_fixed.mnc ./filled.mnc fix_gm_4 [2] : mincresample -clobber -xstart 0 -xnelements 1 ./filled.mnc ./mid_tmp.mnc fix_gm_4 [3] : mincresample -clobber -like ./classified_wm_gm_fixed.mnc ./mid_tmp.mnc ./midline_mask.mnc fix_gm_4 [4] : minccalc -clobber -expr 'out=abs(A[0]-3)<0.45&&A[1];' ./classified_wm_gm_fixed.mnc ./midline_mask.mnc ./callosum_with_bits.mnc fix_gm_4 [5] : mincdefrag ./callosum_with_bits.mnc ./callosum_defrag.mnc fix_gm_4 [6] : mincblur -clobber -fwhm 2 ./callosum_defrag.mnc ./callosal_blur.mnc fix_gm_4 [7] : minccalc -clobber -byte -expr 'if(A[0]>0.0001&&A[1]==1){out=1}else{if(A[0]>0.08){out=2}else{out=0;}};' ./callosal_blur.mnc_blur.mnc ./midline_mask.mnc ./final_callosum.mnc
54
mincresample “mincresample” will resample a minc file along new spatial dimensions with new voxel positions Usage: mincresample [<options>] <infile> <outfile> -xstart: Start point along the X dimension -start: Start point along each dimension (X, Y, Z) Default value: e e e+308 -xnelements: Number of elements along the X dimension mincresample -clobber -xstart 0 -xnelements 1 ./filled.mnc ./mid_tmp.mnc
55
fix_gm_4 [1] : minccalc -clobber -byte -expr 'out=1;'
fix_gm_4 [1] : minccalc -clobber -byte -expr 'out=1;' ./classified_wm_gm_fixed.mnc ./filled.mnc
56
fix_gm_4 [2] : mincresample -clobber -xstart 0 -xnelements 1. /filled
fix_gm_4 [2] : mincresample -clobber -xstart 0 -xnelements 1 ./filled.mnc ./mid_tmp.mnc fix_gm_4 [3] : mincresample -clobber -like ./classified_wm_gm_fixed.mnc ./mid_tmp.mnc ./midline_mask.mnc
57
fix_gm_4 [4] : minccalc -clobber -expr 'out=abs(A[0]-3)<0
fix_gm_4 [4] : minccalc -clobber -expr 'out=abs(A[0]-3)<0.45&&A[1];' ./classified_wm_gm_fixed.mnc ./midline_mask.mnc ./callosum_with_bits.mnc
58
fix_gm_4 [5] : mincdefrag. /callosum_with_bits. mnc. /callosum_defrag
fix_gm_4 [5] : mincdefrag ./callosum_with_bits.mnc ./callosum_defrag.mnc **result ** : Kept total of 1796 voxels of label 1, Removed total of 0 voxels of label 1
59
fix_gm_4 [6] : mincblur -clobber -fwhm 2. /callosum_defrag. mnc
fix_gm_4 [6] : mincblur -clobber -fwhm 2 ./callosum_defrag.mnc ./callosal_blur.mnc
60
fix_gm_4 [7] : minccalc -clobber -byte -expr 'if(A[0]>0
fix_gm_4 [7] : minccalc -clobber -byte -expr 'if(A[0]>0.0001&&A[1]==1){out=1}else{if(A[0]>0.08) {out=2}else{out=0;}};' ./callosal_blur.mnc_blur.mnc ./midline_mask.mnc ./final_callosum.mnc
61
# final classification run( "minccalc", "-clobber", "-expr", "if(A[1]>0){out=A[1];}else{out=A[0];}", $classified_wm_gm_fixed, $final_callosum, $final_classify );
62
# final classification run( "minccalc", "-clobber", "-expr", "if(A[1]>0){out=A[1];}else{out=A[0];}", $classified_wm_gm_fixed, $final_callosum, $final_classify );
63
# create the csf skeleton # Make sure there is a layer of CSF around the cortex: - select white + gray - dilate white + gray by one voxel layer - add csf to the skeleton in the dilated layer of the mask - create the fixed skeleton to be used in the Laplacian field for the gray surface extraction. # NOTE: If you don't do this step, the skeleton will go through the gray matter if there is no layer of csf between gray and background. This will truncate the gray matter and make the cortex thinner. run( "minccalc", "-clobber", "-byte", "-expression", "if(A[0]>1.5){out=1;}else{out=0;}", $cls_correct, $wm_gm_mask ); run( "dilate_volume", $wm_gm_mask, $wm_gm_maskD, "1", "26", "1" ); run( "minccalc", "-clobber", "-byte", "-expression", "if((A[1]<1.5&&A[2]>0.5)||A[0]>1.0e-06){out=1;}else{out=0;}", $pve_csf, $cls_correct, $wm_gm_maskD, $pve_csf_dil ); run( "skel", $pve_csf_dil, $skel_csf ); [1] minccalc -clobber -byte -expression 'if(A[0]>1.5){out=1;}else{out=0;}' final_classify.mnc ./wm_gm_mask.mnc [2] dilate_volume ./wm_gm_mask.mnc ./wm_gm_mask_dil.mnc >> “result” : [3] minccalc -clobber -byte -expression 'if((A[1]<1.5&&A[2]>0.5)||A[0]>1.0e- 06){out=1;}else{out=0;}' ../../classify/mni_icbm_00100_pve_csf.mnc final_classify.mnc ./wm_gm_mask_dil.mnc ./pve_csf_dil.mnc [4] skel ./pve_csf_dil.mnc csf_skel.mnc
64
dilate_volume Usage: dilate_volume input.mnc output.mnc dilation_value [6|26] [n_dilations] [mask.mnc min_mask max_mask] Note: Dilates all regions of value dilation_value, by n_dilations of 3X3X3, (1 dilation by default). You can specify 6 or 26 neighbours, default being 26. If the mask volume and range is specified, then only voxels in the specified mask range will be dilated.
65
[1] minccalc [final_classify.mnc & wm_gm_mask.mnc]
66
[2] dilate_volume [wm_gm_mask.mnc & wm_gm_mask_dil.mnc ]
67
[3] minccalc [wm_gm_mask_dil.mnc & pve_csf_dil.mnc]
68
[4] skel [pve_csf_dil.mnc & csf_skel.mnc]
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.