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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值