[Insight-users] Reading and writing to a buffer

Einstein, Daniel R daniel.einstein at pnl.gov
Thu Aug 25 11:53:24 EDT 2005


Hello,

Following example #5 in the Data Representation section of the UG, I
implemented a pipeline reading an array from my application into the ITK
Image class. I then apply a bunch of filters. Now instead of writing to
a file, I want to put the transformed image back into the array so that
I can hand it off to the rest of the non-itk program. I am probably
missing something obvious to do with memory and storage in itk. Can
someone enlighten me? Below is a thumbnail of my code.

typedef itk::ImportImageFilter< PixelType, Dimension >
ImportFilterType;
ImportFilterType::Pointer importFilter = ImportFilterType::New();    
.
.
const unsigned int numberOfPixels =  size[0] * size[1] * size[2];
PixelType * localBuffer = new PixelType[ numberOfPixels ];
PixelType * it = localBuffer;
.
*it = *my_array
.
importFilter->Update()
.
filter->Update() # implementation of filter 1
.
filter->Update() # implementation of filter n
.
.
//Here instead of writing to a file I want to return the transformed
image to my_array?

Regards,
Dan


Daniel R Einstein, PhD
Biological Monitoring and Modeling
Pacific Northwest National Laboratory
P.O. Box 999; MSIN P7-59
Richland, WA 99352
Tel: 509/ 376-2924
Fax: 509/376-9064
daniel.einstein at pnl.gov


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


More information about the Insight-users mailing list