Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/DicomStructureSet.cpp @ 1945:98952be6fb97
rendering plugin: rendering of multiple structures
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 02 Jun 2022 12:23:45 +0200 |
parents | bd527bbc34df |
children | 07964689cb0b |
comparison
equal
deleted
inserted
replaced
1944:3daecfa5791c | 1945:98952be6fb97 |
---|---|
399 { | 399 { |
400 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 400 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
401 } | 401 } |
402 | 402 |
403 structures_.resize(count); | 403 structures_.resize(count); |
404 structureNamesIndex_.clear(); | |
405 | |
404 for (size_t i = 0; i < count; i++) | 406 for (size_t i = 0; i < count; i++) |
405 { | 407 { |
406 structures_[i].interpretation_ = reader.GetStringValue | 408 structures_[i].interpretation_ = reader.GetStringValue |
407 (Orthanc::DicomPath(DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE, i, | 409 (Orthanc::DicomPath(DICOM_TAG_RT_ROI_OBSERVATIONS_SEQUENCE, i, |
408 DICOM_TAG_RT_ROI_INTERPRETED_TYPE), | 410 DICOM_TAG_RT_ROI_INTERPRETED_TYPE), |
410 | 412 |
411 structures_[i].name_ = reader.GetStringValue | 413 structures_[i].name_ = reader.GetStringValue |
412 (Orthanc::DicomPath(DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE, i, | 414 (Orthanc::DicomPath(DICOM_TAG_STRUCTURE_SET_ROI_SEQUENCE, i, |
413 DICOM_TAG_ROI_NAME), | 415 DICOM_TAG_ROI_NAME), |
414 "No name"); | 416 "No name"); |
417 | |
418 if (structureNamesIndex_.find(structures_[i].name_) == structureNamesIndex_.end()) | |
419 { | |
420 structureNamesIndex_[structures_[i].name_] = i; | |
421 } | |
422 else | |
423 { | |
424 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, | |
425 "RT-STRUCT with twice the same name for a structure: " + structures_[i].name_); | |
426 } | |
415 | 427 |
416 Vector color; | 428 Vector color; |
417 if (FastParseVector(color, tags, Orthanc::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, | 429 if (FastParseVector(color, tags, Orthanc::DicomPath(DICOM_TAG_ROI_CONTOUR_SEQUENCE, i, |
418 DICOM_TAG_ROI_DISPLAY_COLOR)) && | 430 DICOM_TAG_ROI_DISPLAY_COLOR)) && |
419 color.size() == 3) | 431 color.size() == 3) |
1016 else | 1028 else |
1017 { | 1029 { |
1018 estimatedSliceThickness_ = LinearAlgebra::ComputeMedian(deltas); | 1030 estimatedSliceThickness_ = LinearAlgebra::ComputeMedian(deltas); |
1019 } | 1031 } |
1020 } | 1032 } |
1033 | |
1034 | |
1035 bool DicomStructureSet::LookupStructureName(size_t& structureIndex /* out */, | |
1036 const std::string& name) const | |
1037 { | |
1038 StructureNamesIndex::const_iterator found = structureNamesIndex_.find(name); | |
1039 | |
1040 if (found == structureNamesIndex_.end()) | |
1041 { | |
1042 return false; | |
1043 } | |
1044 else | |
1045 { | |
1046 structureIndex = found->second; | |
1047 return true; | |
1048 } | |
1049 } | |
1021 } | 1050 } |