[Insight-users] Difference between GetBufferPointer and GetImportPointer

Andreas Schuh andreas.schuh.84 at googlemail.com
Fri Feb 20 17:16:51 EST 2009


Well, you needn't be confused. There is absolutely no difference, as you
will always get the *same* buffer. I think the two API's of
itk::ImportImageContainer with Set/GetImportPointer() and
GetBufferPointer() should just differentiate that the buffer may either
be explicitly allocated by the user and set via SetImportPointer() or
the ImportImageContainer allocates its own buffer using
AllocateElements() which is used by Reserve() and Squeeze(). Reserve()
will be called by the itk::Image::Allocate(), I think (didn't check that
in the code, but this is quite probable).

So, it's completely up to you what you prefer ... would say
filter->GetOutput()->GetBufferPointer() is nicer. The
ImagePixelContainer should only be accessed if you like to set the
buffer of an image, otherwise let itk::Image manage the buffer and
consider it being hidden.

--
regards
Andreas

李健 schrieb:
> Dear all:
>
> When I want to get the image data from the output of a itk filter,
> what's the difference between using
> "filter->GetOutput()->GetBufferPointer()" and using
> "filter->GetOutput()->GetPixelContainer()->GetImportPointer()"?
>
> I found following description about them in ImportImageContainer calss
> in itk documentation:
> GetBufferPointer: Return a pointer to the beginning of the buffer.
> This is used by the image iterator class.
> GetImportPointer: get the pointer from which the image data is imported.
> But I'm still confused. What's the difference between them? Which one
> I should use to get the image data from itk?
>
> Thanks a lot.
>
> ------------------------------------------------------------------------
> 立刻下载 MSN 保护盾,保障 MSN 安全稳定! 现在就下载!
> <http://im.live.cn/safe/>
> ------------------------------------------------------------------------
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>   



More information about the Insight-users mailing list