本帖最后由 medimage 于 2015-12-4 21:27 编辑
八、dcmpstat程序库
dcmpstat: 一个描述状态(presentation state)库和可用工具。This module contains classes that implement a high-level API for the DICOM Softcopy Grayscale Presentation State Storage SOP Class. It also contains various support classes that are used by DICOMscope, a free DICOM viewer that has been developed as a demonstrator for presentation states. See http://dicom.offis.de/dscope。 主要接口: --DVPresentationState: 一个灰度软拷贝描述状态。这个类管理着一个描述状态对象的数据结构。描述状态可以创建、读、写和更改。在dvpstat.h中定义。 --DVInterface: 这个接口类是用来帮助软拷贝描述状态浏览器工作的。这个类管理着数据库机制,允许开始和停止网络交互,并访问图像和描述状态。在dviface.h中定义。 --DVPSStoredPrint: the representation of a Stored Print object。在文件dvpssp.h中定义。 工具: dcmmkcrv: Add 2D curve data to image dcmmklut: Create DICOM look-up tables dcmp2pgm: Read DICOM image and presentation state and render bitmap dcmprscp: DICOM basic grayscale print management SCP dcmprscu: Print spooler for presentation state viewer dcmpschk: Checking tool for presentation states dcmpsmk: Create DICOM grayscale softcopy presentation state dcmpsprt: Read DICOM images and presentation states and render print job dcmpsrcv: Network receive for presentation state viewer dcmpssnd: Network send for presentation state viewer 举例: --给一幅DICOM图像创建一个缺省的描述状态 DcmFileFormat infile; DcmFileFormat outfile; if (infile.loadFile("image.dcm").good()) { DVPresentationState pstate; // presentation state handler if (pstate.createFromImage(*infile.getDataset()).good()) { // serialize presentation state into DICOM data set structure if (pstate.write(*outfile.getDataset(), OFFalse).good()) { // and write to file outfile.saveFile("gsps.dcm", EXS_LittleEndianExplicit); } } }
--应用一个描述状态中的灰度变换管道给一幅DICOM图像
DcmFileFormat imagefile; DcmFileFormat gspsfile; if (imagefile.loadFile("image.dcm").good() && gspsfile.loadFile("gsps.dcm").good()) { DVPresentationState pstate; // presentation state handler if (pstate.read(*gspsfile.getDataset()).good()) // parse gsps object { // attach presentation state to image data if (pstate.attachImage(&imagefile, OFFalse).good()) { const void *pixel; // pointer to pixel data, one byte per pixel unsigned long width; // width of image bitmap unsigned long height; // height of image bitmap if (pstate.getPixelData(pixel, width, height).good()) { /* do something useful with the pixel data */ } pstate.detachImage(); // release connection between GSPS and image } } }
|