本文整理汇总了C++中DicomMap::HasTag方法的典型用法代码示例。如果您正苦于以下问题:C++ DicomMap::HasTag方法的具体用法?C++ DicomMap::HasTag怎么用?C++ DicomMap::HasTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomMap
的用法示例。
在下文中一共展示了DicomMap::HasTag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(DicomMap, FindTemplates)
{
DicomMap m;
DicomMap::SetupFindPatientTemplate(m);
ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_ID));
DicomMap::SetupFindStudyTemplate(m);
ASSERT_TRUE(m.HasTag(DICOM_TAG_STUDY_INSTANCE_UID));
ASSERT_TRUE(m.HasTag(DICOM_TAG_ACCESSION_NUMBER));
DicomMap::SetupFindSeriesTemplate(m);
ASSERT_TRUE(m.HasTag(DICOM_TAG_SERIES_INSTANCE_UID));
DicomMap::SetupFindInstanceTemplate(m);
ASSERT_TRUE(m.HasTag(DICOM_TAG_SOP_INSTANCE_UID));
}
示例2: mm
TEST(DicomMap, Tags)
{
DicomMap m;
ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_NAME));
ASSERT_FALSE(m.HasTag(0x0010, 0x0010));
m.SetValue(0x0010, 0x0010, "PatientName");
ASSERT_TRUE(m.HasTag(DICOM_TAG_PATIENT_NAME));
ASSERT_TRUE(m.HasTag(0x0010, 0x0010));
ASSERT_FALSE(m.HasTag(DICOM_TAG_PATIENT_ID));
m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID");
ASSERT_TRUE(m.HasTag(0x0010, 0x0020));
m.SetValue(DICOM_TAG_PATIENT_ID, "PatientID2");
ASSERT_EQ("PatientID2", m.GetValue(0x0010, 0x0020).AsString());
m.Remove(DICOM_TAG_PATIENT_ID);
ASSERT_THROW(m.GetValue(0x0010, 0x0020), OrthancException);
std::auto_ptr<DicomMap> mm(m.Clone());
ASSERT_EQ("PatientName", mm->GetValue(DICOM_TAG_PATIENT_NAME).AsString());
m.SetValue(DICOM_TAG_PATIENT_ID, "Hello");
ASSERT_THROW(mm->GetValue(DICOM_TAG_PATIENT_ID), OrthancException);
mm->CopyTagIfExists(m, DICOM_TAG_PATIENT_ID);
ASSERT_EQ("Hello", mm->GetValue(DICOM_TAG_PATIENT_ID).AsString());
DicomNullValue v;
ASSERT_TRUE(v.IsNull());
}
示例3: 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);
}
}
示例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";
}
}
}
示例5: 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());
}
}
}
示例6: 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);
}
}
示例7: LogMissingRequiredTag
void LogMissingRequiredTag(const DicomMap& summary)
{
std::string s, t;
if (summary.HasTag(DICOM_TAG_PATIENT_ID))
{
if (t.size() > 0)
t += ", ";
t += "PatientID=" + ValueAsString(summary, DICOM_TAG_PATIENT_ID);
}
else
{
if (s.size() > 0)
s += ", ";
s += "PatientID";
}
if (summary.HasTag(DICOM_TAG_STUDY_INSTANCE_UID))
{
if (t.size() > 0)
t += ", ";
t += "StudyInstanceUID=" + ValueAsString(summary, DICOM_TAG_STUDY_INSTANCE_UID);
}
else
{
if (s.size() > 0)
s += ", ";
s += "StudyInstanceUID";
}
if (summary.HasTag(DICOM_TAG_SERIES_INSTANCE_UID))
{
if (t.size() > 0)
t += ", ";
t += "SeriesInstanceUID=" + ValueAsString(summary, DICOM_TAG_SERIES_INSTANCE_UID);
}
else
{
if (s.size() > 0)
s += ", ";
s += "SeriesInstanceUID";
}
if (summary.HasTag(DICOM_TAG_SOP_INSTANCE_UID))
{
if (t.size() > 0)
t += ", ";
t += "SOPInstanceUID=" + ValueAsString(summary, DICOM_TAG_SOP_INSTANCE_UID);
}
else
{
if (s.size() > 0)
s += ", ";
s += "SOPInstanceUID";
}
if (t.size() == 0)
{
LOG(ERROR) << "Store has failed because all the required tags (" << s << ") are missing (is it a DICOMDIR file?)";
}
else
{
LOG(ERROR) << "Store has failed because required tags (" << s << ") are missing for the following instance: " << t;
}
}