[Insight-users] how to get the size of a DICOM image

Martin Urschler martin at urschler.info
Thu Aug 25 04:07:25 EDT 2005


hi,

to get the image size you have to get a region of the image and ask the 
region for its size:

e.g.

InputImageType::SizeType imageSize = 
image->GetLargestPossibleRegion().GetSize();



as for the minimum and maximum value calculation, yes, that is the 
direct way to calculate these values.

regards,
Martin


Yao, Weiguang wrote:
> Hi, itkPeople:
> 
> After successfully reading a 2-dimensional DICOM image by using
> ImageFileReader, I want to get the size of the image, say, 512 by 512.
> Please tell me how to do this. Thanks a lot!
> 
> Weiguang
> === my file ===
> typedef short  InputPixelType;
> 
> typedef itk::Image< InputPixelType, 2 > InputImageType;
> typedef itk::ImageFileReader< InputImageType > ReaderType;
> 
> ReaderType::Pointer reader = ReaderType::New( );
> 
> reader -> SetFileName(filename);
> reader -> Update( );
> 
> InputImageType::Pointer image = reader -> GetOutput( );
> /*--------------------------------------------------------------------------
> --------------
> then how to get the size of the image from the object "image"?
> 
> Also I use MinimumMaximumImageCalculator to get the min and max intensity in
> the image like
> ----------------------------------------------------------------------------
> --------------------------------------------------------------*/
> typedef itk::MinimumMaximumImageCalculator< InputImageType >
> MinMaxCalculatorType;
> MinMaxCalculatorType::Pointer calculator = MinMaxCalculator::New( );
> 
> calculator -> SetImage( image );
> calculator -> compute( );
> InputImageType::PixelType minIntensity = calculator -> GetMinimum( );
> InputImageType::PixelType maxIntensity = calculator -> GetMaximum( );
> /*--------------------------------------------------------------------------
> --------------------------------
>  Is this the direct way to get min and max intensity?
> ----------------------------------------------------------------------------
> -------------------------------*/


More information about the Insight-users mailing list