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


C++ OFString类代码示例

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


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

示例1: GetKey

const char* Association::GetKey(DcmDataset* query, const DcmTagKey& tag) {
	OFString val;
	static char buffer[129];
	query->findAndGetOFString(tag, val, 0, OFTrue);
	strncpy(buffer, val.c_str(), sizeof(buffer));
	return buffer;
}
开发者ID:hsanjuan,项目名称:aeskulap,代码行数:7,代码来源:poolassociation.cpp

示例2: GetDicomFormatedDate

std::string Date::GetDicomFormatedDate() const
{
	OFString formattedDate;
	AIMUtil::DateConvert(*this).getISOFormattedDate(formattedDate, false); // can be empty

	return formattedDate.c_str();
}
开发者ID:StevenNicklin,项目名称:AIMToolkit,代码行数:7,代码来源:DateTime.cpp

示例3: 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

示例4: GetDicomFormatedTime

std::string Time::GetDicomFormatedTime() const
{
	OFString formattedTime;
	AIMUtil::TimeConvert(*this).getISOFormattedTime(formattedTime, true, false, false, false); // can be empty

	return formattedTime.c_str();
}
开发者ID:StevenNicklin,项目名称:AIMToolkit,代码行数:7,代码来源:DateTime.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: FillInstance

    void FillInstance(DcmDirectoryRecord& record,
                      DcmItem& dicom,
                      DcmMetaInfo& metaInfo,
                      const char* path)
    {
      // cf. "DicomDirInterface::buildImageRecord()"

      /* copy attribute values from dataset to image record */
      copyElementType1(dicom, DCM_InstanceNumber, record);
      //copyElementType1C(dicom, DCM_ImageType, record);
      copyElementType1C(dicom, DCM_ReferencedImageSequence, record);

      OFString tmp;

      DcmElement* item = record.remove(DCM_ReferencedImageSequence);
      if (item != NULL)
      {
        delete item;
      }

      if (record.putAndInsertString(DCM_ReferencedFileID, path).bad() ||
          dicom.findAndGetOFStringArray(DCM_SOPClassUID, tmp).bad() ||
          record.putAndInsertString(DCM_ReferencedSOPClassUIDInFile, tmp.c_str()).bad() ||
          dicom.findAndGetOFStringArray(DCM_SOPInstanceUID, tmp).bad() ||
          record.putAndInsertString(DCM_ReferencedSOPInstanceUIDInFile, tmp.c_str()).bad() ||
          metaInfo.findAndGetOFStringArray(DCM_TransferSyntaxUID, tmp).bad() ||
          record.putAndInsertString(DCM_ReferencedTransferSyntaxUIDInFile, tmp.c_str()).bad())
      {
        throw OrthancException(ErrorCode_BadFileFormat);
      }
    }
开发者ID:milhcbt,项目名称:OrthancMirror,代码行数:31,代码来源:DicomDirWriter.cpp

示例7:

void
FindService::WholeStudyInfoCallback(
        void *callbackData,
        T_DIMSE_C_FindRQ * /*request*/,
        int /*responseCount*/,
        T_DIMSE_C_FindRSP * /*rsp*/,
        DcmDataset *responseIdentifiers
        )
    /*
     * This function.is used to indicate progress when findscu receives search results over the
     * network. This function will simply cause some information to be dumped to stdout.
     *
     * Parameters:
     *   callbackData        - [in] data for this callback function
     *   request             - [in] The original find request message.
     *   responseCount       - [in] Specifies how many C-FIND-RSP were received including the current one.
     *   rsp                 - [in] the C-FIND-RSP message which was received shortly before the call to
     *                              this function.
     *   responseIdentifiers - [in] Contains the record which was received. This record matches the search
     *                              mask of the C-FIND-RQ which was sent.
     */
{
	OFString str;
	std::string imageID;
	std::string setID;

	// Parse the response
	responseIdentifiers->findAndGetOFString( DCM_SOPInstanceUID, str);
	imageID = str.c_str();
	responseIdentifiers->findAndGetOFString( DCM_SeriesInstanceUID, str);
	setID = str.c_str();

	// get container that recieved values should go into
	StudyInfo *setInfo = 
		static_cast<StudyInfo*>(callbackData);

	StringVector *setImages;
	// try to find if there is already just recieved setID within the container
	StudyInfo::iterator it = 
		setInfo->find( setID);
	
	if( it == setInfo->end() )
	{
		// create new StringVector & insert it into setInfo
		StringVector buddy;
		setInfo->insert( 
			StudyInfo::value_type( setID, buddy) );
		setImages = &setInfo->find( setID)->second;
	}	
	else
	{
		setImages = &it->second;
	}

	// insert imageID
	setImages->push_back( imageID);
  D_PRINT( "Next record into study info arrived ...");
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:58,代码来源:FindService.cpp

示例8: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(SetEmpty, Fixture)
{
    odil::dcmtk::ElementAccessor<std::string>::set(this->dataset, DCM_PatientName, "FOO");
    OFString value;
    OFCondition const condition =
        this->dataset.findAndGetOFString(DCM_PatientName, value);
    BOOST_REQUIRE(condition.good());
    BOOST_CHECK_EQUAL(std::string(value.c_str()), "FOO");
}
开发者ID:cguebert,项目名称:odil,代码行数:9,代码来源:ElementAccessor.cpp

示例9: opendir

Examen*
ParserDicom::loadFile(string dirName)
{
    // Open directory
    DIR* dir = opendir(dirName.c_str());
    if (dir == NULL) {
        return NULL;
    }

    // Get examen informations
    ExamenParams* params = getInfos(dir, dirName);
    if (params == NULL) {
        return NULL;
    }

    // Create struct examen
    Volume* img = new Volume(params->width, params->height, params->depth);
    Examen* exam = new Examen(img, params);

    // Read data
    int index = 0;
    struct dirent* file;
    rewinddir(dir);
    string pathDirectory = dirName + PATH_SEPARATOR;
    int tabSize = params->width * params->height;
    float tab[tabSize];
    while ((file = readdir(dir)) != NULL) {
        if (strcmp(file->d_name, ".") != 0 &&
                strcmp(file->d_name, "..") != 0) {
            string fullpath = pathDirectory + file->d_name;
            DcmFileFormat dcm;
            OFCondition cond = dcm.loadFile(fullpath.c_str());
            if (cond.bad()) {
                delete img;
                delete params;
                return NULL;
            }
            DiDocument* didoc = new DiDocument(fullpath.c_str());
            DiMono2Image* dimg = new DiMono2Image(didoc, EIS_Normal);
            OFString s;
            dcm.getDataset()->findAndGetOFString(DCM_BitsStored, s);
            int bitsStored = atoi(s.c_str());

            short* slice = (short*) dimg->getOutputData(0, bitsStored, 0);
            for(int i=0; i<tabSize; ++i) {
                tab[i] = (float) slice[i];
            }
            img->setSlice(tab, index++);
            delete dimg;
            delete didoc;
        }
    }
    closedir(dir);
    return exam;
}
开发者ID:jjalageas,项目名称:cpMoteur3D,代码行数:55,代码来源:ParserDicom.cpp

示例10: LoadRTDose

  mitk::DataNode::Pointer RTDoseReader::
      LoadRTDose(const char* filename)
  {
    DcmFileFormat fileformat;
    OFCondition outp = fileformat.loadFile(filename, EXS_Unknown);
    if(outp.bad())
    {
      MITK_ERROR << "Cant read the file" << std::endl;
    }
    DcmDataset *dataset = fileformat.getDataset();

    std::string name = filename;
    itk::FilenamesContainer file;
    file.push_back(name);

    mitk::DicomSeriesReader* reader = new mitk::DicomSeriesReader;

    mitk::DataNode::Pointer originalNode = reader->LoadDicomSeries(file,false);

    if(originalNode.IsNull())
    {
      MITK_ERROR << "Error reading the dcm file" << std::endl;
      return 0;
    }

    mitk::Image::Pointer originalImage
        = dynamic_cast<mitk::Image*>(originalNode->GetData());

    DRTDoseIOD doseObject;
    OFCondition result = doseObject.read(*dataset);

    if(result.bad())
    {
      MITK_ERROR << "Error reading the Dataset" << std::endl;
      return 0;
    }

    OFString gridScaling;
    Float32 gridscale;

    doseObject.getDoseGridScaling(gridScaling);
    gridscale = OFStandard::atof(gridScaling.c_str());

    AccessByItk_1(originalImage, MultiplayGridScaling, gridscale);

    double prescripeDose = this->GetMaxDoseValue(dataset);

    originalNode->SetName("RT Dose");
    originalNode->SetFloatProperty(mitk::Constants::PRESCRIBED_DOSE_PROPERTY_NAME.c_str(),prescripeDose);
    originalNode->SetFloatProperty(mitk::Constants::REFERENCE_DOSE_PROPERTY_NAME.c_str(), 40);
    originalNode->SetBoolProperty(mitk::Constants::DOSE_PROPERTY_NAME.c_str(),true);
    return originalNode;
  }
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:53,代码来源:mitkRTDoseReader.cpp

示例11: GetKey

const char* Association::GetKey(DcmDataset* query, const DcmTagKey& tag)
{
        OFString val;
        static char buffer[129];
        query->findAndGetOFString(tag, val, 0, OFTrue);
#if defined(_WINDOWS)
        strncpy_s(buffer, val.c_str(), sizeof (buffer) - 1);
#else
        strncpy(buffer, val.c_str(), sizeof (buffer) - 1);

#endif
        buffer[sizeof (buffer) - 1] = 0;
        return buffer;
}
开发者ID:151706061,项目名称:ginkgocadx,代码行数:14,代码来源:dicomassociation.cpp

示例12: 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

示例13: create_query_series

Glib::RefPtr< ImagePool::Series > create_query_series(DcmDataset* dset) {
	Glib::RefPtr< ImagePool::Series > result = Glib::RefPtr< ImagePool::Series >(new Series);

	OFString seriesUID;
	OFString desc;
	OFString ofstr;

	dset->findAndGetOFString(DCM_SeriesInstanceUID, seriesUID);
	dset->findAndGetOFString(DCM_SeriesDescription, desc);
	if(result->m_description.empty()) {
		dset->findAndGetOFString(DCM_StudyDescription, desc);
	}
	result->m_seriesinstanceuid = seriesUID.c_str();
    result->m_description = desc.c_str();

	if(result->m_description.empty()) {
		result->m_description = gettext("no description");
	}

	dset->findAndGetOFString(DCM_Modality, ofstr);
	result->m_modality = ofstr.c_str();

	dset->findAndGetOFString(DCM_SeriesTime, ofstr);
	result->m_seriestime = ofstr.c_str();
	if(result->m_seriestime.empty()) {
		dset->findAndGetOFString(DCM_StudyTime, ofstr);
		result->m_seriestime = ofstr.c_str();
	}

	dset->findAndGetOFString(DCM_StationName, ofstr);
    result->m_stationname = ofstr.c_str();

	dset->findAndGetOFString(DCM_NumberOfSeriesRelatedInstances, ofstr);
	int i = atoi(ofstr.c_str());
	if(i != 0) {
		result->m_instancecount = i;
	}

	fix_time(result->m_seriestime);

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

示例14: find_study

    DcmDirectoryRecord* DicomdirLoader::find_study(const std::string &studyinstanceuid, class DcmDicomDir &dir) {
        DcmDirectoryRecord *patRec;
        DcmDirectoryRecord *studyRec;
        OFCondition ret;

        DcmDirectoryRecord &root = dir.getRootRecord();
        for ( patRec = root.nextSub(NULL); patRec != NULL; patRec = root.nextSub(patRec) ) {
            if ( patRec->getRecordType() == ERT_Patient ) {
                for ( studyRec = patRec->nextSub(NULL); studyRec; studyRec = patRec->nextSub(studyRec) ) {
                    if ( studyRec->getRecordType()==ERT_Study ) {
                        OFString uid;
                        if ( studyRec->findAndGetOFString(DCM_StudyInstanceUID, uid)==EC_Normal ) {
                            if ( studyinstanceuid == uid.c_str() )
                                return studyRec;
                        }
                    }
                }
            }
        }
        return NULL;
    }
开发者ID:hsanjuan,项目名称:aeskulap,代码行数:21,代码来源:dicomdirloader.cpp

示例15: Q_D

void ctkDICOMDataset::InitializeFromDataset(DcmDataset* dataset, bool takeOwnership)
{
  Q_D(ctkDICOMDataset);

  if(d->m_DcmDataset != dataset)
  {
    if (d->m_TakeOwnership)
    {
      delete d->m_DcmDataset;
    }
    d->m_DcmDataset = NULL;
  }

  if (dataset)
  {
    d->m_DcmDataset=dataset;
    d->m_TakeOwnership = takeOwnership;
    if (!d->m_DICOMDataSetInitialized)
    {
      d->m_DICOMDataSetInitialized = true;
      OFString encoding;
      if ( CheckCondition( dataset->findAndGetOFString(DCM_SpecificCharacterSet, encoding) ) )
      {
        d->m_SpecificCharacterSet = encoding.c_str();
      }
      }
      if (d->m_SpecificCharacterSet.isEmpty())
      {
        ///
        /// see Bug # 6458:
        /// There are cases, where different studies of the same person get encoded both with and without the SpecificCharacterSet attribute set.
        /// DICOM says: default is ASCII / ISO_IR 6 / ISO 646
        /// Since we experienced such mixed data, we supplement missing characterset information with the ISO_IR 100 / Latin1 character set.
        /// Since Latin1 is a superset of ASCII, this will not cause problems. PLUS in most cases (Europe) we will guess right and suppress
        /// "double patients" in applications.
        ///
        SetElementAsString( DCM_SpecificCharacterSet, "ISO_IR 100" );
      }
    }
  }
开发者ID:Koki-Shimizu,项目名称:CTK,代码行数:40,代码来源:ctkDICOMDataset.cpp


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