我有一个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,但我希望将其与源dicom映像的所有属性(例如umber,xy列等)保存为.dcm。

最佳答案

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

关于c++ - 使用dcmtk将bmp文件另存为dicom,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35287081/

10-11 19:44