[Insight-developers] Trying to minimize the memory needed by itkImageFileReader

Roger Bramon Feixas rogerbramon at gmail.com
Tue Apr 5 03:32:37 EDT 2011


Hi,

I'm trying to minimize the memory needed at the same time to read a DICOM
file using itkImageFileReader. Basically, the problem is related with the
pixel type chosen. I always use "signed short" because I actually work with
CT and MR but sometimes GDCMImageIO chooses another pixel type and a
conversion has to be done. It means that when GDCMImageIO is reading, 3
buffers are allocated:

- Buffer allocated by *this->AllocateOutputs();* in
ImageFileReader::GenerateData() (line 370 of itkImageFileReader.txx)
- Buffer allocated by *loadBuffer = new char[ sizeOfActualIORegion ];* in
ImageFileReader::GenerateData() (line 414 of itkImageFileReader.txx)
- Buffer allocated by *reader.Read()* in GDCMImageIO::Read of
itkGDCMImageIO.cxx

but not all of them are used at the same time. I mean, the memory needed to
the outputs is allocated at the top of ImageFileReader::GenerateData()
when this->AllocateOutputs() is called. However, if a conversion has to be
done, this buffer is used after reading since the buffer used is *
loadBuffer.*

Could be possible to allocate the output memory after the reading (if a
conversion is needed)? It would allow us to have 2 buffers instead of 3 at
the same time and it would be great to minimize memory problems reading huge
multiframes DICOM files which are really common.

I hope you understand my problem.

Thanks,

Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110405/1d9a20f0/attachment.htm>


More information about the Insight-developers mailing list