[vtkusers] running out of memory for vtkImageData

John Drescher drescherjm at gmail.com
Wed May 4 11:27:37 EDT 2011


On Wed, May 4, 2011 at 11:15 AM, Prashanth <prashanth.dumpuri at gmail.com> wrote:
> All,
>   I'm trying to allocate a vtkImageData of size 512 x 512 x 218 with 3
> scalar components. To save memory I'm storing the scalar values as 'short',
> but 'am still running out of memory. I'm running my code on a Windows 32 bit
> machine. All the previous posts about memory allocation for vtkImageData
> have been answered with "switch to Windows 7 or a 64-bit machine".
> Unfortunately neither of these solutions work for me. Any other suggestions?
> Thanks

It will be hard to use such a large image in a 2GB address space that
is fragmented such that ~1.2GB is the largest memory allocation you
can make regardless of how much ram or swap you have.

Did you add the /LARGEADDRESSAWARE link flag to your settings and use
the /3GB boot switch in XP or use Vista and above?

This will extend the limit to 3GB and reduce the fragmentation
problem. Even with this I had serious problems processing my 0.625 mm
LungCT data. If you are stuck with this avoid copying the image buffer
and try to avoid any image type other than 1 component short.
Originally I used a vtkBlender to combine a color overlay with my
LungCT and that ended up using almost 800 MB per view (Axial, Coronal,
Sagittal) I replaced that with separate actors for the overlay and
image and that cut the memory usage down to less than 1/3 so now I can
process 1 case without running into problems. Although when I now
think of it I remember a developer recently telling me if I restricted
the extent of the blending operation to a slice it would have reduced
the memory footprint down to just the memory needed for blending.

John



More information about the vtkusers mailing list