change volume colormap

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

change volume colormap

This post has NOT been accepted by the mailing list yet.
HI slicer community.

i'm developing a module that get the slicer input vtk image then convert it to numpy, apply some process in numpy, and plot it back to slicer view, the question is how i can change the colormap of the display volume? i want something as a heat map.




  def run(self, args, a, input, output, measure):
      SlicerInputData = input.GetImageData()
      vtk_data = SlicerInputData.GetPointData().GetScalars()
      numpy_data = numpy_support.vtk_to_numpy(vtk_data)
      dims = SlicerInputData.GetDimensions()
      numpy_data = numpy_data.reshape(dims[2], dims[1], dims[0])

      n = 3.7308
      res = np.array([2.0, 2.0, 2.0])

      logging.debug("Starting to Compute VOI")
      VOI = self.computeVoi(self, numpy_data)
      logging.debug("Finished Compute VOI")
      # % compute weighting mask:
      logging.debug("Starting to Compute kernel 3d")
      gaussMask = self.calculoKernel3D(self, n, res)
      logging.debug("Finished Compute k3D")

      resultLLO0 = self.LinearLocalOperators(self, numpy_data, VOI, gaussMask, 0)

      outputv = slicer.vtkSlicerVolumesLogic.CloneVolume(slicer.mrmlScene, input, 'output')
      outputNodeArray = slicer.util.array('output')
      outputNodeArray[:] = resultLLO0

      # make the output volume appear in all the slice views
      selectionNode =

results of the module