dcmtk程序包简介

loading 分享 2026-7-16 下载文档

OFCondition status = fileformat.loadFile(\if (status.good()) {

OFString patientsName;

if (fileformat.getDataset()->findAndGetOFString(DCM_PatientsName, patientsName).good()) {

cout << \} else

cerr << \} else

cerr << \--创建一个DICOM dataset数据集,并保存为文件 char uid[100];

DcmFileFormat fileformat;

DcmDataset *dataset = fileformat.getDataset();

dataset->putAndInsertString(DCM_SOPClassUID, UID_SecondaryCaptureImageStorage); dataset->putAndInsertString(DCM_SOPInstanceUID, dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));

dataset->putAndInsertString(DCM_PatientsName, \/* ... */

dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength); OFCondition status = fileformat.saveFile(\if (status.bad())

cerr << \

--如何为多个文件创建一般目的的DICOMDIR DicomDirInterface dicomdir;

OFCondition status = dicomdir.createNewDicomDir(); if (status.good()) {

while ( /* there are files */ )

dicomdir.addDicomFile( /* current filename */ ); status = dicomdir.writeDicomDir(); if (status.bad())

cerr << \} else

cerr << \------------------------------------------------------------ 四、dcmimgle程序包

dcmimgle是一个图像处理库和可用的工具模块,它包括了对DICOM单色图像的访问和显示。对颜色图像的支持由dcmimage模块提供,对JPEG压缩图像的支持由dcmjpeg模块支持。 主要接口类:

--DicomImage: 为dcmimgle/dcmimage模块提供接口类。主要目的是图像显示。在dcmimage.h中定义。 --DiDisplayFunction: Class to handle hardcopy and softcopy device characteristics file and manage display LUTs (for calibration). 在didispfn.h中定义。

可用工具:

--dcmdspfn: Export standard display curves to a text file

--dcod2lum: Convert hardcopy characteristic curve file to softcopy format --dconvlum: Convert VeriLUM files to DCMTK display files 举例:

--载入一幅DICOM单帧单色图像,并显示其像素数据。 DicomImage *image = new DicomImage(\if (image != NULL) {

if (image->getStatus() == EIS_Normal) {

if (image->isMonochrome()) {

image->setMinMaxWindow();

Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits */)); if (pixelData != NULL) {

/* do something useful with the pixel data */ } } } else

cerr << \<< endl; }

delete image;

五、dcmimage程序包

dcmimage模块为dcmimgle模块提供对彩色图像的支持。对单色图像的支持由dcmimgle提供,对JPEG压缩图像的支持由dcmjpeg模块支持。

主要接口类:

--DicomImage: 在dcmimgle中已介绍。 工具:

--dcm2pnm: Convert DICOM images to PPM/PGM, PNG, TIFF or BMP --dcmquant: Convert DICOM color images to palette color --dcmscale: Scale DICOM images 举例:

--载入一幅DICOM单帧图像(单色或彩色),并显示其像素数据。 #include \/* required to support color images */ /* ... */

DicomImage *image = new DicomImage(\if (image != NULL) {

if (image->getStatus() == EIS_Normal) {

Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits per sample */)); if (pixelData != NULL) {

/* do something useful with the pixel data */ } } else

cerr << \<< endl; }

delete image;


dcmtk程序包简介.doc 将本文的Word文档下载到电脑
搜索更多关于: dcmtk程序包简介 的文档
相关推荐
相关阅读