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


C++ DicomMap类代码示例

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


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

示例1: Instance

    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: ComputeSeriesCounters

  static void ComputeSeriesCounters(DicomMap& result,
                                    ServerIndex& index,
                                    const std::string& series,
                                    const DicomMap& query)
  {
    std::list<std::string> instances;
    index.GetChildren(instances, series);

    if (query.HasTag(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES,
                      boost::lexical_cast<std::string>(instances.size()), false);
    }
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:14,代码来源:OrthancFindRequestHandler.cpp

示例3: GetMainDicomTags

void DatabaseWrapperBase::GetMainDicomTags(DicomMap& map,
        int64_t id)
{
    map.Clear();

    SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT * FROM MainDicomTags WHERE id=?");
    s.BindInt64(0, id);
    while (s.Step())
    {
        map.SetValue(s.ColumnInt(1),
                     s.ColumnInt(2),
                     s.ColumnString(3));
    }
}
开发者ID:ming-hai,项目名称:orthanc,代码行数:14,代码来源:DatabaseWrapperBase.cpp

示例4: ComputeStudyCounters

  static void ComputeStudyCounters(DicomMap& result,
                                   ServerContext& context,
                                   const std::string& study,
                                   const DicomMap& query)
  {
    ServerIndex& index = context.GetIndex();

    std::list<std::string> series;
    index.GetChildren(series, study);
    
    if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES,
                      boost::lexical_cast<std::string>(series.size()), false);
    }

    if (query.HasTag(DICOM_TAG_MODALITIES_IN_STUDY))
    {
      std::set<std::string> values;
      ExtractTagFromMainDicomTags(values, index, DICOM_TAG_MODALITY, series, ResourceType_Series);
      StoreSetOfStrings(result, DICOM_TAG_MODALITIES_IN_STUDY, values);
    }

    if (!query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES) &&
        !query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY))
    {
      return;
    }

    std::list<std::string> instances;
    GetChildren(instances, index, series);

    if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES,
                      boost::lexical_cast<std::string>(instances.size()), false);
    }

    if (query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY))
    {
      if (Configuration::GetGlobalBoolParameter("AllowFindSopClassesInStudy", false))
      {
        std::set<std::string> values;
        ExtractTagFromInstances(values, context, DICOM_TAG_SOP_CLASS_UID, instances);
        StoreSetOfStrings(result, DICOM_TAG_SOP_CLASSES_IN_STUDY, values);
      }
      else
      {
        result.SetValue(DICOM_TAG_SOP_CLASSES_IN_STUDY, "", false);
        LOG(WARNING) << "The handling of \"SOP Classes in Study\" (0008,0062) "
                     << "in C-FIND requests is disabled";
      }
    }
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:54,代码来源:OrthancFindRequestHandler.cpp

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

示例6: ExtractTagFromMainDicomTags

 static void ExtractTagFromMainDicomTags(std::set<std::string>& target,
                                         ServerIndex& index,
                                         const DicomTag& tag,
                                         const std::list<std::string>& resources,
                                         ResourceType level)
 {
   for (std::list<std::string>::const_iterator
          it = resources.begin(); it != resources.end(); ++it)
   {
     DicomMap tags;
     if (index.GetMainDicomTags(tags, *it, level, level) &&
         tags.HasTag(tag))
     {
       target.insert(tags.GetValue(tag).GetContent());
     }
   }
 }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:17,代码来源:OrthancFindRequestHandler.cpp

示例7: FilterMainDicomTags

  bool DicomFindQuery::FilterMainDicomTags(const std::string& resourceId,
                                           ResourceType level,
                                           const DicomMap& mainTags) const
  {
    std::set<DicomTag> tags;
    mainTags.GetTags(tags);

    for (std::set<DicomTag>::const_iterator
           it = tags.begin(); it != tags.end(); ++it)
    {
      Constraints::const_iterator constraint = constraints_.find(*it);
      if (constraint != constraints_.end() &&
          !constraint->second->Apply(mainTags.GetValue(*it).AsString()))
      {
        return false;
      }
    }

    return true;
  }
开发者ID:gbanana,项目名称:orthanc,代码行数:20,代码来源:DicomFindQuery.cpp

示例8: AddAnswer

  static void AddAnswer(DicomFindAnswers& answers,
                        const Json::Value& resource,
                        const DicomArray& query)
  {
    DicomMap result;

    for (size_t i = 0; i < query.GetSize(); i++)
    {
      // Fix issue 30 (QR response missing "Query/Retrieve Level" (008,0052))
      if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL)
      {
        result.SetValue(query.GetElement(i).GetTag(), query.GetElement(i).GetValue());
      }
      else if (query.GetElement(i).GetTag() == DICOM_TAG_SPECIFIC_CHARACTER_SET)
      {
      }
      else
      {
        std::string tag = query.GetElement(i).GetTag().Format();
        std::string value;
        if (resource.isMember(tag))
        {
          value = resource.get(tag, Json::arrayValue).get("Value", "").asString();
          result.SetValue(query.GetElement(i).GetTag(), value);
        }
        else
        {
          result.SetValue(query.GetElement(i).GetTag(), "");
        }
      }
    }

    if (result.GetSize() == 0)
    {
      LOG(WARNING) << "The C-FIND request does not return any DICOM tag";
    }
    else
    {
      answers.Add(result);
    }
  }
开发者ID:nguyentantrung012,项目名称:orthanc,代码行数:41,代码来源:OrthancFindRequestHandler.cpp

示例9: TEST

TEST(DicomImageInformation, ExtractPixelFormat2)
{
  // Delphine CT
  DicomMap m;
  m.SetValue(DICOM_TAG_ROWS, "24");
  m.SetValue(DICOM_TAG_COLUMNS, "16");
  m.SetValue(DICOM_TAG_BITS_ALLOCATED, "16");
  m.SetValue(DICOM_TAG_SAMPLES_PER_PIXEL, "1");
  m.SetValue(DICOM_TAG_BITS_STORED, "16");
  m.SetValue(DICOM_TAG_HIGH_BIT, "15");
  m.SetValue(DICOM_TAG_PIXEL_REPRESENTATION, "1");
  m.SetValue(DICOM_TAG_PHOTOMETRIC_INTERPRETATION, "MONOCHROME2");

  DicomImageInformation info(m);
  PixelFormat format;
  ASSERT_TRUE(info.ExtractPixelFormat(format));
  ASSERT_EQ(PixelFormat_SignedGrayscale16, format);
}
开发者ID:milhcbt,项目名称:OrthancMirror,代码行数:18,代码来源:ImageProcessingTests.cpp

示例10: TEST

TEST(DicomImageInformation, ExtractPixelFormat1)
{
  // Cardiac/MR*
  DicomMap m;
  m.SetValue(DICOM_TAG_ROWS, "24", false);
  m.SetValue(DICOM_TAG_COLUMNS, "16", false);
  m.SetValue(DICOM_TAG_BITS_ALLOCATED, "16", false);
  m.SetValue(DICOM_TAG_SAMPLES_PER_PIXEL, "1", false);
  m.SetValue(DICOM_TAG_BITS_STORED, "12", false);
  m.SetValue(DICOM_TAG_HIGH_BIT, "11", false);
  m.SetValue(DICOM_TAG_PIXEL_REPRESENTATION, "0", false);
  m.SetValue(DICOM_TAG_PHOTOMETRIC_INTERPRETATION, "MONOCHROME2", false);

  DicomImageInformation info(m);
  PixelFormat format;
  ASSERT_TRUE(info.ExtractPixelFormat(format, false));
  ASSERT_EQ(PixelFormat_Grayscale16, format);
}
开发者ID:151706061,项目名称:OrthancMirror,代码行数:18,代码来源:ImageProcessingTests.cpp

示例11: StoreMainDicomTags

    void StoreMainDicomTags(IDatabaseWrapper& database,
                            int64_t resource,
                            ResourceType level,
                            const DicomMap& dicomSummary)
    {
      // WARNING: The database should be locked with a transaction!

      StoreIdentifiers(database, resource, level, dicomSummary);

      DicomMap tags;

      switch (level)
      {
        case ResourceType_Patient:
          dicomSummary.ExtractPatientInformation(tags);
          break;

        case ResourceType_Study:
          // Duplicate the patient tags at the study level (new in Orthanc 0.9.5 - db v6)
          dicomSummary.ExtractPatientInformation(tags);
          StoreMainDicomTagsInternal(database, resource, tags);

          dicomSummary.ExtractStudyInformation(tags);
          break;

        case ResourceType_Series:
          dicomSummary.ExtractSeriesInformation(tags);
          break;

        case ResourceType_Instance:
          dicomSummary.ExtractInstanceInformation(tags);
          break;

        default:
          throw OrthancException(ErrorCode_InternalError);
      }

      StoreMainDicomTagsInternal(database, resource, tags);
    }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:39,代码来源:ServerToolbox.cpp

示例12: ValueAsString

 static std::string ValueAsString(const DicomMap& summary,
                                  const DicomTag& tag)
 {
   const DicomValue& value = summary.GetValue(tag);
   if (value.IsNull())
   {
     return "(null)";
   }
   else
   {
     return value.GetContent();
   }
 }
开发者ID:PACSinTERRA,项目名称:orthanc,代码行数:13,代码来源:ServerToolbox.cpp

示例13: ComputePatientCounters

  static void ComputePatientCounters(DicomMap& result,
                                     ServerIndex& index,
                                     const std::string& patient,
                                     const DicomMap& query)
  {
    std::list<std::string> studies;
    index.GetChildren(studies, patient);

    if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES,
                      boost::lexical_cast<std::string>(studies.size()), false);
    }

    if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES) &&
        !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
    {
      return;
    }

    std::list<std::string> series;
    GetChildren(series, index, studies);
    studies.clear();  // This information is useless below
    
    if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES,
                      boost::lexical_cast<std::string>(series.size()), false);
    }

    if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
    {
      return;
    }

    std::list<std::string> instances;
    GetChildren(instances, index, series);

    if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES))
    {
      result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES,
                      boost::lexical_cast<std::string>(instances.size()), false);
    }
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:44,代码来源:OrthancFindRequestHandler.cpp

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

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


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