change volume colormap

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

change volume colormap

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

<http://slicer-devel.65872.n3.nabble.com/file/n4038463/result.png>



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/change-volume-colormap-tp4038463.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: change volume colormap

Fernando
Hi Manlio,

You can try this, for example:
displayNode = outputv.GetDisplayNode()
displayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeFileViridis.txt')


2017-04-07 20:29 GMT+02:00 manlio99 <[hidden email]>:
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)

<http://slicer-devel.65872.n3.nabble.com/file/n4038463/result.png>



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/change-volume-colormap-tp4038463.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ



--
Fernando Pérez García
Research Engineer
ICM - Institute of the Brain and Spine
CENIR - STIM - Stereotaxy Core Facility (Techniques, Images and Models)
Hôpital de la Pitié-Salpêtrière
<a href="https://www.google.fr/maps/place/ICM&#43;Institute&#43;for&#43;Brain&#43;and&#43;Spinal&#43;Cord/@48.8355044,2.3623824,17z/data=!3m1!4b1!4m12!1m6!3m5!1s0x47e6718ab158a96f:0x946e4c254d43d1b6!2sBiblioth%C3%A8que&#43;J.-M.&#43;Charcot!8m2!3d48.8353737!4d2.364217!3m4!1s0x47e671f4647492ff:0x7700b00040eb24c6!8m2!3d48.8355009!4d2.3645711?hl=en" target="_blank">47, boulevard de l'Hôpital
75013 Paris


_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: change volume colormap

Fernando
In reply to this post by manlio99
De nada! Glad it helped.

2017-04-07 22:09 GMT+02:00 Manlio Miguel Massiris Fernandez <[hidden email]>:
Muchas Gracias Fernando!

just what I needed.


Manlio.

2017-04-07 15:48 GMT-03:00 Fernando Pérez-García <[hidden email]>:
Hi Manlio,

You can try this, for example:
displayNode = outputv.GetDisplayNode()
displayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeFileViridis.txt')


2017-04-07 20:29 GMT+02:00 manlio99 <[hidden email]>:
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)

<http://slicer-devel.65872.n3.nabble.com/file/n4038463/result.png>



--
View this message in context: http://slicer-devel.65872.n3.nabble.com/change-volume-colormap-tp4038463.html
Sent from the slicer-devel mailing list archive at Nabble.com.
_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ



--
Fernando Pérez García
Research Engineer
ICM - Institute of the Brain and Spine
CENIR - STIM - Stereotaxy Core Facility (Techniques, Images and Models)
Hôpital de la Pitié-Salpêtrière
<a href="https://www.google.fr/maps/place/ICM&#43;Institute&#43;for&#43;Brain&#43;and&#43;Spinal&#43;Cord/@48.8355044,2.3623824,17z/data=!3m1!4b1!4m12!1m6!3m5!1s0x47e6718ab158a96f:0x946e4c254d43d1b6!2sBiblioth%C3%A8que&#43;J.-M.&#43;Charcot!8m2!3d48.8353737!4d2.364217!3m4!1s0x47e671f4647492ff:0x7700b00040eb24c6!8m2!3d48.8355009!4d2.3645711?hl=en" target="_blank">47, boulevard de l'Hôpital
75013 Paris



El presente correo no representa la opinión o consentimiento por parte de la Universidad del Norte por lo que no adquiere responsabilidad alguna por el contenido del presente mensaje. Este correo proviene de una cuenta que la Universidad ofrece a los egresados de la Institución, evento en el cual tanto el mensaje como sus anexos son confidenciales. Este mensaje ha sido verificado con software antivirus; no obstante lo anterior, la Universidad del Norte no garantiza que sea seguro o que no contenga errores o virus por lo que nos e hace responsable por su transmisión.



--
Fernando Pérez García
Research Engineer
ICM - Institute of the Brain and Spine
CENIR - STIM - Stereotaxy Core Facility (Techniques, Images and Models)
Hôpital de la Pitié-Salpêtrière
<a href="https://www.google.fr/maps/place/ICM&#43;Institute&#43;for&#43;Brain&#43;and&#43;Spinal&#43;Cord/@48.8355044,2.3623824,17z/data=!3m1!4b1!4m12!1m6!3m5!1s0x47e6718ab158a96f:0x946e4c254d43d1b6!2sBiblioth%C3%A8que&#43;J.-M.&#43;Charcot!8m2!3d48.8353737!4d2.364217!3m4!1s0x47e671f4647492ff:0x7700b00040eb24c6!8m2!3d48.8355009!4d2.3645711?hl=en" target="_blank">47, boulevard de l'Hôpital
75013 Paris


_______________________________________________
slicer-devel mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/FAQ
Loading...