Пример #1
0
 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(
         self, module_manager,
         vtk.vtkImageRGBToHSI(), 'Processing.',
         ('vtkImageData',), ('vtkImageData',),
         replaceDoc=True,
         inputFunctions=None, outputFunctions=None)
Пример #2
0
 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(self,
                                       module_manager,
                                       vtk.vtkImageRGBToHSI(),
                                       'Processing.', ('vtkImageData', ),
                                       ('vtkImageData', ),
                                       replaceDoc=True,
                                       inputFunctions=None,
                                       outputFunctions=None)
Пример #3
0
 def insert(self, document):
     if not self.view:
         return
     if self.CaptureDepth:
         image = self.view.CaptureDepthBuffer()
         idata = numpy_support.vtk_to_numpy(image) * 256
         rw = self.view.GetRenderWindow()
         width,height = rw.GetSize()
         imageslice = np.flipud(idata.reshape(height,width))
         #import Image
         #img = Image.fromarray(imageslice)
         #img.show()
         #try:
         #    input("Press enter to continue ")
         #except NameError:
         #    pass
         document.data = imageslice
         self.CaptureDepth = False
     else:
         image = self.view.CaptureWindow(1)
         if self.CaptureLuminance:  #TODO: this is still preOpenGL2
             rth = vtk.vtkImageRGBToHSI()
             rth.SetInputData(image)
             ec = vtk.vtkImageExtractComponents()
             ec.SetInputConnection(rth.GetOutputPort())
             ec.SetComponents(2,2,2)
             ec.Update()
             image = ec.GetOutput()
         npview = dsa.WrapDataObject(image)
         idata = npview.PointData[0]
         ext = image.GetExtent()
         width = ext[1] - ext[0] + 1
         height = ext[3] - ext[2] + 1
         imageslice = np.flipud(idata.reshape(height,width,3))
         #import Image
         #img = Image.fromarray(imageslice)
         #img.show()
         #try:
         #    input("Press enter to continue ")
         #except NameError:
         #    pass
         document.data = imageslice
     super(ImageExplorer, self).insert(document)
Пример #4
0
imageCanvas.SetDrawColor(255,255,255)
imageCanvas.FillBox(250,300,110,210)
# saturation scale
imageCanvas.SetDrawColor(245,0,0)
imageCanvas.FillBox(0,50,220,320)
imageCanvas.SetDrawColor(213,16,16)
imageCanvas.FillBox(50,100,220,320)
imageCanvas.SetDrawColor(181,32,32)
imageCanvas.FillBox(100,150,220,320)
imageCanvas.SetDrawColor(149,48,48)
imageCanvas.FillBox(150,200,220,320)
imageCanvas.SetDrawColor(117,64,64)
imageCanvas.FillBox(200,250,220,320)
imageCanvas.SetDrawColor(85,80,80)
imageCanvas.FillBox(250,300,220,320)
convert = vtk.vtkImageRGBToHSI()
convert.SetInputConnection(imageCanvas.GetOutputPort())
convertBack = vtk.vtkImageHSIToRGB()
convertBack.SetInputConnection(convert.GetOutputPort())
cast = vtk.vtkImageCast()
cast.SetInputConnection(convertBack.GetOutputPort())
cast.SetOutputScalarTypeToFloat()
cast.ReleaseDataFlagOff()
viewer = vtk.vtkImageViewer()
viewer.SetInputConnection(convertBack.GetOutputPort())
#viewer SetInputConnection [imageCanvas GetOutputPort]
viewer.SetColorWindow(256)
viewer.SetColorLevel(127.5)
viewer.Render()
# --- end of script --
Пример #5
0
imageCanvas.SetDrawColor(255, 255, 255)
imageCanvas.FillBox(250, 300, 110, 210)
# saturation scale
imageCanvas.SetDrawColor(245, 0, 0)
imageCanvas.FillBox(0, 50, 220, 320)
imageCanvas.SetDrawColor(213, 16, 16)
imageCanvas.FillBox(50, 100, 220, 320)
imageCanvas.SetDrawColor(181, 32, 32)
imageCanvas.FillBox(100, 150, 220, 320)
imageCanvas.SetDrawColor(149, 48, 48)
imageCanvas.FillBox(150, 200, 220, 320)
imageCanvas.SetDrawColor(117, 64, 64)
imageCanvas.FillBox(200, 250, 220, 320)
imageCanvas.SetDrawColor(85, 80, 80)
imageCanvas.FillBox(250, 300, 220, 320)
convert = vtk.vtkImageRGBToHSI()
convert.SetInputConnection(imageCanvas.GetOutputPort())
convertBack = vtk.vtkImageHSIToRGB()
convertBack.SetInputConnection(convert.GetOutputPort())
cast = vtk.vtkImageCast()
cast.SetInputConnection(convertBack.GetOutputPort())
cast.SetOutputScalarTypeToFloat()
cast.ReleaseDataFlagOff()
viewer = vtk.vtkImageViewer()
viewer.SetInputConnection(convertBack.GetOutputPort())
#viewer SetInputConnection [imageCanvas GetOutputPort]
viewer.SetColorWindow(256)
viewer.SetColorLevel(127.5)
viewer.Render()
# --- end of script --