[vtkusers] display .vtk files in window

Sercani sercanimailgroups at gmail.com
Wed Jul 29 02:11:00 EDT 2009


Hi;
You must first define a vtkCanvas for adding the vtk libraries to system 
memory and add this canvas to a JFrame's container...Read that .vtk file 
with a appropriate reader (same as the writer that you use before), 
define a vtkImageViewer2, add that readers output to his viewer's input 
and add this viewer to your canvas renderer:

vtkImageViewer2 viewer = new vtkImageViewer2();
viewer.SetColorWindow(256); //must be calculated like this: int window = 
(int) ((reader.GetOutput().GetScalarRange()[1] - 
reader.GetOutput().GetScalarRange()[0]));
viewer.SetColorLevel(128);    //must be calculated like this:  int level 
= (int) (reader.GetOutput().GetScalarRange()[0] + (window / 2));
viewer.SetInput(reader.GetOutput());
viewer.SetRenderWindow(canvas.GetRenderWindow());
viewer.SetRenderer(canvas.GetRenderer());

This viewer contains all of your images, you can use it for reslicing, 
window & level processing etc. Check out vtkImagePlaneWidget's examples 
for a convenient MPR projection, vtkFixedPointRayCastMapper for MIP and 
MINIP rendering, vtkPolyDataMapper and vtkImageMarchingCubes for SSD 
rendering, vtkVolumeTextureMapper3D for VRT rendering...

Namaste...

Gururajan wrote:
> john,
>
> but i need it for java. how can i plug and please give some examples.
>
> very kind to you
>
> Thanks
> Guru
>
> John Drescher wrote:
>   
>> On Tue, Jul 28, 2009 at 4:52 PM, Gururajan<gururajan.r at raster.in> wrote:
>>   
>>     
>>> david,
>>>
>>> thanks to the links,
>>> but i need some examples which exactly takes .vtk file as input to make
>>> 3d rendering and display.
>>> in those links there is no provision for .vtk files as input.
>>>
>>> Please help me in this
>>> Thanks for your valuable reply
>>> Guru
>>>
>>> David Doria wrote:
>>>     
>>>       
>>>> On Tue, Jul 28, 2009 at 4:36 PM, Gururajan <gururajan.r at raster.in
>>>> <mailto:gururajan.r at raster.in>> wrote:
>>>>
>>>>     Hi all,
>>>>     Please any one can help me in this.
>>>>
>>>>     I have converted dicom series into .vtk format.,  but i do not
>>>>     know how
>>>>     to display this .vtk file in 3d view.
>>>>
>>>>     am using java eclipse with vtk.jar
>>>>
>>>>
>>>>       
>>>>         
>> Paraview definitely loads .vtk files and can display them in 3D.
>>
>> John
>>   
>>     
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>   




More information about the vtkusers mailing list