【问题标题】:Save a bmp file as dicom using dcmtk使用 dcmtk 将 bmp 文件另存为 dicom
【发布时间】:2016-05-19 03:28:41
【问题描述】:

我有一个 dicom 图像,我使用 DCMTK 将其转换为 tiff 并进行了一些图像处理。我将结果图像保存为 .bmp,但我想知道是否可以将其保存为具有原始源文件所有属性的 .dcm。我的示例代码是:-

    // for converting dcm to tiff//
    ///src_path is the path for the diccom image///
       src_dcm = new DicomImage(src_path);
    if (src_dcm != NULL)
    {
        if (src_dcm->getStatus() == EIS_Normal)
        {
            if (src_dcm->isMonochrome())
            {
                src_dcm->setMinMaxWindow();
                Uint8 *pixelData = (Uint8 *)(src_dcm->getOutputData(16 /* bits */));
                if (pixelData != NULL)
                {
                    src_dcm->writeBMP("source.tiff",24);  /* do something useful with the pixel data */
                }
            }
        }
        else
            cerr << "Error: cannot load DICOM image (" << DicomImage::getString(src_dcm->getStatus()) << ")" << endl;
    }

处理后,我在 IplImage* 掩码中有结果图像。我现在将其保存为 .bmp 但我想将其保存为 .dcm 并包含源 dicom 图像的所有属性(实例编号、xy 列等)。

【问题讨论】:

    标签: c++ c opencv image-processing dcmtk


    【解决方案1】:

    基本上,DicomImage 类的目的是图像处理和渲染(如documentation 所述)。因此,我通常建议使用“dcmdata”模块(而不是“dcmimgle/dcmimage”)提供的功能。但是,DicomImage::writeFrameToDataset()DicomImage::writeImageToDataset() 也有一些助手。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-27
    • 2015-03-28
    • 1970-01-01
    相关资源
    最近更新 更多