[vtkusers] vtkImageReslice

David Gobbi david.gobbi at gmail.com
Wed Jul 17 16:57:51 EDT 2013


Hi Massi,

What kind of computer are you using?  Errors like this appear on the
list fairly often for programs compiled for 32-bit Windows, because
Win32 has memory fragmentation problems that often make it unable to
allocate large, contiguous chunks of memory (in this case VTK is
trying to allocate 250MB, which is a "very large" chunk of memory for
one 32-bit process to try to allocate).

 - David


On Wed, Jul 17, 2013 at 2:48 PM, Massinissa Bandou
<Massinissa.Bandou at usherbrooke.ca> wrote:
> Hi VTK!
>
> I have a 3D image 512x512x512 (16 bits littleEndian, signed short) and
> sometime, I'm getting this error even if I make sure all my pointers are
> deleted:
>
> *vtkShortArray[0AC004B8]: Unable to allocate 134217728 elements of size...*
> after reader->Update();
>
> I'm using vtkGPUVolumeRayCastMapper to render the volume but It's hard to
> interact with it, very slow mouse movement. So I decided to use
> vtkImageReslice to reduce the size. the following code is cutting my volume
> instead of resampling. can anyone help me how I can keep the whole volume
> and reduce the number of slices by half? thank you for your help!
>
>
>
>         vtkSmartPointer<vtkImageReader> reader =
> vtkSmartPointer<vtkImageReader>::New();
>         reader->SetFileName(file.toStdString().c_str());
>         reader->SetFileDimensionality(3);
>         reader->SetDataExtent(0,511,0,511,0,511);
>         reader->SetDataSpacing(0.145, 0.145,0.145);
>         reader->SetDataByteOrderToLittleEndian();
>         reader->SetDataScalarTypeToShort();
>         reader->Update();
>
>         vtkSmartPointer<vtkImageReslice> reslice =
> vtkSmartPointer<vtkImageReslice>::New();
>         reslice->SetOutputExtent(0,255, 0,255, 0,255);
>         reslice->SetOutputSpacing(0.145,0.145,0.145);
>         reslice->SetInputConnection(reader->GetOutputPort());
>         reslice->SetOutputDimensionality(3);
>         reslice->SetInterpolationModeToCubic();
>         reslice->AutoCropOutputOff();
>         reslice->SetResliceAxesOrigin(0,0,0);
>         reslice->Update();
>
>
> Massi



More information about the vtkusers mailing list