[vtkusers] vtkImageImport

Erik Türke tuerke at cbs.mpg.de
Mon Mar 29 12:46:26 EDT 2010


Hi!

I am new to vtk.

I am using the vtkImageImport class to view a non vtk object:

importer->SetImportVoidPointer(&myAdapter->m_ImageISIS->voxel<short>(0,0,0,0));
importer->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);
importer->SetDataExtentToWholeExtent();
importer->SetDataScalarTypeToShort();
importer->Update();
viewer->SetInputConnection(importer->GetOutputPort());
viewer->SetZSlice(100);
viewer->Render();
sleep(5);

This works fine. The second thing i want to do is safe the data as a vtk 
image and open it with paraview:

vtkImageWriter* writer = vtkImageWriter::New();
writer->SetFileDimensionality(3);
writer->SetInputConnection(importer->GetOutputPort());
writer->SetFileName("test.vtk");
writer->UpdateWholeExtent();
writer->Write();

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".
And when i choose vtk image reader the message:
"

index 0: not well-formed (invalid token)

ERROR: In /build/buildd/paraview-3.4.0/VTK/IO/vtkXMLReader.cxx, line 360

vtkXMLImageDataReader (0x24b7720): Error parsing input file. 
ReadXMLInformation aborting.

ERROR: In /build/buildd/paraview-3.4.0/VTK/Filtering/vtkExecutive.cxx, 
line 757

vtkCompositeDataPipeline (0x24c2030): Algorithm 
vtkXMLImageDataReader(0x24b7720) returned failure for request: 
vtkInformation (0x24dc890)

Debug: Off

Modified Time: 79214

Reference Count: 1

Registered Events: (none)

Request: REQUEST_INFORMATION

ALGORITHM_AFTER_FORWARD: 1

FORWARD_DIRECTION: 0"



appears.

The third thing i want to do is store the data to a vtkImageData object.
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.

Thanks for your help!

cheers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100329/59c42d21/attachment.htm>


More information about the vtkusers mailing list