当前位置: 首页>>代码示例>>C++>>正文


C++ DcmDataset::findAndGetString方法代码示例

本文整理汇总了C++中DcmDataset::findAndGetString方法的典型用法代码示例。如果您正苦于以下问题:C++ DcmDataset::findAndGetString方法的具体用法?C++ DcmDataset::findAndGetString怎么用?C++ DcmDataset::findAndGetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DcmDataset的用法示例。


在下文中一共展示了DcmDataset::findAndGetString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initImage

void ImageInstance::initImage(const QString &file)
{
    DcmFileFormat dcmFile;
    OFCondition result;

    result = dcmFile.loadFile(file.toLocal8Bit());
    DcmDataset *dset = dcmFile.getDataset();

    if (result.good()) {
        //patient information
        const char *value = NULL;
        result = dset->findAndGetString(DCM_PatientID, value);
        patientID = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_PatientName, value);
        patientName = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_PatientAge, value);
        patientAge = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_PatientBirthDate, value);
        patientBirth = QDate::fromString(QString::fromLocal8Bit(value),
                                         DATE_DICOM_FORMAT);

        result = dset->findAndGetString(DCM_PatientSex, value);
        patientSex = QString::fromLocal8Bit(value);

        //study information
        result = dset->findAndGetString(DCM_StudyInstanceUID, value);
        studyUid = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_StudyDate, value);
        studyTime.setDate(QDate::fromString(QString::fromLocal8Bit(value),
                                            DATE_DICOM_FORMAT));

        result = dset->findAndGetString(DCM_StudyTime, value);
        studyTime.setTime(formatDicomTime(QString::fromLatin1(value)));

        result = dset->findAndGetString(DCM_StudyDescription, value);
        studyDes = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_ProtocolName, value);
        procId = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_BodyPartExamined, value);
        bodyPart = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_Manufacturer, value);
        manufacturer = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_Modality, value);
        modality = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_StationName, value);
        stationName = QString::fromLocal8Bit(value);

        //series information
        result = dset->findAndGetString(DCM_SeriesInstanceUID, value);
        seriesUid = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_SeriesNumber, value);
        seriesNumber = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_SeriesDescription, value);
        seriesDes = QString::fromLocal8Bit(value);

        //instance information
        result = dset->findAndGetString(DCM_SOPClassUID, value);
        sopClassUid = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_SOPInstanceUID, value);
        instanceUid = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_InstanceNumber, value);
        instanceNumber = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_InstitutionName, value);
        institution = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_AcquisitionDate, value);
        if (value==NULL) result = dset->findAndGetString(DCM_ContentDate, value);
        acquisitionTime.setDate(QDate::fromString(QString::fromLatin1(value),
                                                  DATE_DICOM_FORMAT));

        result = dset->findAndGetString(DCM_AcquisitionTime, value);
        if (value==NULL) result = dset->findAndGetString(DCM_ContentTime, value);
        acquisitionTime.setTime(formatDicomTime(QString::fromLatin1(value)));

        result = dset->findAndGetString(DCM_PatientPosition, value);
        patientPostion = QString::fromLatin1(value);

        result = dset->findAndGetString(DCM_RequestingPhysician, value);
        reqPhysician = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_PerformingPhysicianName, value);
        perPhysician = QString::fromLocal8Bit(value);

        result = dset->findAndGetString(DCM_AccessionNumber, value);
        accessionNumber = QString::fromLatin1(value);

//.........这里部分代码省略.........
开发者ID:lonelycoder,项目名称:DROC,代码行数:101,代码来源:imageinstance.cpp

示例2: process

int AddMetaData::process(GadgetContainerMessage<DcmFileFormat> * m1)
{

	DcmFileFormat * dcm = m1->getObjectPtr();

	GadgetContainerMessage<std::string> * f;
	GadgetContainerMessage<ISMRMRD::MetaContainer>* meta;

	if(dcm)
	{	
		f=AsContainerMessage<std::string>(m1->cont());
	}
	else
	{	GERROR("No filename set for DICOM file\n");
		return GADGET_FAIL;
	}
	
	if(f)
	{	
		meta= AsContainerMessage<ISMRMRD::MetaContainer>(f->cont());
	}
	else
	{	
		GERROR("No meta data found for DICOM\n");
		return GADGET_FAIL;
	}

	unsigned int BUFSIZE = 1024;
        char *buf = new char[BUFSIZE];
	const char* checkbuf;
	OFCondition status;
	DcmTagKey key;
	DcmDataset *dataset = dcm->getDataset();

	float rescaleIntercept;//=	meta->getObjectPtr()->as_double(GADGETRON_IMAGE_SCALE_OFFSET);
	float rescaleSlope;//=	meta->getObjectPtr()->as_double(GADGETRON_IMAGE_SCALE_RATIO);


	static bool studyUIDmade=false;
	std::time_t rawtime;
         std::time(&rawtime);
         std::tm *timeinfo = std::localtime(&rawtime);

	if(meta->getObjectPtr()->exists("GADGETRON_IMAGE_SCALE_OFFSET") && meta->getObjectPtr()->exists("GADGETRON_IMAGE_SCALE_RATIO"))
	{
		rescaleIntercept=meta->getObjectPtr()->as_double(GADGETRON_IMAGE_SCALE_OFFSET);
		rescaleIntercept=meta->getObjectPtr()->as_double(GADGETRON_IMAGE_SCALE_OFFSET);
	


	 // Window Center
        key.set(0x0028, 0x1050);
        dataset->remove(key);
        
        // Window Width
        key.set(0x0028, 0x1051);
        dataset->remove(key);

	
	

	rescaleIntercept = -1.0*rescaleIntercept*rescaleSlope;
	
	rescaleSlope= 1.0/rescaleSlope;
	
	key.set(0x0028,0x1052);
	ACE_OS::snprintf(buf, BUFSIZE, "%f", rescaleIntercept);//
	WRITE_DCM_STRING(key, buf);

	key.set(0x0028,0x1053);
	ACE_OS::snprintf(buf, BUFSIZE, "%f", rescaleSlope);//meta->getObjectPtr()->as_double("Intercept"));
	WRITE_DCM_STRING(key, buf);


	key.set(0x0028, 0x0030);
        ACE_OS::snprintf(buf, BUFSIZE, "%.6f\\%.6f", pixel_spacing_Y, pixel_spacing_X);
	WRITE_DCM_STRING(key, buf);
	}


	key.set(0x0008,0x1030); //Study Description
	
	dataset->findAndGetString(key, checkbuf, false);
	if(checkbuf==NULL || !strcmp(checkbuf, "XXXXXXXX"))
	{
		ACE_OS::snprintf(buf, BUFSIZE, "%s", "Gadgetron^IEV");
		WRITE_DCM_STRING(key, buf);
	}


	key.set(0x0008,0x103E); //Series Description
	//if(!dataset->tagExistsWithValue(key))
	//{
		std::string type;
		
		if(meta)
			type=meta->getObjectPtr()->as_str(GADGETRON_DATA_ROLE);
		else
			type="MRI Images";
	
//.........这里部分代码省略.........
开发者ID:TWhelan3,项目名称:PUROR_IEV,代码行数:101,代码来源:AddMetaData.cpp


注:本文中的DcmDataset::findAndGetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。