Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Temporary fix for vmtkimagevoipainter.py

  • Loading branch information...
commit 2927397b70e001b706802f3f9560dc6f379ce295 1 parent 765cc6d
@lantiga lantiga authored
Showing with 28 additions and 6 deletions.
  1. +28 −6 vmtkScripts/vmtkimagevoipainter.py
View
34 vmtkScripts/vmtkimagevoipainter.py
@@ -64,10 +64,10 @@ def __init__(self):
])
def InteractCallback(self):
- if self.BoxWidget.GetEnabled() == 1:
- self.BoxWidget.SetEnabled(0)
- else:
- self.BoxWidget.SetEnabled(1)
+ if self.BoxWidget.GetEnabled() == 1:
+ self.BoxWidget.SetEnabled(0)
+ else:
+ self.BoxWidget.SetEnabled(1)
def HideCube(self,object, event):
self.CubeActor.VisibilityOff()
@@ -157,7 +157,7 @@ def Display(self):
def PaintVOI(self):
- wholeExtent = self.Image.GetWholeExtent()
+ wholeExtent = self.Image.GetWholeExtent()[:]
origin = self.Image.GetOrigin()
spacing = self.Image.GetSpacing()
@@ -169,6 +169,24 @@ def PaintVOI(self):
paintedVOI[4] = max(wholeExtent[4],int(math.ceil((self.BoxBounds[4]-origin[2])/spacing[2])))
paintedVOI[5] = min(wholeExtent[5],int(math.floor((self.BoxBounds[5]-origin[2])/spacing[2])))
+ # extent trick. TODO: fix vtkvmtkImageBoxPainter
+ paintedVOI[0] -= wholeExtent[0]
+ paintedVOI[1] -= wholeExtent[0]
+ paintedVOI[2] -= wholeExtent[2]
+ paintedVOI[3] -= wholeExtent[2]
+ paintedVOI[4] -= wholeExtent[4]
+ paintedVOI[5] -= wholeExtent[4]
+
+ newExtent = [0,0,0,0,0,0]
+ newExtent[0] = 0
+ newExtent[1] = wholeExtent[1] - wholeExtent[0]
+ newExtent[2] = 0
+ newExtent[3] = wholeExtent[3] - wholeExtent[2]
+ newExtent[4] = 0
+ newExtent[5] = wholeExtent[5] - wholeExtent[4]
+
+ self.Image.SetWholeExtent(newExtent)
+
imageBoxPainter = vtkvmtk.vtkvmtkImageBoxPainter()
imageBoxPainter.SetInput(self.Image)
imageBoxPainter.SetBoxExtent(paintedVOI)
@@ -187,6 +205,7 @@ def Execute(self):
if self.Image == None:
self.PrintError('Error: no Image.')
+ wholeExtent = self.Image.GetWholeExtent()
if self.Interactive == 1:
if not self.vmtkRenderer:
@@ -209,7 +228,10 @@ def Execute(self):
self.Display()
while (self.BoxActive == 1):
self.PaintVOI()
- self.Image = self.PaintedImage
+ self.Image.DeepCopy(self.PaintedImage)
+ self.Image.SetWholeExtent(wholeExtent)
+ self.Image.SetUpdateExtent(wholeExtent)
+ self.Image.SetExtent(wholeExtent)
self.Display()
else:
self.PaintVOI()
Please sign in to comment.
Something went wrong with that request. Please try again.