<!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ürke <span
dir="ltr"><<a moz-do-not-send="true" href="mailto:tuerke@cbs.mpg.de">tuerke@cbs.mpg.de</a>></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->SetImportVoidPointer(&myAdapter->m_ImageISIS->voxel<short>(0,0,0,0));<br>
importer->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);<br>
importer->SetDataExtentToWholeExtent();<br>
importer->SetDataScalarTypeToShort();<br>
importer->Update();<br>
viewer->SetInputConnection(importer->GetOutputPort());<br>
viewer->SetZSlice(100);<br>
viewer->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->SetFileDimensionality(3);<br>
writer->SetInputConnection(importer->GetOutputPort());<br>
writer->SetFileName("test.vtk");<br>
writer->UpdateWholeExtent();<br>
writer->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>
"
<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->SetDimensions(dimensions[0], <br>
dimensions[1],<br>
dimensions[2]);<br>
vtkImage->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);<br>
<br>
vtkImage->SetSpacing(1,1,1);<br>
vtkImage->SetNumberOfScalarComponents(1);<br>
vtkImage->SetOrigin(0,0,0);<br>
vtkImage->AllocateScalars();<br>
short* scalarPtr =
static_cast<short*>(vtkImage->GetScalarPointer());<br>
scalarPtr =
&myAdapter->m_ImageISIS->voxel<short>(0,0,0,0);<br>
vtkImage->Update();<br>
<br>
But if i hand the vtkImage to the viewer by:<br>
<br>
viewer->SetInput(vtkImage);<br>
<br>
the shown image is black :-(<br>
<br>
</body>
</html>