MCPcopy Create free account
hub / github.com/MITK/MITK / DoRead

Method DoRead

Modules/RT/autoload/DICOMRTIO/mitkRTStructureSetReaderService.cpp:100–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 =

Callers

nothing calls this directly

Calls 15

GetInputLocationFunction · 0.85
GetTagsOfInterestServiceFunction · 0.85
ExtractPathsOfInterestFunction · 0.85
SetPropertiesFunction · 0.85
atMethod · 0.80
AddContourModelMethod · 0.80
GetPointerMethod · 0.80
NewFunction · 0.50
GetTagsOfInterestMethod · 0.45
SetInputFilesMethod · 0.45
AddTagPathsMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected