[Insight-users] 3D Rigid Registration - "Unable to allocate / Failed to allocate memory for image" problem
Vural Özbudak
dvozbudak at gmail.com
Wed May 13 19:30:55 EDT 2009
Hi everyone,
I want to implement 3D rigid registration on 2 sets of 509 slices 512 x 512
CT dicom data. I'm basically using
Insight/Examples/Registration/ImageRegistration8.cxx code with some altering
in data loading part, load it slice by slice having a vtkImage at hand,
convert it to itkImage, apply the registration, back convert to a vtkImage
and then give it to a renderer (just for visualization of one slice).
One set of dicom data I have is about 100 Mb, (two sets 200 Mb), and I'm
working on a quad-core 2.66 GHz computer which has 3.2 GB of RAM. Before the
time of execution, RAM usage was about 0.5 GB as I follow from the system
monitor of Fedora Core 8.
1) I tried to load all the 509 slices of the two sets, when RAM usage
increases to 2.0 GB, code stops running, RAM usage goes back to 0.5 GB and
this problem occurs:
vtkDoubleArray (0xa8a1a10): Unable to allocate 133431296 elements of size 8
bytes. (I guess this makes roughly 1GB for 509 x 2 slices)
2) So I diminished the number of slices I load (I know it's useless for
registration purpose but), and I gave 200 slices per data set. RAM usage
increases to 2.2 GB, code stops and RAM goes back to 0.5 GB again. The
output was the lots of repeated prints of this error:
......
Unable to allocate 67766783 elements of size 8 bytes (About 0.5 GB for 200 x
2 slices)
.......
Segmentation Fault
3) I decreased the slices to 130 slices. During execution, RAM usage
increased to 2.3 GB, code stopped and RAM went back to 0.5 GB. The error
turned out to be the following:
terminate called after throwing an instance of 'itk::ExceptionObject'
what(): /usr/local/ITK/ITK/Code/Common/itkImportImageContainer.txx:188:
Failed to allocate memory for image.
Aborted
4) I decreased slice number to be loaded to 120 slices per both data sets
and the code worked properly, found the registration parameters and showed
one slice in the renderer just like as I wanted to. (RAM usage was 2.5 GB
while code was running)
So I couldn't load more than 120 slices of my data. I tried to subsample it
(say by 4) and free the memory used by original data and calculate
registration parameters with the subsampled version of the data. It made no
difference on the memory usage whether I used the original data or
subsampled versions of it. So it didn't work either.
By the way Insight/Examples/Registration/ImageRegistration8.cxx uses:
#include "itkVersorRigid3DTransform.h"
#include "itkVersorRigid3DTransformOptimizer.h"
My question is, what does exploit and blow up the memory in this process?
How can I get over these problems? In similar problems which ITK fellows
encountered before, the main problem was about the gradient calculation as
far as I've read from the mail list. I don't know what
VersorRigid3DTransform does inside, but does this memory problem have
anything to do with it?
Any kind of solution/suggestion will be appreciated. Thanks in advance.
--
Vural Ozbudak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090514/58d8b850/attachment-0001.htm>
More information about the Insight-users
mailing list