如何向 dicom 图像添加文本/注释

问题描述 投票:0回答:0

需要帮助。我想在 dicom 图像上添加文本。如何才能做到这一点? 文本输出示例(enter image description here)

根据发现的示例https://support.dcmtk.org/redmine/projects/dcmtk/wiki/Howto_AddSequenceItem,我试图想出一些东西,但在标签中感到困惑。图片上没有文字输出

#include "dcmtk/config/osconfig.h" 
#include "dcmtk/dcmdata/dctk.h" 

#define PRIVATE_CREATOR_NAME "Your Company Name" 
#define PRIVATE_CREATOR_TAG  0x0029, 0x0010
#define PRV_PrivateCreator   DcmTag(PRIVATE_CREATOR_TAG)

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_GraphicAnnotationSequence, item, -2 /* append */).good())
        {
            item->putAndInsertString(PRV_PrivateCreator/*a new tag, as an example*/, PRIVATE_CREATOR_NAME);
            item->putAndInsertString(DCM_UnformattedTextValue, "output message");
        }
        DcmItem *i = NULL;
        if(dataset->findOrCreateSequenceItem(DCM_BoundingBoxBottomRightHandCorner, i, -2).good())
        {
            i->putAndInsertString(DCM_UnformattedTextValue, "output message");
            i->putAndInsertUint16(DCM_Rows, 10);
            i->putAndInsertUint16(DCM_Columns, 10);
        }
        fileformat.saveFile("test_out.dcm");
    }
    return 0;
}
c++ annotations tags dicom dcmtk
© www.soinside.com 2019 - 2024. All rights reserved.