| 98 | } |
| 99 | |
| 100 | std::vector<itk::SmartPointer<BaseData> > RTStructureSetReaderService::DoRead() |
| 101 | { |
| 102 | std::vector<itk::SmartPointer<mitk::BaseData> > result; |
| 103 | |
| 104 | std::string location = GetInputLocation(); |
| 105 | |
| 106 | auto DICOMTagsOfInterestService = DICOMIOHelper::GetTagsOfInterestService(); |
| 107 | auto tagsOfInterest = DICOMTagsOfInterestService->GetTagsOfInterest(); |
| 108 | DICOMTagPathList tagsOfInterestList; |
| 109 | for (const auto& tag : tagsOfInterest) { |
| 110 | tagsOfInterestList.push_back(tag.first); |
| 111 | } |
| 112 | |
| 113 | mitk::DICOMDCMTKTagScanner::Pointer scanner = mitk::DICOMDCMTKTagScanner::New(); |
| 114 | scanner->SetInputFiles({ location }); |
| 115 | scanner->AddTagPaths(tagsOfInterestList); |
| 116 | scanner->Scan(); |
| 117 | |
| 118 | mitk::DICOMDatasetAccessingImageFrameList frames = scanner->GetFrameInfoList(); |
| 119 | if (frames.empty()) { |
| 120 | MITK_ERROR << "Error reading the RTSTRUCT file" << std::endl; |
| 121 | return result; |
| 122 | } |
| 123 | |
| 124 | auto findings = DICOMIOHelper::ExtractPathsOfInterest(tagsOfInterestList, frames); |
| 125 | |
| 126 | DcmFileFormat file; |
| 127 | OFCondition output = file.loadFile(location.c_str(), EXS_Unknown); |
| 128 | |
| 129 | if (output.bad()) |
| 130 | { |
| 131 | MITK_ERROR << "Can't read the file" << std::endl; |
| 132 | return result; |
| 133 | } |
| 134 | |
| 135 | DcmDataset* dataset = file.getDataset(); |
| 136 | |
| 137 | DRTStructureSetIOD structureSetObject; |
| 138 | OFCondition outp = structureSetObject.read(*dataset); |
| 139 | |
| 140 | if (!outp.good()) |
| 141 | { |
| 142 | MITK_ERROR << "Error reading the file" << std::endl; |
| 143 | return result; |
| 144 | } |
| 145 | |
| 146 | DRTStructureSetROISequence& roiSequence = |
| 147 | structureSetObject.getStructureSetROISequence(); |
| 148 | |
| 149 | if (!roiSequence.gotoFirstItem().good()) |
| 150 | { |
| 151 | MITK_ERROR << "Error reading the structure sequence" << std::endl; |
| 152 | return result; |
| 153 | } |
| 154 | |
| 155 | do |
| 156 | { |
| 157 | DRTStructureSetROISequence::Item& currentSequence = |
nothing calls this directly
no test coverage detected