<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
yes, thats what i mentioned, i have created .vtk files from reading
series of dicom files, my written (.vtk) files&nbsp; are not displaying in
my application, thats y i attached my source for creating .vtk file and
displaying in the control. Please have look at it and guide me.,<br>
<br>
i have used most of the writer to to write .vtk file<br>
please see the below findings<br>
Thanks<br>
Guru<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; setLayout(new BorderLayout());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
dicomreader.SetDirectoryName("/home/gururaj/MANIX/MANIX/CER-CT/ANGIO
CT");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; dicomreader.Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkImageReader reader = new vtkImageReader();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; vtkPolyDataWriter polyWriter = new vtkPolyDataWriter();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; polyWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Polydata.vtk");
polyWriter.SetInput(dicomreader.GetOutput());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; polyWriter.SetFileTypeToASCII(); <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; polyWriter.Write();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; polyWriter.Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkUnstructuredGridWriter unWriter = new
vtkUnstructuredGridWriter();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* unWriter.SetFileName(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Undata.vtk"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* ); unWriter.SetInput(dicomreader.GetOutput());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* unWriter.SetFileTypeToASCII(); unWriter.Write();
unWriter.Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkImageData imgData = dicomreader.GetOutput();
imgData.SetSpacing(1,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* 1, 1); imgData.SetOrigin(0,0,0); vtkImageWriter imgWriter =
new<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkImageWriter();
imgWriter.SetInput(imgData);imgWriter.SetFileName(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* ); imgWriter.SetFileDimensionality(3); imgWriter.Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* imgWriter.Write();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkStructuredPointsWriter stWriter = new
vtkStructuredPointsWriter();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*
stWriter.SetInput(dicomreader.GetOutput());stWriter.SetFileName(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* ); stWriter.SetFileTypeToASCII(); stWriter.Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* stWriter.Write();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkXMLImageDataWriter xWriter = new vtkXMLImageDataWriter();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*
xWriter.SetInput(dicomreader.GetOutput());xWriter.SetFileName(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* ); xWriter.Update(); xWriter.Write();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkPNGWriter pngWriter = new vtkPNGWriter();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* pngWriter.SetInput(dicomreader.GetOutput());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* pngWriter.SetFileDimensionality(3);pngWriter.SetFileName(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/pngdata.png"<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 3d Construction<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String strfilename = new String();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strfilename = "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk";<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // vtkPolyDataReader polyReader = new vtkPolyDataReader();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPNGReader polyReader = new vtkPNGReader();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyReader.SetFileName(strfilename);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyReader.Update();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPolyData polyData = new vtkPolyData();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyData.DeepCopy(polyReader.GetOutput());<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPolyDataMapper polyMapper = new vtkPolyDataMapper();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyMapper.SetInput(polyData);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; polyMapper.Update();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkActor actor = new vtkActor();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor.SetMapper(polyMapper);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor.VisibilityOn();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkRenderer render = new vtkRenderer();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkRenderWindow renwindow = new vtkRenderWindow();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renwindow.AddRenderer(render);<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor renintec = new
vtkRenderWindowInteractor();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renintec.SetRenderWindow(renwindow);<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; render.AddActor(actor);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; render.SetBackground(0.2, 0.3, 0);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renwindow.BordersOff();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renwindow.SetSize(500, 500);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renwindow.Render();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; render.ResetCamera();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renintec.Start();<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* exitButton = new JButton("Exit");
exitButton.addActionListener(this);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* //add(renWin, BorderLayout.CENTER); add(exitButton,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* BorderLayout.EAST);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 3d Construction<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /*<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkRenderer renderer = new vtkRenderer();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* renderer.AddActor(imgActor); renderer.ResetCamera();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* renderer.UpdateLightsGeometryToFollowCamera(); renWin = new<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;* vtkPanel(); renWin.GetRenderer().AddActor(imgActor);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*/<br>
<br>
John Drescher wrote:
<blockquote
 cite="mid:387ee2020907310614r426f9e5bw47a61ca6d1c5b932@mail.gmail.com"
 type="cite">
  <pre wrap="">On Fri, Jul 31, 2009 at 6:56 AM, Gururajan<a class="moz-txt-link-rfc2396E" href="mailto:gururajan.r@raster.in">&lt;gururajan.r@raster.in&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I got the link and i went, but i dont know how to configure in my
application.

What should i do for that. &nbsp;"My aim is i have to &nbsp;read dicom series
files and should display that in 3d view" thats what i have written my
code below.
your guidance &nbsp;seems to be more helpful to me. Please guide me how i can
implement this in my java application.

    </pre>
  </blockquote>
  <pre wrap=""><!---->BTW, You do not need to convert your dicom data to a .vtk file. VTK
will read dicom formats and display them. You just need to write your
vtk viewer in java.

John
  </pre>
</blockquote>
<br>
</body>
</html>