[Insight-users] image pixel value

Luis Ibanez luis.ibanez at kitware.com
Mon Feb 2 21:30:03 EST 2009


Hi Leila,


You may want use the type


             NumericTraits< T >::PrintType


For example:

   typedef BinaryImageType::PixelType             PixelType;
   typedef NumericTraits< PixelType>::PrintType   PrintType;

   PixelType pixelValue = m_VarianceImage->GetPixel( pixelIndex );

   PrintType printValue = static_cast< PrintType >( pixelValue ):
   std::cout << printValue << std::endl;


   Regards,


     Luis



-----------------------
Leila Baghdadi wrote:
> Hi guys,
> 
> what is the proper way to print the voxel value of image,
> 
> how come I get empty printed!
> 
> bool isInside =
> m_VarianceImage->TransformPhysicalPointToIndex( point,pixelIndex ); 
>  if ( isInside )
>     {
> BinaryImageType::PixelType pixelValue =
> m_VarianceImage->GetPixel( pixelIndex );
> 	  std::cout << pixelValue << " pixel \n";
> }
> 
> thanks
> 
> _______________________________________________
> 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