[Insight-users] Exporting image data

Reinhard Hameeteman reinhard.afstuderen at gmail.com
Fri Jun 30 12:44:12 EDT 2006


Hi Ben,

I found some solutions in the mailing list:
http://public.kitware.com/pipermail/insight-users/2004-February/006865.html
http://public.kitware.com/pipermail/insight-users/2003-February/002522.html


And on the web site:
http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf

But the difference between the two methods isn't clear to me.
I haven't tested things out yet.

Hope it helps for you.

2006/6/30, Ben Larson <blarson at optomet.com>:
> Hi Reinhard,
>
> That is an excellent question. I didn't find a good solution myself so
> ended up copying the data into a C array at one point and also using the
> ImportImageFilter. It was not the best way to do things and I wasn't
> happy with how it worked. I haven't seen any responses posted to the
> list but am curious what sort of feedback you are getting. If you get
> some good responses, I'd appreciate hearing about them.
>
> Thanks,
> Ben Larson
>
> Reinhard Hameeteman wrote:
> > Hi all,
> >
> > Within a program that uses ITK classes to process image data, I want
> > to do some processing using other routines (from netlib/FishPack). So
> > my pipeline is like:
> > ITK processing -> FishPack processing -> ITK processing
> > Now I try to avoid unnecessary copying of data from an ITK image to a
> > C array and back. I know there is a class called ImportImageFilter to
> > import a chunk of memory into an ITK image, which I can use to get my
> > image back into an ITK pipeline. But in my case I also need some way
> > to get the ITK image to the FishPack routines. This routines simply
> > needs a pixeltype pointer to a contiguous piece of memory, in which
> > the image is ordered in the same way an ITK iterator traverses through
> > the image. In the itkFFTWRealToComplexConjugateImageFilter filter I
> > saw the following way to access the image data:
> > float *in =
> >      const_cast<float *>(reinterpret_cast<const float
> > *>(inputPtr->GetBufferPointer()));
> >
> > Is it a good thing to omit the const_cast and use this method to pass
> > an image data pointer to a routine that changes the data and is it
> > guaranteed that an ITK image is in a contiguous piece of memory?
> >
> > An other method I saw in the mailing lists is:
> > PixelType * CArray = image->GetPixelContainer()->GetImportPointer();
> >
> > Is there a difference between  GetBufferPointer() and
> > GetPixelContainer()->GetImportPointer() or do they both return a
> > pixeltype pointer to the image data?
> >
> > Thanks in advance,
> > Reinhard
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
>


More information about the Insight-users mailing list