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

DCMTK在一个序列图像中插入一项

阅读更多

 

Howto: Add an item to a sequence

The following example shows, how to add a new item and the required UIDs to the Referenced Image Sequence.

This also works if there was previously no Referenced Image Sequence in the image file test.dcm.

#include "dcmtk/config/osconfig.h" 
#include "dcmtk/dcmdata/dctk.h"
 
int main(int argc, char *argv[]) 
{
    DcmFileFormat fileformat;
    if (fileformat.loadFile("test.dcm").good())
    {
        DcmItem *item = NULL;
        DcmDataset *dataset = fileformat.getDataset();
        if (dataset->findOrCreateSequenceItem(DCM_ReferencedImageSequence, item, -2 /* append */).good())
        {
            item->putAndInsertString(DCM_ReferencedSOPClassUID, UID_SecondaryCaptureImageStorage);
            item->putAndInsertString(DCM_ReferencedSOPInstanceUID, "1.2.276.0.7230010.3.1.4.1787205428.14833.1256718852.966062");
            fileformat.saveFile("test_out.dcm");
        }
    }
    return 0;
}
 
转载:http://support.dcmtk.org/wiki/dcmtk/howto/addsequenceitem
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics