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


C++ OFCondition类代码示例

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


在下文中一共展示了OFCondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: IsFileValid

bool DicomImporter::IsFileValid(const String& _file)
{
	try
	{
		//
		// create the dicom fileformat and check if this is possible
		//
		DcmFileFormat ff;
		OFCondition cond = ff.loadFile(_file.c_str());
		if (cond.bad()) return false;
	    
		//
		// ist it in part 10 format (does meta-header exist)?
		//
		DcmMetaInfo *m = ff.getMetaInfo();
		if (m == NULL || m->card() == 0) return false;

		//
		// does the file contain data (does the dataset exist)?
		//
		DcmDataset *d = ff.getDataset();
		if (d == NULL) return false;

		//
		// yes, it is a valid dicom file!
		//
		return true;
	}
	catch (...)
	{
		throw;
	}
}
开发者ID:twissmueller,项目名称:dicmlib,代码行数:33,代码来源:DicomImporter.cpp

示例3:

bool
ParserDicom::isValidFile(string filename)
{
    DcmFileFormat dcm;
    OFCondition cond = dcm.loadFile(filename.c_str());
    return cond.good();
}
开发者ID:jjalageas,项目名称:cpMoteur3D,代码行数:7,代码来源:ParserDicom.cpp

示例4: DIMSE_moveProvider

  OFCondition Internals::moveScp(T_ASC_Association * assoc, 
                                 T_DIMSE_Message * msg, 
                                 T_ASC_PresentationContextID presID,
                                 IMoveRequestHandler& handler,
                                 const std::string& remoteIp,
                                 const std::string& remoteAet,
                                 const std::string& calledAet)
  {
    MoveScpData data;
    data.target_ = std::string(msg->msg.CMoveRQ.MoveDestination);
    data.lastRequest_ = NULL;
    data.handler_ = &handler;
    data.remoteIp_ = &remoteIp;
    data.remoteAet_ = &remoteAet;
    data.calledAet_ = &calledAet;

    OFCondition cond = DIMSE_moveProvider(assoc, presID, &msg->msg.CMoveRQ, 
                                          MoveScpCallback, &data,
                                          /*opt_blockMode*/ DIMSE_BLOCKING, 
                                          /*opt_dimse_timeout*/ 0);

    // if some error occured, dump corresponding information and remove the outfile if necessary
    if (cond.bad())
    {
      OFString temp_str;
      LOG(ERROR) << "Move SCP Failed: " << cond.text();
    }

    return cond;
  }
开发者ID:ming-hai,项目名称:orthanc,代码行数:30,代码来源:MoveScp.cpp

示例5: copyStringWithDefault

 // copy optional string value from dataset to directory record
 static void copyStringWithDefault(DcmItem& dataset,
                                   const DcmTagKey &key,
                                   DcmDirectoryRecord& record,
                                   const char *defaultValue,
                                   const OFBool printWarning)
 {
     OFCondition status;
     if (dataset.tagExistsWithValue(key))
     {
       OFString stringValue;
       /* retrieve string value from source dataset and put it into the destination dataset */
       status = dataset.findAndGetOFStringArray(key, stringValue);
       if (status.good())
         status = record.putAndInsertString(key, stringValue.c_str());
     } else {
       if (printWarning && (defaultValue != NULL))
       {
         /* create warning message */
         LOG(WARNING) << "DICOMDIR: " << DcmTag(key).getTagName() << " "
                      << key << " missing, using alternative: " << defaultValue;
       }
       /* put default value */
       status = record.putAndInsertString(key, defaultValue);
     }
 }
开发者ID:milhcbt,项目名称:OrthancMirror,代码行数:26,代码来源:DicomDirWriter.cpp

示例6: copyElement

 // copy element from dataset to directory record
 static void copyElement(DcmItem& dataset,
                         const DcmTagKey &key,
                         DcmDirectoryRecord& record,
                         const OFBool optional,
                         const OFBool copyEmpty)
 {
   /* check whether tag exists in source dataset (if optional) */
   if (!optional || (copyEmpty && dataset.tagExists(key)) || dataset.tagExistsWithValue(key))
   {
     DcmElement *delem = NULL;
     /* get copy of element from source dataset */
     OFCondition status = dataset.findAndGetElement(key, delem, OFFalse /*searchIntoSub*/, OFTrue /*createCopy*/);
     if (status.good())
     {
       /* ... and insert it into the destination dataset (record) */
       status = record.insert(delem, OFTrue /*replaceOld*/);
       if (status.good())
       {
         DcmTag tag(key);
         /* check for correct VR in the dataset */
         if (delem->getVR() != tag.getEVR())
         {
           /* create warning message */
           LOG(WARNING) << "DICOMDIR: possibly wrong VR: "
                        << tag.getTagName() << " " << key << " with "
                        << DcmVR(delem->getVR()).getVRName() << " found, expected "
                        << tag.getVRName() << " instead";
         }
       } else
         delete delem;
     } else if (status == EC_TagNotFound)
       status = record.insertEmptyElement(key);
     printAttributeErrorMessage(key, status, "insert");
   }
 }
开发者ID:milhcbt,项目名称:OrthancMirror,代码行数:36,代码来源:DicomDirWriter.cpp

示例7: PACSConnection

PACSRequestStatus::RetrieveRequestStatus RetrieveDICOMFilesFromPACS::retrieve(const QString &studyInstanceUID, const QString &seriesInstanceUID, const QString &sopInstanceUID)
{
    T_ASC_PresentationContextID presentationContextID;
    T_DIMSE_C_MoveRSP moveResponse;
    DcmDataset *statusDetail = NULL;
    m_pacsConnection = new PACSConnection(m_pacs);
    PACSRequestStatus::RetrieveRequestStatus retrieveRequestStatus;
    MoveSCPCallbackData moveSCPCallbackData;
    DcmDataset *dcmDatasetToRetrieve = getDcmDatasetOfImagesToRetrieve(studyInstanceUID, seriesInstanceUID, sopInstanceUID);
    m_numberOfImagesRetrieved = 0;

    // TODO S'hauria de comprovar que es tracti d'un PACS amb el servei de retrieve configurat
    if (!m_pacsConnection->connectToPACS(PACSConnection::RetrieveDICOMFiles))
    {
        ERROR_LOG("S'ha produit un error al intentar connectar al PACS per fer un retrieve. AE Title: " + m_pacs.getAETitle());
        return PACSRequestStatus::RetrieveCanNotConnectToPACS;
    }

    // Which presentation context should be used, It's important that the connection has MoveStudyRoot level
    T_ASC_Association *association = m_pacsConnection->getConnection();
    presentationContextID = ASC_findAcceptedPresentationContextID(association, MoveAbstractSyntax);
    if (presentationContextID == 0)
    {
        ERROR_LOG("No s'ha trobat cap presentation context valid");
        return PACSRequestStatus::RetrieveFailureOrRefused;
    }

    moveSCPCallbackData.association = association;
    moveSCPCallbackData.presentationContextId = presentationContextID;
    moveSCPCallbackData.retrieveDICOMFilesFromPACS = this;

    // Set the destination of the images to us
    T_DIMSE_C_MoveRQ moveRequest = getConfiguredMoveRequest(association);
    ASC_getAPTitles(association->params, moveRequest.MoveDestination, NULL, NULL);

    OFCondition condition = DIMSE_moveUser(association, presentationContextID, &moveRequest, dcmDatasetToRetrieve, moveCallback, &moveSCPCallbackData,
                                           DIMSE_BLOCKING, 0, m_pacsConnection->getNetwork(), subOperationCallback, this, &moveResponse, &statusDetail,
                                           NULL /*responseIdentifiers*/);

    if (condition.bad())
    {
        ERROR_LOG(QString("El metode descarrega no ha finalitzat correctament. Codi error: %1, descripcio error: %2").arg(condition.code())
                     .arg(condition.text()));
    }

    m_pacsConnection->disconnect();

    retrieveRequestStatus = getDIMSEStatusCodeAsRetrieveRequestStatus(moveResponse.DimseStatus);
    processServiceClassProviderResponseStatus(moveResponse.DimseStatus, statusDetail);
    
    // Dump status detail information if there is some
    if (statusDetail != NULL)
    {
        delete statusDetail;
    }

    delete dcmDatasetToRetrieve;

    return retrieveRequestStatus;
}
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:60,代码来源:retrievedicomfilesfrompacs.cpp

示例8: subOperationCallback

void RetrieveDICOMFilesFromPACS::subOperationCallback(void *subOperationCallbackData, T_ASC_Network *associationNetwork, T_ASC_Association **subAssociation)
{
    RetrieveDICOMFilesFromPACS *retrieveDICOMFilesFromPACS = (RetrieveDICOMFilesFromPACS*)subOperationCallbackData;
    if (associationNetwork == NULL)
    {
        // Help no net !
        return;
    }

    if (*subAssociation == NULL)
    {
        OFCondition condition = retrieveDICOMFilesFromPACS->acceptSubAssociation(associationNetwork, subAssociation);
        if (!condition.good())
        {
            ERROR_LOG("S'ha produit un error negociant l'associacio de la connexio DICOM entrant, descripcio error: " + QString(condition.text()));
        }
        else
        {
            INFO_LOG("Rebuda solicitud de connexio pel port de connexions DICOM entrants del PACS.");
        }
    }
    else
    {
        retrieveDICOMFilesFromPACS->subOperationSCP(subAssociation);
    }
}
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:26,代码来源:retrievedicomfilesfrompacs.cpp

示例9: LOG

void
LocalService::SolveFile( 
  const boost::filesystem::path & fileName, const boost::filesystem::path & path,
  ResultSet &result)
{
  OFString ofStr;

  DcmFileFormat dfile;
  OFCondition cond = dfile.loadFile( fileName.string().data());
  if (! cond.good())
  {
    LOG( "Loading of " << fileName << " failed. ("  << cond.text() << ")" );
    return;
  }

  DcmDataset *dataSet = dfile.getDataset();

  TableRow row;
  SerieInfo serInfo;

  // load data and check if it is already in tree
  CheckDataSet( dataSet, serInfo, row, path.string());

  // look if this row is already in resultSet
  FoundStudiesSet::iterator found = m_alreadyFoundInRun.find(row.studyID);
  // if not, add it
  if( found == m_alreadyFoundInRun.end() )
  {
    m_alreadyFoundInRun.insert( FoundStudiesSet::value_type( row.studyID) );
    result.push_back( row);
  }
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:32,代码来源:LocalService.cpp

示例10: Q_D

//------------------------------------------------------------------------------
void ctkDICOMDatabase::loadFileHeader (QString fileName)
{
  Q_D(ctkDICOMDatabase);
  DcmFileFormat fileFormat;
  OFCondition status = fileFormat.loadFile(fileName.toLatin1().data());
  if (status.good())
    {
    DcmDataset *dataset = fileFormat.getDataset();
    DcmStack stack;
    while (dataset->nextObject(stack, true) == EC_Normal)
      {
      DcmObject *dO = stack.top();
      if (dO->isaString())
        {
        QString tag = QString("%1,%2").arg(
            dO->getGTag(),4,16,QLatin1Char('0')).arg(
            dO->getETag(),4,16,QLatin1Char('0'));
        std::ostringstream s;
        dO->print(s);
        d->LoadedHeader[tag] = QString(s.str().c_str());
        }
      }
    }
  return;
}
开发者ID:jhnstrk,项目名称:CTK,代码行数:26,代码来源:ctkDICOMDatabase.cpp

示例11: dcmModelInternal

// Caller is responsible for deallocating returned object
AnnotationCollection* DcmModel::ReadAnnotationCollectionFromFile(const std::string& fileName){
	DcmModelInternal dcmModelInternal(_uidPrefix);

	AnnotationCollection* pCollection = NULL;
	try
	{
		OFCondition ofCondition = dcmModelInternal.ReadDocFromFile(&pCollection, fileName);
		if (!ofCondition.good())
		{
			if (pCollection){
				delete pCollection;
				pCollection = NULL;
			}
			std::string err = std::string("Failed to load SR from file <").append(fileName).append(">:");
			err += ofCondition.text();
			dcmModelInternal.printDebug(std::string(__FILE__).append(": ").append(err).c_str());
		}
	}
	catch(const std::exception& ex)
	{
		std::string err = std::string("Error loading SR from file<").append(fileName).append(">:");
		err += ex.what();
		dcmModelInternal.printDebug(err.c_str());
	}
	return pCollection;
}
开发者ID:Bella31,项目名称:annotation-and-image-markup,代码行数:27,代码来源:DcmModel.cpp

示例12: DIMSE_findProvider

  OFCondition Internals::findScp(T_ASC_Association * assoc, 
                                 T_DIMSE_Message * msg, 
                                 T_ASC_PresentationContextID presID,
                                 IFindRequestHandler* findHandler,
                                 IWorklistRequestHandler* worklistHandler,
                                 const std::string& remoteIp,
                                 const std::string& remoteAet,
                                 const std::string& calledAet)
  {
    FindScpData data;
    data.lastRequest_ = NULL;
    data.findHandler_ = findHandler;
    data.worklistHandler_ = worklistHandler;
    data.remoteIp_ = &remoteIp;
    data.remoteAet_ = &remoteAet;
    data.calledAet_ = &calledAet;

    OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ, 
                                          FindScpCallback, &data,
                                          /*opt_blockMode*/ DIMSE_BLOCKING, 
                                          /*opt_dimse_timeout*/ 0);

    // if some error occured, dump corresponding information and remove the outfile if necessary
    if (cond.bad())
    {
      OFString temp_str;
      LOG(ERROR) << "Find SCP Failed: " << cond.text();
    }

    return cond;
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:31,代码来源:FindScp.cpp

示例13: CanReadFile

bool DCMTKImageIO::CanReadFile(const char* filename)
{
    DcmFileFormat dicomFile;
    OFCondition condition = dicomFile.loadFile( filename );
    if ( !condition.good() ) {
        return false;
    }

    E_TransferSyntax xfer = dicomFile.getDataset()->getOriginalXfer();

    if( xfer == EXS_JPEG2000LosslessOnly ||
        xfer == EXS_JPEG2000 ||
        xfer == EXS_JPEG2000MulticomponentLosslessOnly ||
        xfer == EXS_JPEG2000Multicomponent ) {
        return false;
    }

    // search for mandatory tags
    DcmStack stack;
    DcmTagKey searchKey;
    unsigned int group = 0x0028; // samples per pixel
    unsigned int elem  = 0x0002; // samples per pixel

    searchKey.set(group, elem);
    if (dicomFile.search(searchKey, stack, ESM_fromHere, OFTrue) != EC_Normal)
        return false;

    group = 0x0028; // pixel type
    elem  = 0x0100; // pixel type
    searchKey.set(group, elem);
    if (dicomFile.search(searchKey, stack, ESM_fromHere, OFTrue) != EC_Normal)
        return false;

    return true;
}
开发者ID:fvichot,项目名称:medInria-public,代码行数:35,代码来源:itkDCMTKImageIO.cpp

示例14: toSeriesInstanceUIDContainer

Series::InstanceUIDContainer Series::toSeriesInstanceUIDContainer(OFList< QRResponse* > responses)
{
    InstanceUIDContainer instanceUIDContainer;

    OFIterator< QRResponse* > it;
    DcmDataset dataset;
    OFCondition result;
    // Every while loop run will get all image for a specific study
    for (it = responses.begin(); it != responses.end(); ++it)
    {
        // Be sure we are not in the last response which does not have a dataset
        if ((*it)->m_dataset != NULL)
        {
            OFString seriesInstanceUID;
            result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesInstanceUID, seriesInstanceUID);
            // Only try to get study if we actually have study instance uid, otherwise skip it
            if (result.good())
            {
                instanceUIDContainer.push_back(seriesInstanceUID.c_str());
            }
            else
            {
                const std::string msg = "There is no \"SeriersInstanceUID\" tag in the selected series :"
                                        + std::string(result.text());
                throw ::fwPacsIO::exceptions::TagMissing(msg);
            }
        }
    }


    return instanceUIDContainer;
}
开发者ID:fw4spl-org,项目名称:fw4spl,代码行数:32,代码来源:Series.cpp

示例15: dir

    bool DicomdirLoader::load(const std::string &studyinstanceuid, const Glib::ustring &dicomdir) {
        DcmDicomDir dir(dicomdir.c_str());
        OFCondition ret;

        if (busy() ) {
            return false;
        }

        if ( (ret=dir.error()) != EC_Normal ) {
            std::cout << "DicomdirLoader::load Error: " << ret.text() << std::endl;
            return false;
        }

        // Open DICOMDIR and look for StudyInstanceUID
        // Add all IMAGE record types to m_FileList and fill cache
        // FileLoader::Start
        DcmDirectoryRecord *studyRec = find_study(studyinstanceuid, dir);
        if ( !studyRec ) {
            std::cout << "DicomdirLoader::load Error: cannot find study" << std::endl;
            return false;
        }

        m_filelist = new std::list< Glib::ustring >;
        m_cache.clear();
        if ( !scan_study(studyinstanceuid, studyRec, dicomdir) ) {
            std::cout << "DicomdirLoader::load: no visible images" << std::endl;
            return false;
        }

        FileLoader::start();

        return true;

    }
开发者ID:hsanjuan,项目名称:aeskulap,代码行数:34,代码来源:dicomdirloader.cpp


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