Commit e3d255a720f6e68c553caf7332eeda31ff5f59d8

Authored by Paulo Henrique Junqueira Amorim
1 parent 5fbb878c

ADD: Function to cropping vtkImageData

Showing 1 changed file with 12 additions and 0 deletions   Show diff stats
invesalius/data/imagedata_utils.py
... ... @@ -150,3 +150,15 @@ def View(imagedata):
150 150  
151 151 import time
152 152 time.sleep(10)
  153 +
  154 +def ExtractVOI(imagedata,xi,xf,yi,yf,zi,zf):
  155 + """
  156 + Cropping the vtkImagedata according
  157 + with values.
  158 + """
  159 + voi = vtk.vtkExtractVOI()
  160 + voi.SetVOI(xi,xf,yi,yf,zi,zf)
  161 + voi.SetInput(imagedata)
  162 + voi.SetSampleRate(1, 1, 1)
  163 + voi.Update()
  164 + return voi.GetOutput()
... ...