Commit 46e88605 authored by pieper's avatar pieper
Browse files

ENH: adapt threshold effect for compatibility with slicer4

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15603 3bd1e089-480b-0410-8dfb-8563597acbee
parent 7b539e09
...@@ -299,17 +299,19 @@ proc EditorToggleErasePaintLabel {} { ...@@ -299,17 +299,19 @@ proc EditorToggleErasePaintLabel {} {
proc EditorGetPaintColor { {this ""} } { proc EditorGetPaintColor { {this ""} } {
set sliceLogic [$::slicer3::ApplicationLogic GetSliceLogic "Red"] if { [info exists ::slicer3::ApplicationLogic] } {
if { $sliceLogic != "" } { set sliceLogic [$::slicer3::ApplicationLogic GetSliceLogic "Red"]
set logic [$sliceLogic GetLabelLayer] if { $sliceLogic != "" } {
if { $logic != "" } { set logic [$sliceLogic GetLabelLayer]
set volumeDisplayNode [$logic GetVolumeDisplayNode] if { $logic != "" } {
if { $volumeDisplayNode != "" } { set volumeDisplayNode [$logic GetVolumeDisplayNode]
set node [$volumeDisplayNode GetColorNode] if { $volumeDisplayNode != "" } {
set lut [$node GetLookupTable] set node [$volumeDisplayNode GetColorNode]
set index [EditorGetPaintLabel] set lut [$node GetLookupTable]
set index [expr int($index)] set index [EditorGetPaintLabel]
return [$lut GetTableValue $index] set index [expr int($index)]
return [$lut GetTableValue $index]
}
} }
} }
} }
......
...@@ -36,7 +36,7 @@ if { [itcl::find class ThresholdEffect] == "" } { ...@@ -36,7 +36,7 @@ if { [itcl::find class ThresholdEffect] == "" } {
# methods # methods
method processEvent {{caller ""} {event ""}} {} method processEvent {{caller ""} {event ""}} {}
method preview {} {} method preview { {color ""} } {}
method apply {} {} method apply {} {}
method positionCursor {} {} method positionCursor {} {}
method buildOptions {} {} method buildOptions {} {}
...@@ -100,7 +100,7 @@ itcl::body ThresholdEffect::apply {} { ...@@ -100,7 +100,7 @@ itcl::body ThresholdEffect::apply {} {
} }
itcl::body ThresholdEffect::preview {} { itcl::body ThresholdEffect::preview { {color ""} } {
if { [$this getInputBackground] == "" || [$this getInputLabel] == "" } { if { [$this getInputBackground] == "" || [$this getInputLabel] == "" } {
$this errorDialog "Background and Label map needed for Threshold" $this errorDialog "Background and Label map needed for Threshold"
...@@ -114,7 +114,9 @@ itcl::body ThresholdEffect::preview {} { ...@@ -114,7 +114,9 @@ itcl::body ThresholdEffect::preview {} {
# (output of the layer logic's vtkImageReslice instance) # (output of the layer logic's vtkImageReslice instance)
# #
set color [::EditorGetPaintColor $::Editor(singleton)] if { $color == "" } {
set color [::EditorGetPaintColor $::Editor(singleton)]
}
if { ![info exists o(lut)] } { if { ![info exists o(lut)] } {
set o(lut) [vtkNew vtkLookupTable] set o(lut) [vtkNew vtkLookupTable]
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment