def __init__(self, window_title='Depth Image', scale=1): self.scale = scale depthImageColorByRange = [0.0, 4.0] lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange(depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() self.depthScaleFilter = vtk.vtkImageShiftScale() self.depthScaleFilter.SetScale(scale) self.depthScaleFilter.SetOutputScalarTypeToUnsignedShort() self.depthImageLookupTable = lut self.imageMapToColors = vtk.vtkImageMapToColors() self.imageMapToColors.SetLookupTable(self.depthImageLookupTable) self.imageMapToColors.SetInputConnection( self.depthScaleFilter.GetOutputPort()) self.imageView = imageview.ImageView() self.imageView.view.setWindowTitle(window_title) self.imageView.setImage(self.imageMapToColors.GetOutput())
def __init__(self, window_title='Depth Image', scale=1): self.scale = scale depthImageColorByRange = [0.0, 4.0] lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange(depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() self.depthScaleFilter = vtk.vtkImageShiftScale() self.depthScaleFilter.SetScale(scale) self.depthScaleFilter.SetOutputScalarTypeToUnsignedShort() self.depthImageLookupTable = lut self.imageMapToColors = vtk.vtkImageMapToColors() self.imageMapToColors.SetLookupTable(self.depthImageLookupTable) self.imageMapToColors.SetInputConnection(self.depthScaleFilter.GetOutputPort()) self.imageView = imageview.ImageView() self.imageView.view.setWindowTitle(window_title) self.imageView.setImage(self.imageMapToColors.GetOutput())
def initImageColorMap(self): self.depthImageColorByRange = self.getImage().GetScalarRange() lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange(self.depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() im = vtk.vtkImageMapToColors() im.SetLookupTable(lut) im.SetInputData(self.getImage()) im.Update() self.depthImageLookupTable = lut self.imageMapToColors = im self.imageActor.SetInputData(im.GetOutput())
def initImageColorMap(self): self.depthImageColorByRange = self.getImage().GetScalarRange() lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange(self.depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() im = vtk.vtkImageMapToColors() im.SetLookupTable(lut) im.SetInputData(self.getImage()) im.Update() self.depthImageLookupTable = lut self.imageMapToColors = im self.imageActor.SetInputData(im.GetOutput())
def initDepthImageView(self): self.depthImageColorByRange = [0.0, 4.0] lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange(self.depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() im = vtk.vtkImageMapToColors() im.SetLookupTable(lut) self.depthImageLookupTable = lut self.imageMapToColors = im self.imageView = imageview.ImageView() self.imageView.view.setWindowTitle('Depth image') self.imageView.setImage(self.imageMapToColors.GetOutput())
def initDepthImageView(self): self.depthImageColorByRange = [0.0, 4.0] lut = vtk.vtkLookupTable() lut.SetNumberOfColors(256) lut.SetHueRange(0, 0.667) # red to blue lut.SetRange( self.depthImageColorByRange) # map red (near) to blue (far) lut.SetRampToLinear() lut.Build() im = vtk.vtkImageMapToColors() im.SetLookupTable(lut) self.depthImageLookupTable = lut self.imageMapToColors = im self.imageView = imageview.ImageView() self.imageView.view.setWindowTitle('Depth image') self.imageView.setImage(self.imageMapToColors.GetOutput())