[vtkusers] how to change image order

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Dec 22 10:00:19 EST 2009


On Tue, Dec 22, 2009 at 3:14 PM, Lic. José M. Rodriguez Bacallao
<jmrbcu at gmail.com> wrote:
> this:
>
>> Should I show a 3D volume over time, or should I show a movie
>> of a specific 2D slice over time.
>
> join to this:
>
>> There is no filter to reorganize the vtkImageData
>
> are my problem, I need to apply a different image order to a loaded
> vtkImageData and I don't want to reread the images again with the new
> order. Do I have to read every slice separately, sort the slices and
> use vtkImageAppend to form and a vtkImageData again?

As David G. pointed there is no *easy* way of doing that in VTK at the moment.

Now if you are a true hacker, there is a backdoor to that. You can
create a vtkImageData from a vtkDouble/Float/Int.../Array. And in turn
you can create a vtkDouble/Float/Int.../Array from a memory buffer
*without* duplicating the memory.
So within your specific application you could read all your images in
a single vtkGDCMImageReader, and from the
vtkGDCMImageReader::GetOutput() retrieve the large vtkImage and then
do the manual computation of each individual images.

If you are lucky, you could do it the other way around, you could do
as David G. suggested: read each image one by one and use a
vtkImageAppend. This solution may not work easily if your data has
Rescale/Slope Intercept...

Cheers
-- 
Mathieu



More information about the vtkusers mailing list