29 RTStructureSetReader::RoiEntry::RoiEntry()
32 DisplayColor[0] = 1.0;
33 DisplayColor[1] = 0.0;
34 DisplayColor[2] = 0.0;
38 RTStructureSetReader::RoiEntry::RoiEntry(
const RoiEntry& src)
42 Description = src.Description;
43 DisplayColor[0] = src.DisplayColor[0];
44 DisplayColor[1] = src.DisplayColor[1];
45 DisplayColor[2] = src.DisplayColor[2];
47 SetPolyData(src.ContourModelSet);
50 RTStructureSetReader::RoiEntry::~RoiEntry() {}
52 RTStructureSetReader::RoiEntry& RTStructureSetReader::
53 RoiEntry::operator =(
const RoiEntry& src)
57 Description = src.Description;
58 DisplayColor[0] = src.DisplayColor[0];
59 DisplayColor[1] = src.DisplayColor[1];
60 DisplayColor[2] = src.DisplayColor[2];
61 SetPolyData(src.ContourModelSet);
65 void RTStructureSetReader::RoiEntry::
68 if (roiPolyData == this->ContourModelSet)
73 this->ContourModelSet = roiPolyData;
99 OFCondition output = file.loadFile(filepath, EXS_Unknown);
103 MITK_ERROR <<
"Cant read the file" << std::endl;
106 DcmDataset* dataset = file.getDataset();
108 DRTStructureSetIOD structureSetObject;
109 OFCondition outp = structureSetObject.read(*dataset);
113 MITK_ERROR <<
"Error reading the file" << std::endl;
114 RTStructureSetReader::ContourModelSetNodes x;
118 DRTStructureSetROISequence& roiSequence =
119 structureSetObject.getStructureSetROISequence();
121 if (!roiSequence.gotoFirstItem().good())
123 MITK_ERROR <<
"Error reading the structure sequence" << std::endl;
124 RTStructureSetReader::ContourModelSetNodes x;
130 DRTStructureSetROISequence::Item& currentSequence =
131 roiSequence.getCurrentItem();
133 if (!currentSequence.isValid())
139 OFString roiDescription;
143 currentSequence.getROIName(roiName);
144 currentSequence.getROIDescription(roiDescription);
145 currentSequence.getROINumber(roiNumber);
147 roi.Name = roiName.c_str();
148 roi.Description = roiDescription.c_str();
149 roi.Number = roiNumber;
152 }
while (roiSequence.gotoNextItem().good());
155 DRTROIContourSequence& roiContourSeqObject =
156 structureSetObject.getROIContourSequence();
158 if (!roiContourSeqObject.gotoFirstItem().good())
160 MITK_ERROR <<
"Error reading the contour sequence" << std::endl;
161 RTStructureSetReader::ContourModelSetNodes x;
168 DRTROIContourSequence::Item& currentRoiObject =
169 roiContourSeqObject.getCurrentItem();
171 if (!currentRoiObject.isValid())
176 currentRoiObject.getReferencedROINumber(refRoiNumber);
177 DRTContourSequence& contourSeqObject =
178 currentRoiObject.getContourSequence();
180 if (contourSeqObject.gotoFirstItem().good())
184 DRTContourSequence::Item& contourItem =
185 contourSeqObject.getCurrentItem();
187 if (!contourItem.isValid())
192 OFString contourNumber;
193 OFString numberOfPoints;
194 OFVector<Float64> contourData_LPS;
198 contourItem.getContourNumber(contourNumber);
199 contourItem.getNumberOfContourPoints(numberOfPoints);
200 contourItem.getContourData(contourData_LPS);
202 for (
unsigned int i = 0; i < contourData_LPS.size() / 3; i++)
205 point[0] = contourData_LPS.at(3 * i);
206 point[1] = contourData_LPS.at(3 * i + 1);
207 point[2] = contourData_LPS.at(3 * i + 2);
208 contourSequence->AddVertex(point);
211 contourSequence->Close();
212 contourSet->AddContourModel(contourSequence);
213 }
while (contourSeqObject.gotoNextItem().good());
217 MITK_ERROR <<
"Error reading contourSeqObject" << std::endl;
224 MITK_ERROR <<
"Can not find references ROI" << std::endl;
230 for (
int j = 0; j < 3; j++)
232 currentRoiObject.getROIDisplayColor(roiColor, j);
233 refROI->DisplayColor[j] = roiColor / 255.0;
236 refROI->ContourModelSet = contourSet;
239 refROI->DisplayColor[0],
240 refROI->DisplayColor[1],
241 refROI->DisplayColor[2]));
245 structureSetObject.getSeriesInstanceUID(uid);
250 structureSetObject.getPatientID(patientUid);
253 contourSet->SetProperty(patientUidPropertyName.c_str(),
256 }
while (roiContourSeqObject.gotoNextItem().good());
258 std::deque<mitk::DataNode::Pointer> nodes;
264 node->SetProperty(
"name",
ROISequenceVector.at(i).ContourModelSet->GetProperty(
"name"));
265 node->SetProperty(
"color",
ROISequenceVector.at(i).ContourModelSet->GetProperty(
"contour.color"));
266 node->SetProperty(
"contour.color",
278 nodes.push_back(node);
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
RoiEntry * FindRoiByNumber(unsigned int roiNum)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static vtkRenderWindow * GetRenderWindowByName(const std::string &name)
virtual ~RTStructureSetReader()
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< RoiEntry > ROISequenceVector
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPropertyName(const DICOMTagPath &tagPath)
vcl_size_t GetNumberOfROIs()
ContourModelSetNodes ReadStructureSet(const char *filepath)
Reading a RT StructureSet from the DICOM file and returns the ROIs (region of interest) as a ContourM...