[Insight-users] DICOM Slices : Number of files read

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Feb 8 13:52:46 EST 2007


K. Subburaj wrote:
> Hi,
> 
> I need to know how to get the "number of slices stacked" while reading
> bunch of DICOM Images (single series number) from a directory.
> 
> Can anyone help me to get answer?

Hi SUbbu,

	Are you looking for the number of slices that will be read ? I believe 
you can simply count the number of filenames in the output of the 
itk::GDCMSeriesFileNames

   typedef itk::GDCMSeriesFileNames                SeriesFileNames;
   SeriesFileNames::Pointer it = SeriesFileNames::New();
   it->SetInputDirectory( argv[1] );
   const ReaderType::FileNamesContainer & filenames = 
it->GetInputFileNames();
   unsigned int numberOfFilenames =  filenames.size();
   std::cout << numberOfFilenames << std::endl;


HTH
-Mathieu


More information about the Insight-users mailing list