DCMTK读取DICOM文件Tag信息

读取单张DICOM文件tag信息:

#include 
#include 
#include 

bool ReadDCMImageInfo(const QString& strPath)
{
	QFileInfo fileInfo(strPath);
	if (!fileInfo.exists()) 
		return false;
	
	QByteArray ba = strPath.toLocal8Bit();
    const char* fileName_str = ba.data();

    DcmFileFormat fileFormat;
    OFFilename fileName_OF(fileName_str);
    OFCondition status = fileFormat.loadFile(fileName_OF);
    DcmDataset* dataSet = fileFormat.getDataset();
    OFString of_Info;
    
    //患者姓名
	if (dataSet->findAndGetOFString(DCM_PatientName, of_Info).bad())
	{
		//Read Patient Name failed
	}
	else
		QString strPatientName = QString::fromLocal8Bit(of_Info.c_str());
    ...
    return true;
    }

参考: https://support.dcmtk.org/docs/mod_dcmdata.html

你可能感兴趣的:(qt,图像处理,c++)