$! $! _/_/_/ _/_/_/ _/ $! _/ _/ _/ _/ Image Processing Language $! _/ _/_/_/ _/ $! _/ _/ _/ (c) Scanco Medical AG Switzerland $! _/_/_/ _/ _/_/_/_/ $! $! $! $! IPL Batch Scanco $! Michiel Peters $! Michiel.peters@maastrichtuniversity.nl $! $!------------------------------------------------------------------------- $! execute $! @mp_interruptiondetection_246um c0001234.aim $! $!------------------------------------------------------------------------- $! $! define input files $! $ FILENAME = F$PARSE("''p1'",,,"NAME") $ DEV = F$PARSE("''p1'",,,"DEVICE") $ DIR = F$PARSE("''p1'",,,"DIRECTORY") $! $ biopsy :== 'DEV''DIR''FILENAME' ! without extension $! $ IN_AIM = p1 $ IN_GOBJ = p2 $ SMOOTH_GOBJ = "''biopsy'" + "_smooth.gobj" $ TB_MASK_AIM = "''biopsy'" + "_trab_bone_mask.aim" $ CORT_MASK_AIM = "''biopsy'" + "_cortex_mask.aim" $ $ $ breaks16_GOBJ = "''biopsy'" + "_Breaks_246um.gobj" $ TRANS16_AIM = "''biopsy'" + "_TRANSBREAKS_246um.aim" $ COMBI16_AIM = "''biopsy'" + "_COMBI_246um.aim" $ OUT16_HIS = "''biopsy'" + "_Breaks_246um.txt" $ $ $ $ $ $! $!------------------------------------------------------------------------- $! $ ON ERROR THEN EXIT $! $ IPLFE_BATCH ! ----- read data ----- /read -name seg -filename "IN_AIM /gobj_to_aim -gobj_filename "IN_GOBJ -output vol -peel_iter 0 /bounding_box_cut -input vol -output gobj_box -z_only false -border 0 0 0 /set_val -input gobj_box -value_object 1 -value_background 1 ! ------------- smoothening contour --------------- /close -input vol -output voll -close_distance 1 /bounding_box_cut -input seg -output in1 -z_only false -border 0 0 0 /del seg /copy in1 in /multiply -input1 voll -input2 gobj_box -output volll -common_region_only false -multiply_zero_pixels true /bounding_box_cut -input volll -output vollll -z_only false -border 0 0 0 /togobj_from_aim -input vollll -gobj_filename "SMOOTH_GOBJ -min_elements 0 -max_elements 0 -curvature_smooth 1 /copy vollll background /set_value -input background -value_object 0 -value_background 127 ! ----- define cortical region of 0.33mm voxels thick ----- /copy vollll diff /del voll /del vol /del volll /del gobj_box /del in1 /erosion -input diff -output ero -erode_distance 4 -use_previous_margin false /subtract_aims -input1 diff -input2 ero -output cort_mask /write cort_mask "CORT_MASK_AIM /write ero "TB_MASK_AIM /copy in cortex /gobj_mask -input_output cortex -gobj_filename "CORT_MASK_AIM -peel_iter 0 /copy in trabec /gobj_mask -input_output trabec -gobj_filename "TB_MASK_AIM -peel_iter 0 /copy trabec trab /copy cortex cort /set_value -input cort -value_object 23 -value_background 0 /set_value -input trab -value_object 5 -value_background 0 /concat -input1 cort -input2 trab -output structure -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /del cort /del trab /del trabec /del gobj_box /del in1 /del vollll /del trabec /del in ! ------------------------------------------------------------------------------------ ! ------------ Breaks >0.16mm (dilate till break >=0.246mm remain) ---------------- ! ------------------------------------------------------------------------------------ /dilation -input cortex -output cort_dil -dilate_distance 1 ! Subject to change -continuous_at_boundary 0 -use_previous_margin false /gobj_mask -input_output cort_dil -gobj_filename "CORT_MASK_AIM -peel_iter 0 /set_value -input cort_dil -value_object 0 -value_background 10 /bounding_box_cut -input cort_dil -output cort_dill -z_only false -border 0 0 0 /gobj_mask -input_output cort_dill -gobj_filename "CORT_MASK_AIM -peel_iter 0 /concat -input1 cort_dill -input2 background -output back_break -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /cl_rank_extract -input back_break -output breaks -first_rank 1 -last_rank 1 -connect_boundary false -value_in_range 127 /del back_break /subtract_aims -input1 breaks -input2 background -output break /concat -input1 break -input2 ero -output tb_break -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /cl_rank_extract -input tb_break -output breaks -first_rank 1 -last_rank 2 -connect_boundary false -value_in_range 127 /del tb_break /subtract_aims -input1 breaks -input2 ero -output cort_dill /dilation -input cort_dill -output breaks -dilate_distance 1 ! Subject to change -continuous_at_boundary 0 -use_previous_margin false /del cort_dill /del cort_dil /gobj_mask -input_output breaks -gobj_filename "CORT_MASK_AIM -peel_iter 0 /set_value -input breaks -value_object 127 -value_background 0 /gobj_mask -input_output breaks -gobj_filename "CORT_MASK_AIM -peel_iter 0 /concat -input1 breaks -input2 background -output back_break -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /cl_rank_extract -input back_break -output breaks -first_rank 1 -last_rank 1 -connect_boundary false -value_in_range 127 /del back_break /subtract_aims -input1 breaks -input2 background -output break /concat -input1 break -input2 ero -output tb_break -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /cl_rank_extract -input tb_break -output breaks -first_rank 1 -last_rank 2 -connect_boundary false -value_in_range 127 /del tb_break /subtract_aims -input1 breaks -input2 ero -output break /cl_nr_extract -input break -output breaks -min_number 20 ! Change if more dilation steps are chosen -max_number 50000 -value_in_range 50 /togobj_from_aim -input breaks -gobj_filename "breaks16_GOBJ -min_elements 0 -max_elements 0 -curvature_smooth 4 ! ------ throwing away very small breaks that should not have remained,-------- ! -------- plus very large "breaks" that emerge when no breaks are found ---- /cl_image -input breaks -output breaks_colored /read transmask "CORT_MASK_AIM /set_value -input transmask -value_object -1 -value_background 0 ! ----------------------------------------------------------- ! ----------------- Make overalll files --------------------- ! ----------------------------------------------------------- /togobj_from_aim -input breaks -gobj_filename "breaks16_GOBJ -min_elements 0 -max_elements 0 -curvature_smooth 4 /concat -input1 transmask -input2 breaks -output transbreaks -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /del transmask /bounding_box_cut -input transbreaks -output transcut -z_only false -border 0 0 0 /del transbreaks /write transcut "TRANS16_AIM /concat -input1 structure -input2 breaks -output CombiBreaks -common_region_only false -add_not_overlay false -make_edge false -shift_ofin2 0 0 0 /bounding_box_cut -input CombiBreaks -output CombiCut -z_only false -border 0 0 0 /del Combibreaks /write CombiCut "COMBI16_AIM /histo -input breaks_colored -fileout_or_screentab "OUT16_HIS -from_val -1 -to_val -1 -nr_bins_in_tab -1 -dt_type auto -count_zeros false -unit 0 /del cort_mask /del ero /del cortex /del background /del diff /del breaks /del break /del structure /del transcut /del breaks_colored .. $ exit