0
votes

I have a dicom image which I converted to tiff using DCMTK and have done some image processing. I have the result image as .bmp,But I wanna know if its possible to save it as .dcm with all the properties of the original source file. My sample code is:-

    // 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;
    }

After processing, I have the result image in IplImage* mask. I am now saving it as .bmp but I would like to save it as .dcm with all the properties( instance umber,xy columns,,etc) of the source dicom image.

1

1 Answers

0
votes

Basically, the purpose of the DicomImage class is image processing and rendering (as the documentation states). Therefore, I would usually recommend to use the capabilities provided by the "dcmdata" module (not by "dcmimgle/dcmimage"). However, there are some helpers with DicomImage::writeFrameToDataset() and DicomImage::writeImageToDataset().