[vtkusers] Read and resample large volumes

David Gobbi david.gobbi at gmail.com
Mon Jun 13 12:08:33 EDT 2011


Hi Sean,

Streaming is supported automatically by the vtkImageReader (and
vtkImageReader2) but the streaming must be initiated by the opposite
end of the pipeline.

So the idea is that you make a pipeline as usual, but immediately
after the resample filter, you insert a vtkImageDataStreamer and use
the SetNumberOfStreamDivisions() method to control how many pieces
the data will be broken into.  The output of vtkImageDataStreamer will
be a contiguous image (i.e. the result of putting all the pieces together
again) so the expectation is that you would be shrink the image when
you resample it.  Not that there is nothing that you have to do to the
reader to make it stream, it will stream automatically.

A long time ago the vtkImageWriter used to stream as well, but I just
looked at the code and apparently someone removed this ability from
it.  This means that you won't be able to resample & write the file
unless the resampling shrinks the image to a small enough size that
it will fit in memory, because the writer needs the whole resampled
image to be in memory before it can write it.

 - David


On Mon, Jun 13, 2011 at 9:36 AM, Sean Larkin
<sean.larkin at lickenbrocktech.com> wrote:
> I have data that is too large to be read into memory at once.  The data is
> in a single .raw file.  I would like to be able to read a portion of this
> file, resample the data and then either insert into vtkVolume or add to a
> single file.  Basically the idea is to take the volume and resample it and
> put it into a single file(the whole resampled volume) by iterating through
> the original large .raw file and then render this smaller volume.  And then
> be able to return to the smaller volume to resample it or change its
> spacing, etc. from a vtkImageReader.  Is there a way to do this using
> vtkImageReader?
>
>
>
> Thanks,
>
> Sean



More information about the vtkusers mailing list