[vtkusers] Read and resample large volumes

David Gobbi david.gobbi at gmail.com
Wed Nov 2 15:09:43 EDT 2011


The streamer should be near the end of the pipeline, not near the beginning.

 - David


On Wed, Nov 2, 2011 at 12:19 PM, leandro <leobbastos at gmail.com> wrote:
> Hello David,
>
> I have the same situation, but i don´t manage to do it with VTK without
> first loading too much data into memory. Doing the way you suggested worked
> even worse.
> My code:
>
> vtkImageReader2* image = vtkImageReader2::New();
>                        image->SetDataExtent(extent);
>                        image->SetDataByteOrderToLittleEndian();
>                        image->SetFilePrefix (prefix);
>                        image->SetDataSpacing(spacing);
>
> vtkImageShrink3D *shrink = vtkImageShrink3D::New();
>        shrink->SetInputConnection(streamer->GetOutputPort());
>        shrink->SetShrinkFactors(2,2,2);
>
> vtkImageDataStreamer* streamer = vtkImageDataStreamer::New();
>        streamer->GetOutput()->GlobalReleaseDataFlagOn();
>        streamer->SetInputConnection(image->GetOutputPort());
>        streamer->SetNumberOfStreamDivisions(10);
>        mapper -> SetInput(streamer->GetOutput());
>
> The data is 700MB big. Resampled to the half it costs 250MB memory (done
> without streaming and loads max. 795MB). But with this code it firsts need
> almost 800MB then explodes to 2GB =(
> I don´t get it, where is the mistake?
>
> Thank you



More information about the vtkusers mailing list