Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/DicomStructureSet.cpp @ 110:53025eecbc95 wasm
renamed SliceGeometry as CoordinateSystem3D
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Jun 2017 15:50:38 +0200 |
parents | 28956ed68280 |
children | 2eca030792aa |
comparison
equal
deleted
inserted
replaced
109:53bd9277b025 | 110:53025eecbc95 |
---|---|
59 return static_cast<uint8_t>(v); | 59 return static_cast<uint8_t>(v); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 SliceGeometry DicomStructureSet::ExtractSliceGeometry(double& sliceThickness, | 64 CoordinateSystem3D DicomStructureSet::ExtractSliceGeometry(double& sliceThickness, |
65 OrthancPlugins::IOrthancConnection& orthanc, | 65 OrthancPlugins::IOrthancConnection& orthanc, |
66 const OrthancPlugins::IDicomDataset& tags, | 66 const OrthancPlugins::IDicomDataset& tags, |
67 size_t contourIndex, | 67 size_t contourIndex, |
68 size_t sliceIndex) | 68 size_t sliceIndex) |
69 { | 69 { |
120 LOG(ERROR) << "This RT-STRUCT refers to several different series"; | 120 LOG(ERROR) << "This RT-STRUCT refers to several different series"; |
121 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 121 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
122 } | 122 } |
123 | 123 |
124 FullOrthancDataset parentTags(orthanc, "/instances/" + parentLookup[0]["ID"].asString() + "/tags"); | 124 FullOrthancDataset parentTags(orthanc, "/instances/" + parentLookup[0]["ID"].asString() + "/tags"); |
125 SliceGeometry slice(parentTags); | 125 CoordinateSystem3D slice(parentTags); |
126 | 126 |
127 Vector v; | 127 Vector v; |
128 if (GeometryToolbox::ParseVector(v, parentTags, DICOM_TAG_SLICE_THICKNESS) && | 128 if (GeometryToolbox::ParseVector(v, parentTags, DICOM_TAG_SLICE_THICKNESS) && |
129 v.size() > 0) | 129 v.size() > 0) |
130 { | 130 { |
159 return structures_[index]; | 159 return structures_[index]; |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 bool DicomStructureSet::IsPolygonOnSlice(const Polygon& polygon, | 163 bool DicomStructureSet::IsPolygonOnSlice(const Polygon& polygon, |
164 const SliceGeometry& geometry) const | 164 const CoordinateSystem3D& geometry) const |
165 { | 165 { |
166 double d = boost::numeric::ublas::inner_prod(geometry.GetOrigin(), normal_); | 166 double d = boost::numeric::ublas::inner_prod(geometry.GetOrigin(), normal_); |
167 | 167 |
168 return (GeometryToolbox::IsNear(d, polygon.projectionAlongNormal_, polygon.sliceThickness_ / 2.0) && | 168 return (GeometryToolbox::IsNear(d, polygon.projectionAlongNormal_, polygon.sliceThickness_ / 2.0) && |
169 !polygon.points_.empty()); | 169 !polygon.points_.empty()); |
265 { | 265 { |
266 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 266 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
267 } | 267 } |
268 | 268 |
269 Polygon polygon; | 269 Polygon polygon; |
270 SliceGeometry geometry = ExtractSliceGeometry(polygon.sliceThickness_, orthanc, tags, i, j); | 270 CoordinateSystem3D geometry = ExtractSliceGeometry(polygon.sliceThickness_, orthanc, tags, i, j); |
271 polygon.projectionAlongNormal_ = geometry.ProjectAlongNormal(geometry.GetOrigin()); | 271 polygon.projectionAlongNormal_ = geometry.ProjectAlongNormal(geometry.GetOrigin()); |
272 | 272 |
273 for (size_t k = 0; k < countPoints; k++) | 273 for (size_t k = 0; k < countPoints; k++) |
274 { | 274 { |
275 Vector v(3); | 275 Vector v(3); |
349 blue = s.blue_; | 349 blue = s.blue_; |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 void DicomStructureSet::Render(CairoContext& context, | 353 void DicomStructureSet::Render(CairoContext& context, |
354 const SliceGeometry& slice) const | 354 const CoordinateSystem3D& slice) const |
355 { | 355 { |
356 cairo_t* cr = context.GetObject(); | 356 cairo_t* cr = context.GetObject(); |
357 | 357 |
358 for (Structures::const_iterator structure = structures_.begin(); | 358 for (Structures::const_iterator structure = structures_.begin(); |
359 structure != structures_.end(); ++structure) | 359 structure != structures_.end(); ++structure) |