DICOM V3.0 SOP类作为SCU和SCP提供了的标准遵从性。

SOP Class Name

SOP Class UID

Computed Radiography Image Information Object计算射线照相术图象信息对象

1.2.840.10008.5.1.4.1.1.1

CT Image Information ObjectCT图象信息对象

1.2.840.10008.5.1.4.1.1.2

MR Image Information ObjectMR图象信息对象

1.2.840.10008.5.1.4.1.1.4

Nuclear Medicine Image Information Object核医学图象信息对象

1.2.840.10008.5.1.4.1.1.5

Ultrasound Image Information Object超声图象信息对象

1.2.840.10008.5.1.4.1.1.6

Secondary Capture Image Information Object继发捕获图象信息对象

1.2.840.10008.5.1.4.1.1.7

 
  
  1. int _tmain(int argc, _TCHAR* argv[]) 
  2. typedef unsigned short PixelType; 
  3. const unsigned int Dimension = 3
  4. typedef itk::Image<PixelType,Dimension> ImageType; 
  5. typedef itk::ImageSeriesReader<ImageType> ReaderType; 
  6. ReaderType::Pointer reader = ReaderType::New(); 
  7.  
  8. typedef itk::GDCMImageIO ImageIOType; 
  9. ImageIOType::Pointer dicomIO = ImageIOType::New(); 
  10. reader->SetImageIO(dicomIO); 
  11.  
  12. typedef itk::GDCMSeriesFileNames NamesGeneratorType; 
  13. NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New(); 
  14. nameGenerator->SetInputDirectory("E:\\CT\\serial2");//读取目录 
  15.  
  16. //存储文件名字 
  17. typedef std::vector<std::string> FileNamesContainer; 
  18. FileNamesContainer fileNames = nameGenerator->GetInputFileNames(); 
  19.  
  20. int num = fileNames.size(); 
  21. std::cout<<num<<std::endl
  22.  
  23.  
  24. reader->SetFileNames(fileNames); 
  25. connector->SetInput(reader->GetOutput()); 
  26.  
  27. try 
  28. reader->Update(); 
  29. catch(itk::ExceptionObject &err) 
  30. std::cerr<<"Read Error"<<std::endl
  31. std::cerr<<err<<std::endl
  32. return EXIT_FAILURE; 
  33.  
  34. //create MetaDataDictionary 
  35. typedef itk::MetaDataDictionary DictionaryType; 
  36. const DictionaryType &dictionary = dicomIO->GetMetaDataDictionary(); 
  37.  
  38. typedef itk::MetaDataObject<std::string> MetaDataStringType; 
  39. DictionaryType::ConstIterator itr = dictionary.Begin(); 
  40. DictionaryType::ConstIterator end = dictionary.End(); 
  41.  
  42. while( itr != end ) 
  43. itk::MetaDataObjectBase::Pointer entry = itr->second; 
  44. MetaDataStringType::Pointer entryvalue =  
  45. dynamic_cast<MetaDataStringType *>(entry.GetPointer()); 
  46.  
  47. if(entryvalue) 
  48. std::string tagkey = itr->first; 
  49. std::string tagvalue = entryvalue->GetMetaDataObjectValue(); 
  50. std::cout<<tagkey<<"="<<tagvalue<<std::endl
  51. }/*0002|0002字段可以标识SOP Class UID,如果是CT就是 
  52.  
  53. 1.2.840.10008.5.1.4.1.1.2,如果是MRI就是1.2.840.10008.5.1.4.1.1.4*/ 
  54. ++itr; 
  55.  
  56. } 

 

本文来源:http://buaagc.blog.163.com/blog/static/7278839420110510227639/