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


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

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


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

示例1: load_dcmFiles

// Load our vtkImageData object from a list of DICOM image filenames...
// http://www.vtk.org/pipermail/vtkusers/2007-August/042635.html
void vtkDicom::load_dcmFiles(QStringList dcm_fileList) {
    DcmFileFormat dcm;
    std::string imgFname;
    std::cout << "vtkdicom: Files/Images(?): " << dcm_fileList.size() << "\n";
    for (int sei = 0; sei < dcm_fileList.size(); ++sei) {
        imgFname = dcm_fileList.at(sei).toLocal8Bit().constData();
        OFCondition status = dcm.loadFile(imgFname.c_str());
        if (!status.good()) {
            std::cout << "    vtkdicom: Error: cannot read file (" << status.text() << ")" << "\n";
            return;
        }
        if (sei == 0) {
            OFString acquisitionNumber, instanceNumber, imagePositionPatient, patientsName;
            DcmDataset *dcmDs = dcm.getDataset();
            dcmDs->findAndGetOFStringArray(DCM_ImagePositionPatient, imagePositionPatient);
            dcmDs->findAndGetOFString(DCM_AcquisitionNumber, acquisitionNumber);
            dcmDs->findAndGetOFString(DCM_InstanceNumber, instanceNumber);
            dcmDs->findAndGetOFString(DCM_PatientName, patientsName);
            std::cout << "vtkdicom: I#, IPP: " << instanceNumber << " - " << imagePositionPatient << "\n";
        }
        dcm.loadAllDataIntoMemory();
        const unsigned short* p = NULL;
        dcm.getDataset()->findAndGetUint16Array(DCM_PixelData, p);

    }
}
开发者ID:umm-mrrc,项目名称:augReality,代码行数:28,代码来源:vtkdicom.cpp

示例2: dumpDicomFile

void vtkDicom::dumpDicomFile(std::string imgFname)
{
    DcmFileFormat dfile;
    OFCondition status = dfile.loadFile(imgFname.c_str());
    if (status.good()) {
        OFString acquisitionNumber, instanceNumber, imagePositionPatient, patientsName;
        dfile.loadAllDataIntoMemory();
        DcmDataset *dcmDs = dfile.getDataset();
        dcmDs->findAndGetOFStringArray(DCM_ImagePositionPatient, imagePositionPatient);
        dcmDs->findAndGetOFString(DCM_AcquisitionNumber, acquisitionNumber);
        dcmDs->findAndGetOFString(DCM_InstanceNumber, instanceNumber);
        dcmDs->findAndGetOFString(DCM_PatientName, patientsName);
        std::cout << "    " << instanceNumber << " - " << imagePositionPatient << "\n";
    } else {
        std::cout << "    Error: cannot read file (" << status.text() << ")" << "\n";
    }
}
开发者ID:umm-mrrc,项目名称:augReality,代码行数:17,代码来源:vtkdicom.cpp

示例3: query_study_series

/*
 * query all seriesinstanceuid's and the number series of a study
 */
int query_study_series(const std::string& studyinstanceuid, const std::string& server, const std::string& local_aet, std::list<std::string>& seriesinstanceuids) {
	DcmDataset query;
	DcmElement* e = NULL;
	
	e = newDicomElement(DCM_QueryRetrieveLevel);
	e->putString("SERIES");
	query.insert(e);

	e = newDicomElement(DCM_StudyInstanceUID);
	e->putString(studyinstanceuid.c_str());
	query.insert(e);

	e = newDicomElement(DCM_SeriesInstanceUID);
	query.insert(e);

	e = newDicomElement(DCM_SeriesNumber);
	query.insert(e);

	e = newDicomElement(DCM_Modality);
	query.insert(e);

	std::cout << "NEW QUERY:" << std::endl;
	query.print(COUT);

	NetClient<FindAssociation> a;
	a.QueryServer(&query, server, local_aet, UID_FINDStudyRootQueryRetrieveInformationModel);

	DcmStack* result = a.GetResultStack();
	DcmDataset* dset;
	OFString ofstr;

	seriesinstanceuids.clear();
	for(int i = 0; i < result->card(); i++) {
		dset = (DcmDataset*)result->elem(i);
		if(dset->findAndGetOFString(DCM_SeriesInstanceUID, ofstr).good()) {
			seriesinstanceuids.push_back(ofstr.c_str());
		}
	}

	std::cout << result->card() << " Responses" << std::endl;
	int count = result->card();

	return count;
}
开发者ID:Debian,项目名称:aeskulap,代码行数:47,代码来源:netquery.cpp

示例4: tstr

bool IODicom<T>::GetAttributes(PGCore::MetaData<T>& oMetaDataObject, const std::string &iFilePath)
{
#ifdef _DEBUG
    LOG0("{ IODicom::GetAttributes");
#endif

    if (iFilePath.empty())
    {
        LOG0("IO/IODicom::GetAttributes Empty filename");
        return false;
    }

#ifdef _PG_GDDCM_


#else
    OFCondition status = m_fileformat.loadFile(iFilePath.c_str());
    if (!status.good())
    {
        LOG2("IO/IODicom::GetAttributes: Cannot read dicom file %s: (%s).", iFilePath.c_str(), status.text());
        return false;
    }

#ifdef _DEBUG
    LOG2("\tIODicom::GetAttributes: Successfully read dicom file %s: (%s).", iFilePath.c_str(), status.text());
#endif

    // read the meta file here
    //LOG1("IO/IOBase::ReadMetaData: File: %s", iMetaFileName.c_str());

    DcmDataset *dataset = m_fileformat.getDataset();
    if (dataset==NULL)
    {
        return false;
    }

    // patient name
    OFString patientsName;
    bool res = dataset->findAndGetOFString(DCM_PatientsName, patientsName).good();
    if (!res)
    {
        LOG0("IO/IODicom::Read: Cannot fetch patient name");
        return false;
    }
    oMetaDataObject.SetPatientName(std::string(patientsName.c_str()));

#ifdef _DEBUG
    LOG1("\tIODicom::Read: Successfully read PatientName: (%s).", patientsName.c_str());
#endif

    // modality
    OFString modalityStr;
    res = dataset->findAndGetOFString(DCM_Modality, modalityStr).good();
    if (!res)
    {
        LOG0("IO/IODicom::Read: Cannot fetch modality");
        return false;
    }
    PGCore::ePGModality modality = 	PGCore::MetaData<T>::StrToModality(modalityStr.c_str());
    oMetaDataObject.SetModality(modality);
#ifdef _DEBUG
    LOG1("\tIODicom::Read: Successfully read Modality: (%s).", modalityStr.c_str());
#endif



    // SOP Class UID
    OFString sopClassUIDStr;
    DcmMetaInfo *metaInfo = m_fileformat.getMetaInfo();
    if (metaInfo)
    {
        metaInfo->findAndGetOFString(DCM_MediaStorageSOPClassUID, sopClassUIDStr);
        PGCore::ePGSOPClass sopClass = 	PGCore::MetaData<T>::StrToSOPClass(sopClassUIDStr.c_str());
        oMetaDataObject.SetSOPClass(sopClass);


        // DCM_TransferSyntaxUID
        OFString transferSyntaxStr;
        res = metaInfo->findAndGetOFString(DCM_TransferSyntaxUID, transferSyntaxStr).good();
        if (!res)
        {
            LOG0("IO/IODicom::Read:Warning: Cannot fetch TransferSyntaxUID");
        } else
        {

            if (!strcmp(kPgTransferSyntaxUIDRawImplicitVRLittleEndian, transferSyntaxStr.c_str()))
            {

                oMetaDataObject.SetMSBFirst(0);

            } else if (!strcmp(kPgTransferSyntaxUIDRawExplicitVRLittle, transferSyntaxStr.c_str()))
            {

                oMetaDataObject.SetMSBFirst(0);

            } else if (!strcmp(kPgTransferSyntaxUIDRawExplicitVRLittle, transferSyntaxStr.c_str()))
            {

                oMetaDataObject.SetMSBFirst(1);

//.........这里部分代码省略.........
开发者ID:yangguang-ecnu,项目名称:smisdk,代码行数:101,代码来源:IODicom.hpp

示例5: retrieve


//.........这里部分代码省略.........
    {
    logger.error ( "Error initializing the network" );
    return false;
    }
  logger.debug ( "Negotiating Association" );
  if ( !scu.negotiateAssociation().good() )
    {
    logger.error ( "Error negotiating association" );
    return false;;
    }

  logger.debug ( "Setting Parameters" );
  // Clear the query
  unsigned long elements = this->parameters->card();
  // Clean it out
  for ( unsigned long i = 0; i < elements; i++ ) 
    {
    this->parameters->remove ( 0ul );
    }
  if ( retriveType == RetrieveSeries )
    {
    this->parameters->putAndInsertString ( DCM_QueryRetrieveLevel, "SERIES" );
    this->parameters->putAndInsertString ( DCM_SeriesInstanceUID, UID.toStdString().c_str() );
    } 
  else
    {
    this->parameters->putAndInsertString ( DCM_QueryRetrieveLevel, "STUDY" );
    this->parameters->putAndInsertString ( DCM_StudyInstanceUID, UID.toStdString().c_str() );  
    }

  logger.debug ( "Sending Move Request" );
  MOVEResponses *responses = new MOVEResponses();
  OFCondition status = scu.sendMOVERequest ( 0, this->parameters, responses );
  if (!status.good())
    {
    logger.error ( "MOVE Request failed: " + QString ( status.text() ) );
    return false;
    }

  logger.debug ( "Find succeded" );

  logger.debug ( "Making Output Directory" );
  QDir directory = QDir( RetrieveDatabase->databaseDirectory() );

  if ( responses->begin() == responses->end() )
    {
    logger.error ( "No responses!" );
    throw std::runtime_error( std::string("No responses!") );
    }

  // Write the responses out to disk
  for ( OFListIterator(FINDResponse*) it = responses->begin(); it != responses->end(); it++ )
    {
    DcmDataset *dataset = (*it)->m_dataset;
    if ( dataset != NULL )
      {
      logger.debug ( "Got a valid dataset" );
      // Save in correct directory
      E_TransferSyntax output_transfersyntax = dataset->getOriginalXfer();
      dataset->chooseRepresentation( output_transfersyntax, NULL );
        
      if ( !dataset->canWriteXfer( output_transfersyntax ) )
        {
        // Pick EXS_LittleEndianExplicit as our default
        output_transfersyntax = EXS_LittleEndianExplicit;
        }
        
      DcmXfer opt_oxferSyn( output_transfersyntax );
      if ( !dataset->chooseRepresentation( opt_oxferSyn.getXfer(), NULL ).bad() )
        {
        DcmFileFormat* fileformat = new DcmFileFormat ( dataset );
          
        // Follow dcmdjpeg example
        fileformat->loadAllDataIntoMemory();
        OFString SOPInstanceUID;
        dataset->findAndGetOFString ( DCM_SOPInstanceUID, SOPInstanceUID );
        QFileInfo fi ( directory, QString ( SOPInstanceUID.c_str() ) );
        logger.debug ( "Saving file: " + fi.absoluteFilePath() );
        status = fileformat->saveFile ( fi.absoluteFilePath().toStdString().c_str(), opt_oxferSyn.getXfer() );
        if ( !status.good() )
          {
          logger.error ( "Error saving file: " + fi.absoluteFilePath() + " Error is " + status.text() );
          }

        RetrieveDatabase->insert( dataset, true );
          
        delete fileformat;
        }
      }
    }


  delete responses;
  //if ( !scu.dropNetwork().good() ) 
    //{
    //logger.error ( "Error dropping the network" );
    //return false;
    //}
  return true;
}
开发者ID:mcaylus,项目名称:CTK,代码行数:101,代码来源:ctkDICOMRetrieve.cpp

示例6: findSCU

OFCondition FindAssociation::findSCU(T_ASC_Association *assoc, DcmDataset *query)
{
        OFCondition cond;
        DIC_US msgId = assoc->nextMsgID++;
        T_ASC_PresentationContextID presId;
        T_DIMSE_C_FindRQ req;
        T_DIMSE_C_FindRSP rsp;
        DcmDataset *statusDetail = NULL;
        std::string errorMessage;

        if (query == NULL) {
                return makeOFCondition(OFM_dcmnet, DIMSEC_BADDATA, OF_error, "NULL DIMSE Query");
        }

        DeleteResultStack();

        /* which presentation context should be used */
        presId = ASC_findAcceptedPresentationContextID(assoc, m_abstractSyntax.c_str());
        if (presId == 0) {
                LOG_ERROR(ambitolog, "Invalid PresentationContextId");
                return DIMSE_NOVALIDPRESENTATIONCONTEXTID;
        }

        req.MessageID = msgId;
        req.DataSetType = DIMSE_DATASET_PRESENT;
        req.Priority = DIMSE_PRIORITY_LOW;
        strncpy(req.AffectedSOPClassUID, m_abstractSyntax.c_str(), DIC_UI_LEN);
        req.AffectedSOPClassUID[DIC_UI_LEN] = 0;

        FindCallbackInfo callbackData;
        callbackData.pCaller = this;
        callbackData.assoc = assoc;

        cond = DIMSE_findUser(assoc, presId, &req, query,
                              findCallback, (void*) &callbackData,
                              (m_timeout == 0) ? DIMSE_BLOCKING : DIMSE_NONBLOCKING,
                              m_timeout,
                              &rsp, &statusDetail);

        if(rsp.DimseStatus != STATUS_Success && rsp.DimseStatus != STATUS_Pending) {
                std::ostringstream os;
                os << DU_cfindStatusString(rsp.DimseStatus);
                if (statusDetail != NULL) {
                        OFString errorComment;
                        if (statusDetail->findAndGetOFString(DCM_ErrorComment, errorComment).good()) {
                                os << ". " << errorComment.c_str();
                        }
                }
                errorMessage = os.str();
        }

        if (cond == EC_Normal) {
                if (rsp.DimseStatus == STATUS_Success) {
                }
        }

        if (statusDetail != NULL) {
                LOG_DEBUG(ambitolog, "DIMSE_findUser(): Status: " << std::endl << DumpDataset(statusDetail));
                delete statusDetail;
        }

        if (rsp.DimseStatus != STATUS_Success && rsp.DimseStatus != STATUS_Pending) {
                return makeOFCondition(OFM_dcmnet, 18, OF_error, errorMessage.c_str());
        }

        return cond;
}
开发者ID:151706061,项目名称:ginkgocadx,代码行数:67,代码来源:dicomfindassociation.cpp


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