mmm<div><br></div><div>try this to refresh it , it works for me </div><div><br></div><div>VtkPanel().Render()</div><div><br></div><div>also </div><div><br></div><div>you can try <br><br></div><div>vtkPanel.repaint();</div>
<div><br><div class="gmail_quote">2012/6/14 Rémi DUCCESCHI <span dir="ltr"><<a href="mailto:remi.ducceschi@gmail.com" target="_blank">remi.ducceschi@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello again!<br><br>To answer myself (it will maybe help someone later): it's much easier to use vtk 5.10 to do what I want thanks to this : <a href="http://www.cmake.org/Wiki/VTK/Image_Rendering_Classes" target="_blank">http://www.cmake.org/Wiki/VTK/Image_Rendering_Classes</a><br>
<br>I still have a problem for updating the vtkRenderWindowPanel: I change the slice by changing the position of the actor<br> actor.SetPosition(pos); // pos is a double[]<br> panel.Render();<br>
it does exactly what I want, but the Panel isn't updated until I create an event with my mouse.<br>if you know what I can do, you would be welcome!!!<br><br>from the beginning to the end, we have the following source code to create and display a 3D image (see bellow)<br>
<br><br>------------------------------------- SOURCE CODE ----------------------------------<br>public class PrintPix extends JFrame<br>{<br> public PrintPix (File[] paths)<br> {<br> int size = paths.length;<br>
vtkStringArray array = new vtkStringArray();<br><br> array.SetNumberOfValues(size);<br> for (int i = 0; i < size; i++)<br> {<br> array.SetValue(i, paths[i].getAbsolutePath());<br>
}<br><br> reader = new vtkBMPReader();<br> actor = new vtkImageSlice();<br> int numberOfFile = paths.GetNumberOfValues() - 1; // number of open pictures - 1<br><br> // open pictures and create a 3D picture<br>
// reader.SetFileNames(paths);<br> reader.SetDataExtent(0, numberOfFile, 0, numberOfFile, 0, numberOfFile);<br> reader.SetDataSpacing(1, 1, 40);<br> reader.SetFileNames(array);<br> reader.Update();<br>
<br> // put it in a mapper<br> vtkImageResliceMapper mapper = new vtkImageResliceMapper();<br> mapper.SetInputConnection(reader.GetOutputPort());<br> mapper.SliceFacesCameraOn();<br> mapper.SliceAtFocalPointOn();<br>
<br> // on créél les propriétés de l'image<br> vtkImageProperty props = new vtkImageProperty();<br> props.SetInterpolationTypeToLinear();<br><br> // put all in an actor<br> actor.SetMapper(mapper);<br>
actor.SetProperty(props);<br> mapper.UpdateInformation();<br><br> panel = new vtkRenderWindowPanel();<br> vtkInteractorStyleImage it = new vtkInteractorStyleImage();<br> it.SetInteractionModeToImage3D();<br>
panel.GetRenderer().AddActor(actor);<br> panel.setInteractorStyle(it);<br><br> panel.setPreferredSize(new Dimension(728, 728));<br> panel.Render();<br><br> add(panel, BorderLayout.CENTER);<br>
<br> setTitle("image");<br> setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br> pack();<br> setVisible(true);<br> <br> panel.Render();<br> }<br>}<br><br>public static void main (String[] args)<br>
{<br> File paths[];<br> // we initialize "paths" with all the pictures we want to open (with a JFileChooser for instance)<br><br> PrintPix principal = new PrintPix(paths);<br> }<br>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>