[Insight-users] some questions in Getting Started V: Integrating ITK in your Application

Yixun Liu yxliu at fudan.edu.cn
Mon Aug 28 22:58:27 EDT 2006


Hi,

I have two questions in Getting Started V: Integrating ITK in your Application.

1. about the parameter type of data transfer function void(const ImageType * image, ...).
Why not using const ImageType::Pointer? In my opinion, using ImageType* as parameter cannot correctly reference count. Return type can be ImageType * or ImageType::Pointer becaues it is assigned to a ImgaeType::Pointer, it can be correctly reference count.

2. about Iterator
I think copying c++ buffer to itk::Image or inverse using iterator is with low efficiency.

...
IteratorTypeit( image, region);
it.GoToBegin();
const char * data= buffer;
while( ! it.IsAtEnd() )
{
*data= it.Get();
++it;
++data;
}
...

If chage the above codes to the followed, program can run fast.

...
char* dataSource = image->GetBufferPointer()
const char * data= buffer;
for(i = 0; i < totalNum; i++)
{
  data[i] = dataSource[i]       

}
...

Cheers,

Yixun Liu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060829/1d21be7c/attachment.html


More information about the Insight-users mailing list