<!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">
On 03/29/2010 07:01 PM, Jothybasu K Selvaraj wrote:
<blockquote
 cite="mid:1dd3c8b21003291001p6b4093a0n1b02ac47f5447d71@mail.gmail.com"
 type="cite">
  <div dir="ltr">It seems like paraview is expecting vtkXMLImageData,
so you are getting vtkXMLReader related error.Try using
vtkXMLImageDataWriter and vtkXMLImageDataReader.<br>
  <br>
Jothy <br>
  <br>
  <div class="gmail_quote">On Mon, Mar 29, 2010 at 5:46 PM, Erik T&uuml;rke <span
 dir="ltr">&lt;<a moz-do-not-send="true" href="mailto:tuerke@cbs.mpg.de">tuerke@cbs.mpg.de</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">Hi!<br>
    <br>
I am new to vtk.<br>
    <br>
I am using the vtkImageImport class to view a non vtk object:<br>
    <br>
importer-&gt;SetImportVoidPointer(&amp;myAdapter-&gt;m_ImageISIS-&gt;voxel&lt;short&gt;(0,0,0,0));<br>
importer-&gt;SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);<br>
importer-&gt;SetDataExtentToWholeExtent();<br>
importer-&gt;SetDataScalarTypeToShort();<br>
importer-&gt;Update();<br>
viewer-&gt;SetInputConnection(importer-&gt;GetOutputPort());<br>
viewer-&gt;SetZSlice(100);<br>
viewer-&gt;Render();<br>
sleep(5);<br>
    <br>
This works fine. The second thing i want to do is safe the data as a
vtk image and open it with paraview:<br>
    <br>
vtkImageWriter* writer = vtkImageWriter::New();<br>
writer-&gt;SetFileDimensionality(3);<br>
writer-&gt;SetInputConnection(importer-&gt;GetOutputPort());<br>
writer-&gt;SetFileName("test.vtk");<br>
writer-&gt;UpdateWholeExtent();<br>
writer-&gt;Write();<br>
    <br>
The file is safed, but i can not open it with paraview. There is always
a message: "a reader for ... could not be found. please choose one". <br>
And when i choose vtk image reader the message:<br>
"&nbsp;
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">index
0:
not well-formed (invalid token)</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">ERROR:
In
/build/buildd/paraview-3.4.0/VTK/IO/vtkXMLReader.cxx, line 360</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">vtkXMLImageDataReader
(0x24b7720):
Error parsing input file. ReadXMLInformation aborting.</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">ERROR:
In
/build/buildd/paraview-3.4.0/VTK/Filtering/vtkExecutive.cxx, line 757</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">vtkCompositeDataPipeline
(0x24c2030):
Algorithm vtkXMLImageDataReader(0x24b7720) returned
failure for request: vtkInformation (0x24dc890)</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
Debug: Off</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
Modified Time: 79214</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
Reference Count: 1</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
Registered Events: (none)</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
Request: REQUEST_INFORMATION</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
ALGORITHM_AFTER_FORWARD: 1</span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);">
FORWARD_DIRECTION: 0"<br>
    </span></p>
    <p style="margin: 0px; text-indent: 0px;"><br>
    <span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);"></span></p>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);"><br>
    </span></p>
appears.<br>
    <br>
The third thing i want to do is store the data to a vtkImageData object.<br>
Is there any possibility to directly forward the vtkImageImport (or
pointer of the first element of the data array) to the vtkImageData, so
i do not have to do it voxel by voxel? Because this needs a lot of time
for big data.<br>
    <br>
Thanks for your help!<br>
    <br>
cheers<br>
    <p style="margin: 0px; text-indent: 0px;"><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);"></span><span
 style="font-family: 'Courier'; font-size: 8pt; color: rgb(128, 0, 0);"></span></p>
    </div>
    <br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
 target="_blank">www.kitware.com</a><br>
    <br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
 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
 moz-do-not-send="true" 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 moz-do-not-send="true"
 href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
    <br>
  </blockquote>
  </div>
  <br>
  </div>
</blockquote>
Ahh very thanks....visualization is working now (at least slice-wise).
I guess 3d rendering is a bit more complicated.<br>
<br>
So the problem which remains is the storage in a vtkImageData object.<br>
My approach is:<br>
<br>
vtkImage-&gt;SetDimensions(dimensions[0], <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dimensions[1],<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dimensions[2]);<br>
vtkImage-&gt;SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);<br>
&nbsp;&nbsp;&nbsp; <br>
vtkImage-&gt;SetSpacing(1,1,1);<br>
vtkImage-&gt;SetNumberOfScalarComponents(1);<br>
vtkImage-&gt;SetOrigin(0,0,0);<br>
vtkImage-&gt;AllocateScalars();<br>
short* scalarPtr =
static_cast&lt;short*&gt;(vtkImage-&gt;GetScalarPointer());<br>
scalarPtr =
&amp;myAdapter-&gt;m_ImageISIS-&gt;voxel&lt;short&gt;(0,0,0,0);<br>
vtkImage-&gt;Update();<br>
<br>
But if i hand the vtkImage to the viewer by:<br>
<br>
viewer-&gt;SetInput(vtkImage);<br>
<br>
the shown image is black :-(<br>
<br>
</body>
</html>