0
我有一個dicom圖像,我使用DCMTK轉換爲tiff並完成了一些圖像處理。我將結果圖像設置爲.bmp,但是我想知道是否可以將其保存爲.dcm以及原始源文件的所有屬性。我的示例代碼是: -使用dcmtk保存爲dicom的bmp文件
// 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 * mask中顯示結果圖像。我現在將它保存爲.bmp,但我想將它保存爲.dcm,其中包含源dicom圖像的所有屬性(實例,xy列等)。
@ j.Riesmeier-你可以請看看這個: http://stackoverflow.com/questions/35625269/overwrite-an-image-pixel-data-in-the-dicom-file-using-dcmtk 我已經給出了一個更詳細的想法,我需要什麼。親切地通過它。 –