[vtkusers] Simple Viewer Dicom
pedropaulobmjr at hotmail.com
Fri Sep 11 02:52:44 EDT 2015
Hello, I am developing an application in python to view a dicom image and to change brightness and contrast, I could already make application to view, from this example (http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOM) I adapted to python, and when show the picture if I press the left button mouse and move it across the image it changes the brightness and contrast of it, and if I press the R key the pixels back the original settings. So my question is, how can I make these changes brightness, contrast and R button (to reset the values of the original pixels) in my code? I would not like to do algebraic operations on pixels of the dicom image, such as gamma correction for contrast, but I wanted functions that VTK probably already own, but searching I have not found. I thank the attention.
The code in python that I adapted:
import vtkimport sys
def show_dicom_image(ndicom): reader = vtk.vtkDICOMImageReader() reader.SetFileName(ndicom) reader.Update()
# Visualize imageViewer = vtk.vtkImageViewer() imageViewer.SetInputConnection(reader.GetOutputPort()) renderWindowInteractor = vtk.vtkRenderWindowInteractor() imageViewer.SetupInteractor(renderWindowInteractor) imageViewer.Render() imageViewer.GetRenderer().ResetCamera() imageViewer.Render() renderWindowInteractor.Start()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers