[Insight-users] Reading and writing to a buffer

Luis Ibanez luis.ibanez at kitware.com
Thu Aug 25 12:21:37 EDT 2005


HI Daniel,

Please read the Tutorials:

http://www.itk.org/HTML/Tutorials.htm

In particular:

http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf

It describes how to pass buffer data in and out
of ITK images.


   Regards,


      Luis


-------------------------------
Einstein, Daniel R wrote:
> 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_ <mailto:daniel.einstein at pnl.gov>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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