def doOperation(self, preview = 0): """ Processes the dataset in specified ways """ t1 = time.time() # Map scalars with intensity transfer list n = 0 if len(self.images) > 1: settings = self.dataunits[0].getSettings() n = settings.get("PreviewedDataset") Logging.info("More than one source dataset for data processing, using %dth" % n, kw = "processing") mapdata = self.images[n] mapIntensities = vtkbxd.vtkImageMapToIntensities() #mapIntensities.GetOutput().ReleaseDataFlagOn() mapIntensities.AddObserver("ProgressEvent", lib.messenger.send) lib.messenger.connect(mapIntensities, "ProgressEvent", self.updateProgress) mapIntensities.SetIntensityTransferFunction(self.intensityTransferFunctions[n]) mapIntensities.SetInput(mapdata) #data = self.getLimitedOutput(mapIntensities) data = mapIntensities.GetOutput() t2 = time.time() #Logging.info("Processing took %.4f seconds"%(t2-t1)) #data.ReleaseDataFlagOff() return data
def doOperation(self, preview=0): """ Processes the dataset in specified ways """ t1 = time.time() # Map scalars with intensity transfer list n = 0 if len(self.images) > 1: settings = self.dataunits[0].getSettings() n = settings.get("PreviewedDataset") Logging.info( "More than one source dataset for data processing, using %dth" % n, kw="processing") mapdata = self.images[n] mapIntensities = vtkbxd.vtkImageMapToIntensities() #mapIntensities.GetOutput().ReleaseDataFlagOn() mapIntensities.AddObserver("ProgressEvent", lib.messenger.send) lib.messenger.connect(mapIntensities, "ProgressEvent", self.updateProgress) mapIntensities.SetIntensityTransferFunction( self.intensityTransferFunctions[n]) mapIntensities.SetInput(mapdata) #data = self.getLimitedOutput(mapIntensities) data = mapIntensities.GetOutput() t2 = time.time() #Logging.info("Processing took %.4f seconds"%(t2-t1)) #data.ReleaseDataFlagOff() return data
itf1 = vtkbxd.vtkIntensityTransferFunction() itf1.SetBrightness(50.0) ctf1 = vtkbxd.vtkColorTransferFunction() ctf1.AddRGBPoint(0, 0, 0, 0) ctf1.AddRGBPoint(255.0, 0, 1.0, 0) print "Feeding channels to merge ", elapsed() merge = vtkbxd.vtkImageColorMerge() #merge.SetNumberOfThreads(5) merge.AddInput(d1) merge.AddLookupTable(ctf1) merge.AddIntensityTransferFunction(itf1) itfmap = vtkbxd.vtkImageMapToIntensities() itfmap.SetInput(d1) itfmap.SetIntensityTransferFunction(itf1) maptocolor = vtk.vtkImageMapToColors() maptocolor.SetOutputFormatToRGB() maptocolor.SetInput(itfmap.GetOutput()) maptocolor.SetLookupTable(ctf1) mip = vtkbxd.vtkImageSimpleMIP() print "Feeding merge to MIP", elapsed() mip.SetInput(merge.GetOutput()) #flip =vtk.vtkImageFlip() #flip.SetFilteredAxis(1)
itf1=vtkbxd.vtkIntensityTransferFunction() itf1.SetBrightness(50.0) ctf1=vtkbxd.vtkColorTransferFunction() ctf1.AddRGBPoint(0,0,0,0) ctf1.AddRGBPoint(255.0,0,1.0,0) print "Feeding channels to merge ",elapsed() merge = vtkbxd.vtkImageColorMerge() #merge.SetNumberOfThreads(5) merge.AddInput(d1) merge.AddLookupTable(ctf1) merge.AddIntensityTransferFunction(itf1) itfmap = vtkbxd.vtkImageMapToIntensities() itfmap.SetInput(d1) itfmap.SetIntensityTransferFunction(itf1) maptocolor=vtk.vtkImageMapToColors() maptocolor.SetOutputFormatToRGB() maptocolor.SetInput(itfmap.GetOutput()) maptocolor.SetLookupTable(ctf1) mip=vtkbxd.vtkImageSimpleMIP() print "Feeding merge to MIP",elapsed() mip.SetInput(merge.GetOutput()) #flip =vtk.vtkImageFlip()