An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 90819924 authored by Ken Martin's avatar Ken Martin
Browse files

added load vtktcl and removed semicolons

parent e2812ef5
catch {load vtktcl}
# Developed By Majeid Alyassin
set slicenumber 0
......@@ -7,18 +8,18 @@ set thresholdvalue 1400
set invalue 1000
set boundaryvalue 100
set kernelradius 1
set subx 4;
set suby 4;
set subz 1;
set subs 1;
set afilter 10;
set con 6;
set lprojection $subz;
set uprojection [expr $numslices - 1 - $subz];
set window 2000;
set level 2000;
#set prefix "/home/alyassin2/database/Duke/cw1/original/duke1";
set prefix "/home/alyassin2/database/gems/CTangio/CW1/original/i7903CTGE";
set subx 4
set suby 4
set subz 1
set subs 1
set afilter 10
set con 6
set lprojection $subz
set uprojection [expr $numslices - 1 - $subz]
set window 2000
set level 2000
#set prefix "/home/alyassin2/database/Duke/cw1/original/duke1"
set prefix "/home/alyassin2/database/gems/CTangio/CW1/original/i7903CTGE"
set VTK_FLOAT 1
set VTK_INT 2
......@@ -35,114 +36,114 @@ set VTK_IMAGE_COMPONENT_AXIS 4
# Image pipeline
vtkImageSeriesReader reader;
vtkImageSeriesReader reader
#reader DebugOn
reader SetDataDimensions 512 512 $numslices 1;
reader SetFirst $firstslice;
reader SetFilePrefix $prefix;
reader SetOutputScalarType $VTK_SHORT;
reader SetPixelMask 0x7fff;
reader ReleaseDataFlagOff;
vtkImageSubSampling ss;
ss MaximumOn;
ss SetSamplingFactors $subx $suby $subz;
ss SetInput [reader GetOutput];
ss ReleaseDataFlagOff;
vtkImageConnectivity connect;
connect PercentLevelValueOn;
connect SetPLevelSeedValue 0.9;
connect SetNeighbors 26;
connect SetThreshold $thresholdvalue;
#connect SingleSeedOn;
#connect SetSeedXYZ 17 61 5;
connect SetOutputScalarType $VTK_UNSIGNED_CHAR;
connect SetInput [ss GetOutput];
connect ReleaseDataFlagOff;
vtkImageMarkBoundary mb;
mb SetDilateValue 1;
mb SetSurfaceValue $boundaryvalue;
mb SetKernelRadius $kernelradius;
mb SetOutputScalarType $VTK_UNSIGNED_CHAR;
mb SetInput [connect GetOutput];
mb ReleaseDataFlagOff;
vtkImageThreshold thresh;
thresh SetInput [ss GetOutput];
thresh SetOutputScalarType $VTK_SHORT;
thresh ThresholdByUpper $thresholdvalue;
thresh SetInValue $invalue;
thresh ReleaseDataFlagOff;
vtkImageThreshold thresh2;
thresh2 SetInput [thresh GetOutput];
thresh2 SetOutputScalarType $VTK_SHORT;
thresh2 ThresholdByLower $invalue;
thresh2 SetInValue $invalue;
thresh2 ReleaseDataFlagOff;
vtkImageAdaptiveFilter af;
af MedianOn;
af SetAdaptiveValue $boundaryvalue;
af SetKernelDimensions $kernelradius $kernelradius $kernelradius;
af SetInput1 [thresh2 GetOutput];
af SetInput2 [mb GetOutput];
af SetOutputScalarType $VTK_SHORT;
af ReleaseDataFlagOff;
vtkImageCTAComposite composite;
composite SetMaskInput [mb GetOutput];
composite SetDataOriginalInput [reader GetOutput];
composite SetSubSampledInput [af GetOutput];
composite SetMagnificationFactors $subx $suby $subz;
composite SetReplaceValue $invalue;
composite SetMaskReplace 1;
composite SetMaskOriginal 0;
composite SetMaskTrilinear $boundaryvalue;
composite ReleaseDataFlagOff;
vtkImageMIPFilter mip;
mip SetMinMaxIP 1;
mip SetProjectionRange $lprojection $uprojection;
mip SetInput [composite GetOutput];
mip ReleaseDataFlagOff;
vtkImageXViewer viewer;
viewer SetAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS $VTK_IMAGE_Z_AXIS;
viewer SetInput [mip GetOutput];
viewer SetCoordinate2 0;
viewer SetColorWindow $window;
viewer SetColorLevel $level;
reader SetDataDimensions 512 512 $numslices 1
reader SetFirst $firstslice
reader SetFilePrefix $prefix
reader SetOutputScalarType $VTK_SHORT
reader SetPixelMask 0x7fff
reader ReleaseDataFlagOff
vtkImageSubSampling ss
ss MaximumOn
ss SetSamplingFactors $subx $suby $subz
ss SetInput [reader GetOutput]
ss ReleaseDataFlagOff
vtkImageConnectivity connect
connect PercentLevelValueOn
connect SetPLevelSeedValue 0.9
connect SetNeighbors 26
connect SetThreshold $thresholdvalue
#connect SingleSeedOn
#connect SetSeedXYZ 17 61 5
connect SetOutputScalarType $VTK_UNSIGNED_CHAR
connect SetInput [ss GetOutput]
connect ReleaseDataFlagOff
vtkImageMarkBoundary mb
mb SetDilateValue 1
mb SetSurfaceValue $boundaryvalue
mb SetKernelRadius $kernelradius
mb SetOutputScalarType $VTK_UNSIGNED_CHAR
mb SetInput [connect GetOutput]
mb ReleaseDataFlagOff
vtkImageThreshold thresh
thresh SetInput [ss GetOutput]
thresh SetOutputScalarType $VTK_SHORT
thresh ThresholdByUpper $thresholdvalue
thresh SetInValue $invalue
thresh ReleaseDataFlagOff
vtkImageThreshold thresh2
thresh2 SetInput [thresh GetOutput]
thresh2 SetOutputScalarType $VTK_SHORT
thresh2 ThresholdByLower $invalue
thresh2 SetInValue $invalue
thresh2 ReleaseDataFlagOff
vtkImageAdaptiveFilter af
af MedianOn
af SetAdaptiveValue $boundaryvalue
af SetKernelDimensions $kernelradius $kernelradius $kernelradius
af SetInput1 [thresh2 GetOutput]
af SetInput2 [mb GetOutput]
af SetOutputScalarType $VTK_SHORT
af ReleaseDataFlagOff
vtkImageCTAComposite composite
composite SetMaskInput [mb GetOutput]
composite SetDataOriginalInput [reader GetOutput]
composite SetSubSampledInput [af GetOutput]
composite SetMagnificationFactors $subx $suby $subz
composite SetReplaceValue $invalue
composite SetMaskReplace 1
composite SetMaskOriginal 0
composite SetMaskTrilinear $boundaryvalue
composite ReleaseDataFlagOff
vtkImageMIPFilter mip
mip SetMinMaxIP 1
mip SetProjectionRange $lprojection $uprojection
mip SetInput [composite GetOutput]
mip ReleaseDataFlagOff
vtkImageXViewer viewer
viewer SetAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS $VTK_IMAGE_Z_AXIS
viewer SetInput [mip GetOutput]
viewer SetCoordinate2 0
viewer SetColorWindow $window
viewer SetColorLevel $level
viewer SetXOffset 512
#viewer Render;
#viewer Render
vtkImageXViewer viewer1;
viewer1 SetAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS $VTK_IMAGE_Z_AXIS;
viewer1 SetInput [ss GetOutput];
viewer1 SetCoordinate2 0;
viewer1 SetColorWindow $window;
viewer1 SetColorLevel $level;
viewer1 SetXOffset 0;
viewer1 SetWindow [viewer GetWindow];
#viewer1 Render;
vtkImageXViewer viewer1
viewer1 SetAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS $VTK_IMAGE_Z_AXIS
viewer1 SetInput [ss GetOutput]
viewer1 SetCoordinate2 0
viewer1 SetColorWindow $window
viewer1 SetColorLevel $level
viewer1 SetXOffset 0
viewer1 SetWindow [viewer GetWindow]
#viewer1 Render
vtkImageToStructuredPoints image;
image SetScalarInput [composite GetOutput];
vtkImageToStructuredPoints image
image SetScalarInput [composite GetOutput]
vtkStructuredPointsWriter writer;
writer SetInput [image GetOutput];
writer SetFileType 2;
writer SetFilename "CTAStrucutredPoints.bin";
vtkStructuredPointsWriter writer
writer SetInput [image GetOutput]
writer SetFileType 2
writer SetFilename "CTAStrucutredPoints.bin"
#make interface
source CTASegmentation_main_ui.tcl
source CTASegmentation_browser_ui.tcl;
source CTASegmentation_browser_ui.tcl
source CTASegmentation_wl_ui.tcl
source CTASegmentation_reader_param_ui.tcl;
source CTASegmentation_reader_param_ui.tcl
catch {load vtktcl}
#- TOP LEVEL ------------------------------
toplevel .file
#wm withdraw .file
......@@ -6,8 +7,8 @@ wm resizable .file 0 0
wm withdraw .
wm withdraw .file
set file_apply_op "";
global prefix;
set file_apply_op ""
global prefix
#- Directory string------------------------
frame .file.a -relief ridge -borderwidth 2
......@@ -19,32 +20,32 @@ frame .file.a.f3 -bd 0
frame .file.a.f4 -bd 0
label .file.a.f1.l1 \
-text "Directory:";
-text "Directory:"
entry .file.a.f1.e1 -font -*-fixed-bold-r-normal--13-* \
-highlightthickness 0
.file.a.f1.e1 insert end [pwd];
.file.a.f1.e1 insert end [pwd]
pack .file.a.f1.l1 -side left -in .file.a.f1 \
-expand 0 -fill none;
-expand 0 -fill none
pack .file.a.f1.e1 -side left -in .file.a.f1 \
-expand 1 -fill both -padx 3 -pady 2;
-expand 1 -fill both -padx 3 -pady 2
label .file.a.f3.l1 \
-text "File:";
-text "File:"
entry .file.a.f3.e1 -font -*-fixed-bold-r-normal--13-* \
-highlightthickness 0 \
.file.a.f3.e1 insert end [pwd];
.file.a.f3.e1 insert end [pwd]
pack .file.a.f3.l1 -side left -in .file.a.f3 \
-expand 0 -fill none;
-expand 0 -fill none
pack .file.a.f3.e1 -side left -in .file.a.f3 \
-expand 1 -fill both -padx 3 -pady 2;
-expand 1 -fill both -padx 3 -pady 2
frame .file.a.f2.f1 -borderwidth 2 \
......@@ -57,13 +58,13 @@ frame .file.a.f2.f1.f1
listbox .file.a.f2.f1.f1.dirList \
-font -*-fixed-bold-r-normal--13-* \
-xscrollcommand {.file.a.f2.f1.sbH set}\
-yscrollcommand {.file.a.f2.f1.f1.sbV set} -width 35;
-yscrollcommand {.file.a.f2.f1.f1.sbV set} -width 35
scrollbar .file.a.f2.f1.f1.sbV \
-command {.file.a.f2.f1.f1.dirList yview}
pack .file.a.f2.f1.f1.dirList .file.a.f2.f1.f1.sbV -side left \
-in .file.a.f2.f1.f1 -expand 0 -fill y \
-ipadx 0 -ipady 0 -padx 5 -pady 5;
-ipadx 0 -ipady 0 -padx 5 -pady 5
scrollbar .file.a.f2.f1.sbH \
-command {.file.a.f2.f1.f1.dirList xview}\
......@@ -77,13 +78,13 @@ frame .file.a.f2.f2.f1 -bg grey75
listbox .file.a.f2.f2.f1.fileList \
-font -*-fixed-bold-r-normal--13-* \
-xscrollcommand {.file.a.f2.f2.sbH set}\
-yscrollcommand {.file.a.f2.f2.f1.sbV set} -width 35;
-yscrollcommand {.file.a.f2.f2.f1.sbV set} -width 35
scrollbar .file.a.f2.f2.f1.sbV \
-command {.file.a.f2.f2.f1.fileList yview}
pack .file.a.f2.f2.f1.fileList .file.a.f2.f2.f1.sbV -side left \
-in .file.a.f2.f2.f1 -expand 0 -fill y \
-ipadx 0 -ipady 0 -padx 5 -pady 5;
-ipadx 0 -ipady 0 -padx 5 -pady 5
scrollbar .file.a.f2.f2.sbH \
-command {.file.a.f2.f2.f1.fileList xview}\
......@@ -98,7 +99,7 @@ pack .file.a.f2.f1 .file.a.f2.f2 -in .file.a.f2 -side left \
button .file.a.f4.b1 \
-bd 3 -relief raised -highlightthickness 0 \
-text Apply -command apply_it;
-text Apply -command apply_it
pack .file.a.f4.b1 -side left -padx 12 -ipadx 12 \
-fill x -expand 1
......@@ -113,74 +114,74 @@ pack .file.b.b1 .file.b -expand 1 -fill both
pack .file.a .file.b -in .file -side top -padx 5 -pady 5
pack .file.a.f1 .file.a.f2 .file.a.f3 .file.a.f4 -in .file.a \
-side top -padx 5 -pady 5 -expand 1 -fill both ;
-side top -padx 5 -pady 5 -expand 1 -fill both
bind .file.a.f2.f1.f1.dirList <Double-Button-1> {
set current [.file.a.f1.e1 get];
set index [.file.a.f2.f1.f1.dirList curselection];
set current [.file.a.f1.e1 get]
set index [.file.a.f2.f1.f1.dirList curselection]
set dir [.file.a.f2.f1.f1.dirList get $index];
set dir [.file.a.f2.f1.f1.dirList get $index]
if { $dir == "../ (Up a directory)" } {
set newDir [file dirname $current];
set newDir [file dirname $current]
} else {
set newDir $current/$dir
}
.file.a.f1.e1 delete 0 end;
.file.a.f1.e1 insert 0 $newDir;
.file.a.f1.e1 delete 0 end
.file.a.f1.e1 insert 0 $newDir
.file.a.f3.e1 delete 0 end;
.file.a.f3.e1 insert 0 $newDir;
.file.a.f3.e1 delete 0 end
.file.a.f3.e1 insert 0 $newDir
listDirectories $newDir;
listFiles $newDir;
listDirectories $newDir
listFiles $newDir
}
bind .file.a.f2.f2.f1.fileList <ButtonRelease-1> {
set current [.file.a.f1.e1 get];
set index [.file.a.f2.f2.f1.fileList curselection];
set current [.file.a.f1.e1 get]
set index [.file.a.f2.f2.f1.fileList curselection]
set thefile [.file.a.f2.f2.f1.fileList get $index];
set fullpath $current/$thefile;
set thefile [.file.a.f2.f2.f1.fileList get $index]
set fullpath $current/$thefile
.file.a.f3.e1 delete 0 end;
.file.a.f3.e1 insert 0 $fullpath;
.file.a.f3.e1 delete 0 end
.file.a.f3.e1 insert 0 $fullpath
}
bind .file.a.f2.f2.f1.fileList <Double-Button-1> {
set current [.file.a.f1.e1 get];
set index [.file.a.f2.f2.f1.fileList curselection];
set current [.file.a.f1.e1 get]
set index [.file.a.f2.f2.f1.fileList curselection]
set thefile [.file.a.f2.f2.f1.fileList get $index];
set fullpath $current/$thefile;
set thefile [.file.a.f2.f2.f1.fileList get $index]
set fullpath $current/$thefile
.file.a.f3.e1 delete 0 end;
.file.a.f3.e1 insert 0 $fullpath;
.file.a.f3.e1 delete 0 end
.file.a.f3.e1 insert 0 $fullpath
apply_it
}
##-List directories for current string
bind .file.a.f1.e1 <KeyPress-Return> {
set dir [.file.a.f1.e1 get];
listDirectories $dir;
set dir [.file.a.f1.e1 get]
listDirectories $dir
}
##-Procedure generates list of directories----
proc listDirectories {dir} {
.file.a.f2.f1.f1.dirList delete 0 end;
.file.a.f2.f1.f1.dirList delete 0 end
set dirList [lsort [glob -nocomplain $dir/*/]];
.file.a.f2.f1.f1.dirList insert end "../ (Up a directory)";
set dirList [lsort [glob -nocomplain $dir/*/]]
.file.a.f2.f1.f1.dirList insert end "../ (Up a directory)"
foreach i $dirList {
.file.a.f2.f1.f1.dirList insert end [file tail $i];
.file.a.f2.f1.f1.dirList insert end [file tail $i]
}
}
......@@ -188,34 +189,34 @@ proc listDirectories {dir} {
##-Procedure generates list of files----
proc listFiles {dir} {
.file.a.f2.f2.f1.fileList delete 0 end;
.file.a.f2.f2.f1.fileList delete 0 end
set fileList [lsort [glob -nocomplain $dir/*]];
set fileList [lsort [glob -nocomplain $dir/*]]
foreach i $fileList {
if { [ file isfile $i ] == 1 } {
.file.a.f2.f2.f1.fileList insert end [file tail $i];
.file.a.f2.f2.f1.fileList insert end [file tail $i]
}
}
}
proc PopupFileControls { } {
wm deiconify .file;
wm deiconify .file
}
proc SetFileApplyString { apply_string } {
.file.a.f4.b1 configure -text $apply_string;
.file.a.f4.b1 configure -text $apply_string
}
proc apply_it { } {
global file_apply_op viewer reader
global prefix;
set fullpath [.file.a.f3.e1 get];
set idx [string last . $fullpath];
set prefix [string range $fullpath 0 [expr $idx -1]];
puts $prefix;
global prefix
set fullpath [.file.a.f3.e1 get]
set idx [string last . $fullpath]
set prefix [string range $fullpath 0 [expr $idx -1]]
puts $prefix
wm withdraw .file
}
listDirectories [pwd];
listFiles [pwd];
listDirectories [pwd]
listFiles [pwd]
catch {load vtktcl}
# Developed By Majeid Alyassin
wm withdraw .
......@@ -7,13 +8,13 @@ wm resizable .load_param 0 0
wm withdraw .load_param
# Interface to Load parameters ...
frame .load_param.t1 -relief ridge -borderwidth 3;
frame .load_param.t1 -relief ridge -borderwidth 3
frame .load_param.t1.process1
button .load_param.t1.process1.b1 -text "Load Filename..." -command LFN
frame .load_param.t1.group1
frame .load_param.t1.group2
label .load_param.t1.group1.l1 -text "Start Slice --- Num. of Slices";
label .load_param.t1.group2.l2 -text "Aspect Ratio X:Y:Z";
label .load_param.t1.group1.l1 -text "Start Slice --- Num. of Slices"
label .load_param.t1.group2.l2 -text "Aspect Ratio X:Y:Z"
entry .load_param.t1.group1.first -width 4
entry .load_param.t1.group1.number -width 4
entry .load_param.t1.group2.arx -width 4
......@@ -26,34 +27,34 @@ button .load_param.b3 -text "Cancel" -command CancelB
pack .load_param.t1 -side top
pack .load_param.t1.process1 .load_param.t1.group1 .load_param.t1.group2 -side top
pack .load_param.t1.process1.b1 \
-side top -expand 1 -in .load_param.t1.process1 -fill both -padx 2 -pady 2;
-side top -expand 1 -in .load_param.t1.process1 -fill both -padx 2 -pady 2
pack .load_param.t1.process1 \
-expand 1 -in .load_param.t1 -side top -fill both -padx 2 -pady 2;
-expand 1 -in .load_param.t1 -side top -fill both -padx 2 -pady 2
pack .load_param.b2 .load_param.b3\
-side left -expand 1 -in .load_param -fill both -padx 2 -pady 2;
-side left -expand 1 -in .load_param -fill both -padx 2 -pady 2
pack .load_param.t1.group1.l1 -in .load_param.t1.group1 -side top -fill both -expand 1;
pack .load_param.t1.group2.l2 -in .load_param.t1.group2 -side top -fill both -expand 1;
pack .load_param.t1.group1.l1 -in .load_param.t1.group1 -side top -fill both -expand 1
pack .load_param.t1.group2.l2 -in .load_param.t1.group2 -side top -fill both -expand 1
pack .load_param.t1.group1.first .load_param.t1.group1.number -padx 3 -pady 2 \
-in .load_param.t1.group1 -side left -fill both -expand 1;
-in .load_param.t1.group1 -side left -fill both -expand 1
pack .load_param.t1.group1 \
-side top -expand 1 -in .load_param.t1 -fill both -padx 2 -pady 2;
-side top -expand 1 -in .load_param.t1 -fill both -padx 2 -pady 2
pack .load_param.t1.group2.arx .load_param.t1.group2.ary .load_param.t1.group2.arz -padx 3 -pady 2 \
-in .load_param.t1.group2 -side left -fill both -expand 1;
-in .load_param.t1.group2 -side left -fill both -expand 1
pack .load_param.t1.group2 \
-side top -expand 1 -in .load_param.t1 -fill both -padx 2 -pady 2;
-side top -expand 1 -in .load_param.t1 -fill both -padx 2 -pady 2
global firstslice numslices subx suby subz
.load_param.t1.group1.first insert 0 $firstslice;
.load_param.t1.group1.number insert 0 $numslices;
.load_param.t1.group1.first insert 0 $firstslice
.load_param.t1.group1.number insert 0 $numslices
bind .load_param.t1.group1.first <Return> { PreSlice }
bind .load_param.t1.group1.number <Return> { PreSlice }
.load_param.t1.group2.arx insert 0 $subx;
.load_param.t1.group2.ary insert 0 $suby;
.load_param.t1.group2.arz insert 0 $subz;
.load_param.t1.group2.arx insert 0 $subx
.load_param.t1.group2.ary insert 0 $suby
.load_param.t1.group2.arz insert 0 $subz
bind .load_param.t1.group2.arx <Return> { PreAR }
bind .load_param.t1.group2.ary <Return> { PreAR }
......@@ -66,46 +67,46 @@ proc LFN {} {
proc PreSlice {} {
global firstslice numslices
set firstslice [.load_param.t1.group1.first get];
set numslices [.load_param.t1.group1.number get];
puts $firstslice;
puts $numslices;
set firstslice [.load_param.t1.group1.first get]
set numslices [.load_param.t1.group1.number get]
puts $firstslice
puts $numslices
}
proc PreAR {} {
global subx suby subz
set subx [.load_param.t1.group2.arx get];
set suby [.load_param.t1.group2.ary get];
set subz [.load_param.t1.group2.arz get];
puts $subx;
puts $suby;
puts $subz;
set subx [.load_param.t1.group2.arx get]
set suby [.load_param.t1.group2.ary get]
set subz [.load_param.t1.group2.arz get]
puts $subx
puts $suby
puts $subz
}
proc OKB {} {
global viewer viewer1 ss composite mp
global prefix numslices firstslice subx suby subz
reader SetFilePrefix $prefix;
reader SetFilePrefix $prefix
puts $prefix
reader SetDataDimensions 512 512 $numslices 1;
reader SetFirst $firstslice;
set firstslice [.load_param.t1.group1.first get];
set numslices [.load_param.t1.group1.number get];
puts " first slice = $firstslice & lastslice [expr $firstslice + $numslices]" ;
set subx [.load_param.t1.group2.arx get];
set suby [.load_param.t1.group2.ary get];
set subz [.load_param.t1.group2.arz get];
puts "$subx:$suby:$subz";
ss SetSamplingFactors $subx $suby $subz;
composite SetMagnificationFactors $subx $suby $subz;
mip SetProjectionRange $subz [expr $numslices-1-$subz];
.ctan.cta5.group.lowerprj delete 0 10;
.ctan.cta5.group.lowerprj insert 0 $subz;
.ctan.cta5.group.upperprj delete 0 10;
.ctan.cta5.group.upperprj insert 0 [expr $numslices-1-$subz];
wm withdraw .load_param;
reader SetDataDimensions 512 512 $numslices 1
reader SetFirst $firstslice
set firstslice [.load_param.t1.group1.first get]
set numslices [.load_param.t1.group1.number get]
puts " first slice = $firstslice & lastslice [expr $firstslice + $numslices]"
set subx [.load_param.t1.group2.arx get]
set suby [.load_param.t1.group2.ary get]
set subz [.load_param.t1.group2.arz get]
puts "$subx:$suby:$subz"
ss SetSamplingFactors $subx $suby $subz