[vtkusers] not able to view .vtk file in 3D view
Gururajan
gururajan.r at raster.in
Fri Jul 31 06:56:44 EDT 2009
I got the link and i went, but i dont know how to configure in my
application.
What should i do for that. "My aim is i have to read dicom series
files and should display that in 3d view" thats what i have written my
code below.
your guidance seems to be more helpful to me. Please guide me how i can
implement this in my java application.
Please please guide me.
Thanks
Guru
Mathieu Malaterre wrote:
> GDCM 2.x is wrapped in Java, just turn the Java option ON.
>
> for example:
>
> http://gdcm.svn.sourceforge.net/svnroot/gdcm/trunk/Utilities/VTK/Examples/Java/HelloVTKWorld.java
>
> HTH
>
> On Fri, Jul 31, 2009 at 12:26 PM, Gururajan<gururajan.r at raster.in> wrote:
>
>> hi Mathieu
>>
>> very kind for your reply.
>> i have gone into the link which you have provided, but i need it for java,
>> coz am developing in java using vtk.jar
>> could please help me in how can i use those link for java. i dont know c++
>>
>> Thanks for you kind reply
>> guru
>>
>>
>> Mathieu Malaterre wrote:
>>
>> If you build GDCM, simply use gdcm2vtk to take as input a DICOM file
>> and write it as .vtk file.
>>
>> Eg:
>> $ gdcm2vtk input.dcm output.vtk
>>
>> Refs:
>> http://gdcm.sourceforge.net/
>> http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=GDCM_Release_2.0#GDCM_2.0.12_.282008.2F06.2F12.29
>>
>> On Fri, Jul 31, 2009 at 12:09 PM, Gururajan<gururajan.r at raster.in> wrote:
>>
>>
>> Any one plz have a guess to me
>>
>> The following methods i have tried to write dicom series files into .VTK
>> format.
>>
>> the problem is
>> am unable to view the written .VTK file.
>>
>> Reading Dicom Series files
>> vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
>> dicomreader.SetDirectoryName("/home/gururaj/MANIX/MANIX/CER-CT/ANGIO
>> CT");
>> dicomreader.Update();
>>
>>
>>
>> the following are the types i have tried to write .VTK format using
>> dicomreader.
>> /*vtkPolyDataWriter polyWriter = new vtkPolyDataWriter();
>> polyWriter.SetFileName("/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Polydata.vtk");
>> polyWriter.SetInput(dicomreader.GetOutput());
>> polyWriter.SetFileTypeToASCII();
>> polyWriter.Write();
>> polyWriter.Update();
>> */
>>
>> /*
>> vtkUnstructuredGridWriter unWriter = new vtkUnstructuredGridWriter();
>> unWriter.SetFileName("/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Undata.vtk");
>> unWriter.SetInput(dicomreader.GetOutput());
>> unWriter.SetFileTypeToASCII();
>> unWriter.Write();
>> unWriter.Update();
>> */
>> /*vtkImageData imgData = dicomreader.GetOutput();
>> imgData.SetSpacing(1, 1, 1);
>> imgData.SetOrigin(0,0,0);
>> vtkImageWriter imgWriter = new vtkImageWriter();
>> imgWriter.SetInput(imgData);
>> imgWriter.SetFileName("/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
>> imgWriter.SetFileDimensionality(3);
>> imgWriter.Update();
>> imgWriter.Write();
>> */
>>
>> /*vtkStructuredPointsWriter stWriter = new vtkStructuredPointsWriter();
>> stWriter.SetInput(dicomreader.GetOutput());
>> stWriter.SetFileName("/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
>> stWriter.SetFileTypeToASCII();
>> stWriter.Update();
>> stWriter.Write();
>> */
>>
>> /* vtkXMLImageDataWriter xWriter = new vtkXMLImageDataWriter();
>> xWriter.SetInput(dicomreader.GetOutput());
>> xWriter.SetFileName("/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
>> xWriter.Update();
>> xWriter.Write();
>> */
>>
>> the following method i have used to view .VTK file but all are helpless to
>> me.
>> String strfilename = new String();
>> strfilename = "/home/gururaj/eclipse
>> Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk";
>>
>> //vtkPolyDataReader polyReader = new vtkPolyDataReader();
>> vtkPNGReader polyReader = new vtkPNGReader();
>>
>> polyReader.SetFileName(strfilename);
>> polyReader.Update();
>>
>>
>> vtkPolyData polyData = new vtkPolyData();
>> polyData.DeepCopy(polyReader.GetOutput());
>>
>> vtkPolyDataMapper polyMapper = new vtkPolyDataMapper();
>> polyMapper.SetInput(polyData);
>> polyMapper.Update();
>>
>> vtkActor actor = new vtkActor();
>> actor.SetMapper(polyMapper);
>> actor.VisibilityOn();
>>
>> vtkRenderer render = new vtkRenderer();
>> vtkRenderWindow renwindow = new vtkRenderWindow();
>> renwindow.AddRenderer(render);
>>
>> vtkRenderWindowInteractor renintec = new vtkRenderWindowInteractor();
>> renintec.SetRenderWindow(renwindow);
>>
>> render.AddActor(actor);
>> render.SetBackground(0.2,0.3,0);
>> renwindow.BordersOff();
>> renwindow.SetSize(500, 500);
>> renwindow.Render();
>> render.ResetCamera();
>> renintec.Start();
>>
>>
>>
>>
>> _______________________________________________
>> 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