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


C++ DicomMap::TestAndGetValue方法代码示例

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


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

示例1: OrthancException

    Instance(ServerIndex& index,
             const std::string& instanceId) :
      instanceId_(instanceId),
      framesCount_(1)
    {
      DicomMap instance;
      if (!index.GetMainDicomTags(instance, instanceId, ResourceType_Instance, ResourceType_Instance))
      {
        throw OrthancException(ErrorCode_UnknownResource);
      }

      const DicomValue* frames = instance.TestAndGetValue(DICOM_TAG_NUMBER_OF_FRAMES);
      if (frames != NULL &&
          !frames->IsNull() &&
          !frames->IsBinary())
      {
        try
        {
          framesCount_ = boost::lexical_cast<unsigned int>(frames->GetContent());
        }
        catch (boost::bad_lexical_cast&)
        {
        }
      }
      
      std::vector<float> tmp;
      hasPosition_ = TokenizeVector(tmp, instance, DICOM_TAG_IMAGE_POSITION_PATIENT, 3);

      if (hasPosition_)
      {
        position_[0] = tmp[0];
        position_[1] = tmp[1];
        position_[2] = tmp[2];
      }

      std::string s;
      hasIndexInSeries_ = false;

      try
      {
        if (index.LookupMetadata(s, instanceId, MetadataType_Instance_IndexInSeries))
        {
          indexInSeries_ = boost::lexical_cast<size_t>(s);
          hasIndexInSeries_ = true;
        }
      }
      catch (boost::bad_lexical_cast&)
      {
      }
    }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:50,代码来源:SliceOrdering.cpp

示例2: ApplyLevel

  void LookupResource::ApplyLevel(SetOfResources& candidates,
                                  ResourceType level,
                                  IDatabaseWrapper& database) const
  {
    Levels::const_iterator it = levels_.find(level);
    if (it != levels_.end())
    {
      it->second->Apply(candidates, database);
    }

    if (level == ResourceType_Study &&
        modalitiesInStudy_.get() != NULL)
    {
      // There is a constraint on the "ModalitiesInStudy" DICOM
      // extension. Check out whether one child series has one of the
      // allowed modalities
      std::list<int64_t> allStudies, matchingStudies;
      candidates.Flatten(allStudies);
 
      for (std::list<int64_t>::const_iterator
             study = allStudies.begin(); study != allStudies.end(); ++study)
      {
        std::list<int64_t> childrenSeries;
        database.GetChildrenInternalId(childrenSeries, *study);

        for (std::list<int64_t>::const_iterator
               series = childrenSeries.begin(); series != childrenSeries.end(); ++series)
        {
          DicomMap tags;
          database.GetMainDicomTags(tags, *series);

          const DicomValue* value = tags.TestAndGetValue(DICOM_TAG_MODALITY);
          if (value != NULL &&
              !value->IsNull() &&
              !value->IsBinary())
          {
            if (modalitiesInStudy_->Match(value->GetContent()))
            {
              matchingStudies.push_back(*study);
              break;
            }
          }
        }
      }

      candidates.Intersect(matchingStudies);
    }
  }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:48,代码来源:LookupResource.cpp

示例3: Match

  static bool Match(const DicomMap& tags,
                    const DicomTag& tag,
                    const IFindConstraint& constraint)
  {
    const DicomValue* value = tags.TestAndGetValue(tag);

    if (value == NULL ||
        value->IsNull() ||
        value->IsBinary())
    {
      return false;
    }
    else
    {
      return constraint.Match(value->GetContent());
    }
  }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:17,代码来源:LookupResource.cpp

示例4: TokenizeVector

  static bool TokenizeVector(std::vector<float>& result,
                             const DicomMap& map,
                             const DicomTag& tag,
                             unsigned int expectedSize)
  {
    const DicomValue* value = map.TestAndGetValue(tag);

    if (value == NULL ||
        value->IsNull() ||
        value->IsBinary())
    {
      return false;
    }
    else
    {
      return TokenizeVector(result, value->GetContent(), expectedSize);
    }
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:18,代码来源:SliceOrdering.cpp

示例5: StoreIdentifiers

    static void StoreIdentifiers(IDatabaseWrapper& database,
                                 int64_t resource,
                                 ResourceType level,
                                 const DicomMap& map)
    {
      const DicomTag* tags;
      size_t size;

      LoadIdentifiers(tags, size, level);

      for (size_t i = 0; i < size; i++)
      {
        const DicomValue* value = map.TestAndGetValue(tags[i]);
        if (value != NULL &&
            !value->IsNull() &&
            !value->IsBinary())
        {
          std::string s = NormalizeIdentifier(value->GetContent());
          database.SetIdentifierTag(resource, tags[i], s);
        }
      }
    }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:22,代码来源:ServerToolbox.cpp

示例6: Handle

  bool OrthancFindRequestHandler::Handle(DicomFindAnswers& answers,
                                         const DicomMap& input,
                                         const std::string& callingAETitle)
  {
    /**
     * Ensure that the calling modality is known to Orthanc.
     **/

    RemoteModalityParameters modality;

    if (!Configuration::LookupDicomModalityUsingAETitle(modality, callingAETitle))
    {
      throw OrthancException("Unknown modality");
    }

    // ModalityManufacturer manufacturer = modality.GetManufacturer();

    bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);


    /**
     * Retrieve the query level.
     **/

    const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
    if (levelTmp == NULL) 
    {
      throw OrthancException(ErrorCode_BadRequest);
    }

    ResourceType level = StringToResourceType(levelTmp->AsString().c_str());

    if (level != ResourceType_Patient &&
        level != ResourceType_Study &&
        level != ResourceType_Series &&
        level != ResourceType_Instance)
    {
      throw OrthancException(ErrorCode_NotImplemented);
    }


    DicomArray query(input);
    LOG(INFO) << "DICOM C-Find request at level: " << EnumerationToString(level);

    for (size_t i = 0; i < query.GetSize(); i++)
    {
      if (!query.GetElement(i).GetValue().IsNull())
      {
        LOG(INFO) << "  " << query.GetElement(i).GetTag()
                  << "  " << FromDcmtkBridge::GetName(query.GetElement(i).GetTag())
                  << " = " << query.GetElement(i).GetValue().AsString();
      }
    }


    /**
     * Build up the query object.
     **/

    CFindQuery findQuery(answers, context_.GetIndex(), query);
    findQuery.SetLevel(level);
        
    for (size_t i = 0; i < query.GetSize(); i++)
    {
      const DicomTag tag = query.GetElement(i).GetTag();

      if (query.GetElement(i).GetValue().IsNull() ||
          tag == DICOM_TAG_QUERY_RETRIEVE_LEVEL ||
          tag == DICOM_TAG_SPECIFIC_CHARACTER_SET)
      {
        continue;
      }

      std::string value = query.GetElement(i).GetValue().AsString();
      if (value.size() == 0)
      {
        // An empty string corresponds to a "*" wildcard constraint, so we ignore it
        continue;
      }

      if (tag == DICOM_TAG_MODALITIES_IN_STUDY)
      {
        findQuery.SetModalitiesInStudy(value);
      }
      else
      {
        findQuery.SetConstraint(tag, value, caseSensitivePN);
      }
    }


    /**
     * Run the query.
     **/

    ResourceFinder finder(context_);

    switch (level)
    {
      case ResourceType_Patient:
//.........这里部分代码省略.........
开发者ID:nguyentantrung012,项目名称:orthanc,代码行数:101,代码来源:OrthancFindRequestHandler.cpp


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