`
qimo601
  • 浏览: 3418507 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

DCMTK提取Overlay Data

阅读更多

 

Howto: Extract Overlay Data

Here's an example that shows how it works in principle:

Source Code

 

#include "dcmtk/config/osconfig.h" 
#include "dcmtk/dcmimgle/dcmimage.h" 
 
int main(int argc, char *argv[]) 
{ 
    DicomImageClass::setDebugLevel(0xff); 
    DicomImage img("overlay_image.dcm"); 
    if (img.getStatus() == EIS_Normal)    
    { 
#ifdef EXPORT_FULL_OVERLAY 
        unsigned int width, height; 
        /* create bitmap (1 bit) for first overlay plane */
        Uint8 *data = (Uint8 *)img.getFullOverlayData(0, width, height, 0, 1, 0, 1); 
        const size_t size = (size_t)((width * height + 7) / 8); 
#else 
        unsigned int left, top, width, height; 
        EM_Overlay mode; 
        /* create bitmap (8 bit) for first overlay plane, cropped to image size */
        Uint8 *data = (Uint8 *)img.getOverlayData(0, left, top, width, height, mode); 
        const size_t size = (size_t)(width * height); 
#endif 
        if (data != NULL) 
        { 
            COUT << "overlay: " << width << " / " << height << OFendl; 
            /* write overlay data (bitmap) to a file */
            FILE *file = fopen("overlay.raw", "wb"); 
            if (file != NULL) 
            { 
                fwrite(data, size, 1, file); 
                fclose(file); 
            } 
        } else 
            CERR << "no such overlay plane" << OFendl; 
    } 
    return 0; 
}

Note:

 

A.1.2.7 OVERLAY IE 

The Overlay IE defines the Attributes that describe an independent set of Overlay Planes. The Overlay IE may represent in a bit-map format, graphics or text and is used to indicate such items as region of interest, reference marks and annotations. Sufficient information shall be available to allow an overlay to be presented at a display station superimposed on a particular image with which it is associated. An Overlay IE shall be related to only one Series IE. 

An Overlay Plane may be represented as a single frame (when associated with a single frame image) or as multiple frames of overlay planes (when associated with a Multi-frame image). 

 

OVERLAY是用来做标注和对照作用如CT参照线

 

 

------------------------------------------------------------------

柳北风儿

http://qimo601.iteye.com

转载:http://support.dcmtk.org/wiki/dcmtk/howto/overlaydata

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics