[vtkusers] vtkImageImport

Jothybasu K Selvaraj jothybasu at gmail.com
Mon Mar 29 13:01:26 EDT 2010


It seems like paraview is expecting vtkXMLImageData, so you are getting
vtkXMLReader related error.Try using vtkXMLImageDataWriter and
vtkXMLImageDataReader.

Jothy

On Mon, Mar 29, 2010 at 5:46 PM, Erik Türke <tuerke at cbs.mpg.de> wrote:

>  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
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100329/b7961c72/attachment.htm>


More information about the vtkusers mailing list