[Insight-users] Copy one pointer's content to another pointer

Jiang jiang at TI.Uni-Trier.DE
Mon Jul 19 09:26:48 EDT 2004


Hi ITK users,
I want to copy one ITK pointer's content to another ITK pointer, so that
the operation 
performed on the second pointer will not influence the first pointer.
I do it as follow:
         WriteImageType::Pointer pointer1 already exists and has some
content
         WriteImageType::Pointer tmp = WriteImageType::New();//copy
pointer1's content to tmp
    tmp->SetRequestedRegion( pointer1->GetRequestedRegion() );
    tmp->SetBufferedRegion( pointer1->GetBufferedRegion() );
    tmp->SetLargestPossibleRegion( pointer ->GetLargestPossibleRegion()
);
    tmp->SetPixelContainer(pointer1->GetPixelContainer() );
    tmp->CopyInformation( pointer1 );
 
 
Now I can operate the tmp's content. However it still affect pointer1.
It seems that all operations 
performed on tmp are same as performed on pointer1.
 
How can I copy one pointer totally to another one?
 
 
Thanks!
 
 
Jiang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040719/0b761003/attachment-0001.html


More information about the Insight-users mailing list