dcmtk reads the tag value in dicom

Read patient information, etc., can be set freely to read other information according to the macro definition, the code is as follows:

{
    
      
	DcmFileFormat fileformat;
	OFCondition dcmFile = fileformat.loadFile("G:/DXL/DXL_CCTA/1.2.392.200036.9116.2.1220972159.1406529370.671878.1.1_anon.dcm"); //读取Dicom图像

	if (!dcmFile.good()) //判断Dicom文件是否读取成功
	{
    
    
		std::cout << "file Load error" << std::endl;
		return;
	}
	DcmDataset *dataset = fileformat.getDataset(); //得到Dicom的数据集

	OFString patientname;
	dataset->findAndGetOFString(DCM_PatientName, patientname); //获取病人姓名

	qDebug() << "patientname:" << QString::fromStdString(patientname) << endl;

	OFString isRGB;
	dataset->findAndGetOFString(DCM_PhotometricInterpretation, isRGB); // DCM图片的图像模式

	unsigned short bit_count(0);
	dataset->findAndGetUint16(DCM_BitsStored, bit_count); //获取像素的位数 bit
} 

Guess you like

Origin blog.csdn.net/oTianLe1234/article/details/115321816