[Insight-users] ImageFileWriter and ImageAdaptor

Hauke Heibel heibel at cs.tum.edu
Fri Oct 19 13:37:07 EDT 2007


Hello there,

 

I just tried to use the ImageFileWriter in combination with an ImageAdaptor
that does nothing else but to cast data. Unfortunately it is not working,
since the ImageFileWriter is working on the raw buffer by calling (ll.
278-279 itkImageFileWriter.cxx)

 

const void* dataPtr = (const void*) input->GetBufferPointer();

m_ImageIO->Write(dataPtr);

 

On the first glance it may seem to be weird to do such a thing (I mean using
the adaptor), since one might argue that I could simply tell my
ImageFileWriter that I am going to write images of an appropriate type
making casting not required.

 

Actually my setup is a little bit problematic. My general task lies in
converting DICOM files. I switched to the ImageAdaptor, since my source
image consumes already 1.1 GB in memory (I just read a DICOM file, unsigned
short) and if I wanted to convert it to another image type, I would be
required to allocate another 1.1 GB (e.g. for signed short). As many of you
may know Windows does not give us (without some nasty hacks) more than 2 GB
of memory - and here is the reason why I switched to ImageAdaptors. The one
I used (a similar one to that presented in the Software Guide) just casts
the data.

 

Actually GDCM already fails, if used in combination with the
itkImageSeriesFileReader in cases where the DICOM has a different format
than the image request within ITK and when on top of all things the DICOM is
bigger than 1GB.

 

The only solution I can think about for now is to do  some in-place casting
and then using the in-place converted buffer via the itkImportImageFilter.
This sounds really nasty and will only work if my source and destination
data types have the same sizes.

 

I am now wondering if anybody can be of help with this issue? It would be
much appreciated.

 

Regards,

Hauke

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20071019/b48b6e53/attachment.htm


More information about the Insight-users mailing list