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
本文提供了一个使用DCMTK库从DICOM文件中提取Overlay数据的C++示例程序。该程序展示了如何获取并保存Overlay数据为原始位图格式。Overlay用于图像上的标注与对照,例如CT图像中的参照线。
1527

被折叠的 条评论
为什么被折叠?



