change volume colormap

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

change volume colormap

manlio99
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.

thanks.

Manlio.

    input=self1.inputSelector.currentNode()
    output=self1.outputSelector.currentNode()
    measure='FA'


  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 = slicer.app.applicationLogic().GetSelectionNode()
      selectionNode.SetReferenceActiveVolumeID(outputv.GetID())

      slicer.app.applicationLogic().PropagateVolumeSelection(0)

results of the module