VC生成DICOM文件及 DICOM,DVT,DCMTK开发知识汇总

 1.dicom格式文件下载 

     网络资源:http://pubimage.hcuge.ch:8080/,此网站包含各种机器产生的各种部位的dcm图像资源,另外还有单帧或多帧的,非常好用,
2.dicom标准
  •   权威官方网站: http://medical.nema.org/ 可下载DICOM的标准文档,   但是貌似只有doc和pdf格式的标准文件,不好查询跳转,
  •  另一个html式的dicom标准文档 http://dabsoft.ch/dicom/3  期待离线chm版的dicom标准文档
3.DICOM文件格式校验工具 DVT(DICOM Validateor Tools) 及相关工具 dicom editor(dicom信息编辑,修改工具),dicom Anonymazier (dicom匿名工具)
     
  DVT(DICOM Validateor Tools)安装使用方法:
  •      此工具需要同时下载DVT_2_6_6.0.msi安装包和 Definitions 1.1.10.0.msi 安装包,
  •      把2者都安装上后,注意Definitions.msi的文件安装路径无法更改,会默认安装到 C:\Program Files\Common Files\DVTk 下面,(在此我要强烈那个bs开发者居然不提示路径,害我找半天).
  •      安装好2个包后,启动DVT,新建一个工程,再在工程下新建一个sseion,建sseion时如果校验文件,请选择session type 为Media.其他可不填,选择下一步
  •      这时会提示definitions的路径,此时选择指定definitions的安装目录,并指定results file directory ,这个最好选择一个无用的文件夹,因为校验文件过程中会产生很多中间文件,不想目录混乱不堪的请注意这个项目.
  • 下一步会让你选择一个或多个definition files,这个根据自己需要进行选择,一般需要选择一个File Meta.def 和其他.def文件.
  • 设置好之后,在左侧树列表右键->validate media files 选择一个.dcm 文件进行校验,马上就会看到校验结果.

 
     
4.dicom 文件查看器网上有很多,建议最好找大的,专业些的dicom 查看器,一是权威,二是好用,推荐如下:
     1)DicomLite.exe
     2) MedExplorer.exe
     3) Acculite.exe 
 
 
5.另外提供一个C++代码写的生成dicom文件的代码.使用到dcmtk库,
 
 
   
   
   
   
  1. #include "stdafx.h" 
  2. #include "dcmtk\dcmdata\dctk.h" 
  3. #include "DCMTK\dcmimgle\dcmimage.h" 
  4. using namespace std; 
  5. #pragma comment(linker,"/NOD:LIBCMT") 
  6. #pragma comment(lib, "oflog.lib") 
  7. #pragma comment(lib, "ofstd.lib") 
  8. #pragma comment(lib, "dcmimage.lib") 
  9. #pragma comment(lib, "dcmdata.lib") 
  10. #pragma comment(lib, "oflog.lib") 
  11. #pragma comment(lib, "netapi32.lib") 
  12. #pragma comment(lib, "wsock32.lib") 
  13. int _tmain(int argc, _TCHAR* argv[]) 
  14.        char uid[100]; 
  15.        DcmFileFormat fileformat; 
  16.        DcmMetaInfo *metainfo =    fileformat.getMetaInfo(); 
  17.        DcmDataset *dataset = fileformat.getDataset(); 
  18.         
  19.        //***meta group******/ 
  20.        metainfo->putAndInsertString(DCM_FileMetaInformationVersion,  "us test dcm file"); 
  21.        metainfo->putAndInsertString(DCM_MediaStorageSOPClassUID, UID_RETIRED_UltrasoundImageStorage); 
  22.        metainfo->putAndInsertString(DCM_MediaStorageSOPInstanceUID,       dcmGenerateUniqueIdentifier(uid,SITE_INSTANCE_UID_ROOT)); 
  23.        metainfo->putAndInsertString(DCM_TransferSyntaxUID,           UID_LittleEndianExplicitTransferSyntax); 
  24.        metainfo->putAndInsertString(DCM_ImplementationClassUID,"999.999");   
  25.         
  26.        //***identifying group****/ 
  27.        dataset->putAndInsertString(DCM_ImageType,"ORIGINAL\\PRIMARY\\TEE\\0011"); 
  28.        dataset->putAndInsertString(DCM_SOPClassUID, UID_RETIRED_UltrasoundImageStorage);//UID_SecondaryCaptureImageStorage); 
  29.        dataset->putAndInsertString(DCM_SOPInstanceUID,       dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT)); 
  30.        dataset->putAndInsertString(DCM_StudyID,"398474"); 
  31.        dataset->putAndInsertString(DCM_StudyDate,"20100823"); 
  32.        dataset->putAndInsertString(DCM_StudyTime,"080322"); 
  33.        dataset->putAndInsertString(DCM_Modality,"US");//OT 
  34.         
  35.        dataset->putAndInsertString(DCM_Manufacturer,"ACME product"); 
  36.        dataset->putAndInsertString(DCM_ReferringPhysicianName,"ANONY"); 
  37.        dataset->putAndInsertString(DCM_StudyDescription,"STUDY description"); 
  38.        dataset->putAndInsertString(DCM_SeriesDescription,"SERIES DESCRIPTION"); 
  39.        dataset->putAndInsertString(DCM_StageNumber,"1"); 
  40.        dataset->putAndInsertString(DCM_NumberOfStages,"1"); 
  41.        dataset->putAndInsertString(DCM_ViewNumber,"1"); 
  42.        dataset->putAndInsertString(DCM_NumberOfViewsInStage,"1"); 
  43.        /***patient group*****/ 
  44.        dataset->putAndInsertString(DCM_PatientID, "PatientID"); 
  45.        dataset->putAndInsertString(DCM_PatientName, "PatientName"); 
  46.        dataset->putAndInsertString(DCM_PatientSex, "M"); 
  47.        dataset->putAndInsertString(DCM_PatientBirthDate,"20000302"); 
  48.         
  49.        /************************************************************************/ 
  50.        /* acquisiton group                                                                     */ 
  51.        /************************************************************************/ 
  52.        //DCM_ProtocolName 
  53.        /************************************************************************/ 
  54.        /* relation group                                                                      */ 
  55.        /************************************************************************/ 
  56.        dataset->putAndInsertString(DCM_StudyInstanceUID,"999.999.2.19941105.112000"); 
  57.        dataset->putAndInsertString(DCM_SeriesInstanceUID,"999.999.2.19941105.112000.2"); 
  58.        dataset->putAndInsertString(DCM_SeriesNumber,"2"); 
  59.        dataset->putAndInsertString(DCM_AccessionNumber,"1"); 
  60.        //dataset->putAndInsertString(DCM_InstanceNumber,); 
  61.                
  62.        //调窗 
  63.        //dataset->putAndInsertString(DCM_WindowCenter, "256"); 
  64.        //dataset->putAndInsertString(DCM_WindowWidth, "128"); 
  65.                
  66.        const int width = 256
  67.        const int height = 256
  68.        dataset->putAndInsertString(DCM_InstanceNumber,"1"); 
  69.        //dataset->putAndInsertString(DCM_PatientOrientation,"HFL"); 
  70.        dataset->putAndInsertString(DCM_PhotometricInterpretation,"RGB");     
  71.        dataset->putAndInsertUint16(DCM_SamplesPerPixel,3); 
  72.        dataset->putAndInsertUint16(DCM_BitsAllocated,8); 
  73.        dataset->putAndInsertUint16(DCM_BitsStored,8); 
  74.        dataset->putAndInsertUint16(DCM_HighBit,7); 
  75.        dataset->putAndInsertUint16(DCM_PixelRepresentation,0); 
  76.        dataset->putAndInsertUint16(DCM_PlanarConfiguration,0); 
  77.        dataset->putAndInsertString(DCM_PixelAspectRatio,"4\\3"); 
  78.        dataset->putAndInsertUint16(DCM_Rows,width); 
  79.        dataset->putAndInsertUint16(DCM_Columns,height); 
  80.         
  81.          
  82.        BYTE* pData=new BYTE[width*height*3]; 
  83.        memset(pData, 0, width*height*3); 
  84.        for(int y=0; y < height; y++){ 
  85.               //memset(pData+ y*width*3, y & 0xff0000,width*3); 
  86.               for(int x=0; x<width*3; x++) 
  87.               { 
  88.                      if(x%3==0) 
  89.                            pData[y*width*3+x] = 0xff; 
  90.                      else    
  91.                            pData[y*width*3+x] = rand()%256; 
  92.               } 
  93.        }       
  94.        dataset->putAndInsertUint8Array(DCM_PixelData,pData, width*height*3); 
  95.        delete[] pData; 
  96.        OFCondition status = fileformat.saveFile("d:\\pic\\test.dcm", 
  97.               EXS_LittleEndianImplicit,EET_UndefinedLength,EGL_withoutGL); 
  98.        if (status.bad()) 
  99.        { 
  100.               printf("\n cannot write dicom file"); 
  101.               return false; 
  102.        } 
  103.        return true;     
本文来源: http://blog.csdn.net/jiangsirl/article/details/7522986
 
 

你可能感兴趣的:(VC,DICOM,DCMTK)