<div dir="ltr">Hi Pedro,<div><br></div><div>Take a look at Examples/ImageProcessing/Python/ImageInteractorReslice.py (in the VTK source).  It provides window/level interaction with the left mouse button.</div><div><br></div><div> - David</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 11, 2015 at 12:52 AM, Pedro Paulo <span dir="ltr"><<a href="mailto:pedropaulobmjr@hotmail.com" target="_blank">pedropaulobmjr@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">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 (<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOM" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOM</a>) 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.<div><br></div><div><br></div><div><span style="font-size:12pt">The code in python that I adapted:</span></div><div><div><br></div><div>import vtk</div><div>import sys</div><div><br></div><div>def show_dicom_image(ndicom):</div><div><span style="white-space:pre-wrap">        </span>reader = vtk.vtkDICOMImageReader()</div><div><span style="white-space:pre-wrap">       </span>reader.SetFileName(ndicom)</div><div><span style="white-space:pre-wrap">       </span>reader.Update()</div><div><br></div><div><span style="white-space:pre-wrap"> </span># Visualize</div><div><span style="white-space:pre-wrap">      </span>imageViewer = vtk.vtkImageViewer()</div><div><span style="white-space:pre-wrap">       </span>imageViewer.SetInputConnection(reader.GetOutputPort())</div><div><span style="white-space:pre-wrap">   </span>renderWindowInteractor = vtk.vtkRenderWindowInteractor()</div><div><span style="white-space:pre-wrap"> </span>imageViewer.SetupInteractor(renderWindowInteractor)</div><div><span style="white-space:pre-wrap">      </span>imageViewer.Render()</div><div><span style="white-space:pre-wrap">     </span>imageViewer.GetRenderer().ResetCamera()</div><div><span style="white-space:pre-wrap">  </span>imageViewer.Render()</div><div><span style="white-space:pre-wrap">     </span>renderWindowInteractor.Start()</div><div><br></div><div>show_dicom_image(sys.argv[1])</div></div><div><br></div></div></div></blockquote></div></div></div>