dcmtk多帧影像转单帧

#include 
void mulTest()
{
    qDebug()<<"mulTest 0";
    QString path=u8"D:/1.3.12.2.1107.5.2.47.179640.2023081511473296234285371.dcm";
    DcmFileFormat* dicomFile=new DcmFileFormat();
    DcmDataset *dset = dicomFile->getDataset();
    OFCondition status = dicomFile->loadFile(path.toLocal8Bit().data());

    unsigned long frameCount = 128;
    qDebug()<<"frameCount is:"<getOriginalXfer(), flags, i, 1);


            char newUID[100];
            dcmGenerateUniqueIdentifier(newUID, SITE_INSTANCE_UID_ROOT);
            DcmMetaInfo *newMetaInfo = newFileFormat.getMetaInfo();
            newMetaInfo->putAndInsertString(DCM_MediaStorageSOPClassUID, UID_MRImageStorage);
            newMetaInfo->putAndInsertString(DCM_MediaStorageSOPInstanceUID, newUID);
            DcmDataset *newDataset = newFileFormat.getDataset();


            // 获取图像像素数据
             const DiPixel* pixelData = dcmImage->getInterData();

             // 将图像像素数据添加到DcmDataset中
             if (pixelData)
             {
                 newDataset->putAndInsertUint8Array(DCM_PixelData, (Uint8*)pixelData->getData(), pixelData->getCount());
             }

            // 复制部分信息和标签
            newDataset->putAndInsertString(DCM_PatientName, "New Patient Name");
            newDataset->putAndInsertString(DCM_Modality, "CT");

            QString name=QString(u8"D:/mul/%1.dcm").arg(i);
            newFileFormat.saveFile(name.toLocal8Bit().data(), EXS_LittleEndianExplicit);

        }
    }
}

目前还有问题,待以后修复

你可能感兴趣的:(qt,算法,开发语言)