<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><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 class="Apple-tab-span" style="white-space:pre"> </span>reader = vtk.vtkDICOMImageReader()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>reader.SetFileName(ndicom)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>reader.Update()</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span># Visualize</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer = vtk.vtkImageViewer()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer.SetInputConnection(reader.GetOutputPort())</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>renderWindowInteractor = vtk.vtkRenderWindowInteractor()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer.SetupInteractor(renderWindowInteractor)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer.Render()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer.GetRenderer().ResetCamera()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>imageViewer.Render()</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>renderWindowInteractor.Start()</div><div><br></div><div>show_dicom_image(sys.argv[1])</div></div><div><br></div> </div></body>
</html>