[Insight-users] Pointer to pixel buffer, was:logarithmic intensity transformation

Karthik Krishnan Karthik.Krishnan at kitware.com
Wed Jun 29 11:35:08 EDT 2005


Alternatively, if you wish to avoid a (slow) memcpy,


image->GetPixelContainer()->SetContainerManageMemory(false)
PixelType * CArray = image->GetPixelContainer()->GetImportPointer()


If you use GetBufferPointer, you will have to allocate your own array 
and copy elements over from the buffer already managed by itk::Image 
over into another buffer...

CArray = static_cast< PixelType * >( malloc( imageSize ));
memcpy( CArray, image->GetBufferPointer(), imageSize );

thanks
karthik

Jan Schreiber wrote:

>Hi Isabelle, 
>
> TPixel* itk::Image< TPixel, VImageDimension >::GetBufferPointer()
>
>gives you a pointer to the pixel buffer :-)
>
>http://www.itk.org/Doxygen/html/classitk_1_1Image.html#z1062_0
>
>Best regards, 
>Jan
>
>
>  
>
>>>>Renaud Isabelle <renauisa at yahoo.fr> 06/29/05 2:58  >>>
>>>>        
>>>>
>Hi,
> 
>I already knew about GetPixel() and SetPixel() methods as well as iterators to access the value of one pixel of my image. 
> 
>But is there already a method which enables me to retrieve the pixel data of my image directly in one matrix, such as GetBuffer or something like that? Maybe this is not the ideal but I was more familiar with having data stocked in one matrix and accessing pixel data via for loop and  so on.... 
> 
>Isabelle
>
>Jakub Bican <jakub.bican at matfyz.cz> a écrit :
>
>
>Hi Isabelle
>
>How to access the pixel data is described in the ITK Software Guide
>
>http://www.itk.org/ItkSoftwareGuide.pdf 
>
>Look for the chapter 4.1.3 "Accessing Pixel Data" (page 38).
>
>You can also use more efficient way - iterators. See chapter 11 
>"Iterators" (page 687).
>
>Regards,
>Jakub.
>
>
>
>Renaud Isabelle napsal(a):
>  
>
>>Hi Jakub,
>>
>>I took a look on your filter. However, I think there was a 
>>misunderstanding.
>>
>>I don't want to perform a pixel-wise log operation on my image.
>>
>>Actually, I want to perform a kind of histogram transform called 
>>*histogram logarithmic* to improve the contrast of my image.
>>
>>So far, I performed histogram usual rescaling to transform my 
>>intensities into the interval 0-255. Now, I would like my distribution 
>>of gray intensities would be adjusted to improve contrast like:
>>
>>f`'(x,y) = f min * (fmax / fmin) * P(f(x,y)) where P is the cumulated 
>>histogram.
>>
>>So adaptor will not help me, because this is an overall transform of the 
>>image. Maybe I have to create my own filter but how can I access the 
>>matrice of my pixel data form my image?
>>
>>thanks,
>>
>>Isabelle
>>
>>
>>*/Jakub Bican /* a écrit :
>>
>>
>>Hi Isabelle,
>>
>>logarithmic scaling can be done by these filters:
>>
>>LogImageFilter (
>>http://www.itk.org/Doxygen/html/classitk_1_1LogImageFilter.html )
>>Log10ImageFilter (
>>http://www.itk.org/Doxygen/html/classitk_1_1Log10ImageFilter.html )
>>
>>and/or adaptors:
>>
>>LogImageAdaptor (
>>http://www.itk.org/Doxygen/html/classitk_1_1LogImageAdaptor.html )
>>Log10ImageAdaptor (
>>http://www.itk.org/Doxygen/html/classitk_1_1Log10ImageAdaptor.html )
>>
>>Hope this will help you.
>>
>>Regards,
>>Jakub
>>
>>
>>Renaud Isabelle napsal(a):
>>
>>    
>>
>>>Hi Luis,
>>>
>>>In one of your numerous posted replies, you already mentioned the
>>>      
>>>
>>use
>>    
>>
>>>of *logarithmic scaling* to improve visualisation of images.
>>>
>>>"It is not rare to use a logarithmic intensity transformation in
>>>      
>>>
>>order
>>    
>>
>>>to display the FFT output and still be able to "see" something."
>>>
>>>      
>>>
>>http://public.kitware.com/pipermail/insight-users/2004-November/011201.html 
>>    
>>
>>>This is actually what I need to do to improve the quality of my
>>>ultrasonographic image.
>>>
>>>--> Could you tell me a way to perform this logarithmic scaling? Is
>>>there already a function for that, or maybe could I compute my
>>>      
>>>
>>own one
>>    
>>
>>>if you tell me how to get access of the pixel data of my image
>>>displayed with ITK and VTK.
>>>
>>>Thanks for answer,
>>>
>>>Isabelle
>>>
>>>
>>>      
>>>
>>------------------------------------------------------------------------
>>    
>>
>>>*Appel audio GRATUIT partout dans le monde* avec le nouveau Yahoo!
>>>Messenger
>>>Téléchargez le ici !
>>>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org 
>>>http://www.itk.org/mailman/listinfo/insight-users 
>>>      
>>>
>
>
>		
>---------------------------------
> Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
> Téléchargez le ici !  
>
>_______________________________________________
>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