| 291 | } |
| 292 | |
| 293 | mitk::Point3D mitk::BaseGeometry::GetCornerPoint(int id) const |
| 294 | { |
| 295 | assert(id >= 0); |
| 296 | assert(this->IsBoundingBoxNull() == false); |
| 297 | |
| 298 | BoundingBox::BoundsArrayType bounds = this->GetBoundingBox()->GetBounds(); |
| 299 | |
| 300 | Point3D cornerpoint; |
| 301 | switch (id) |
| 302 | { |
| 303 | case 0: |
| 304 | FillVector3D(cornerpoint, bounds[0], bounds[2], bounds[4]); |
| 305 | break; |
| 306 | case 1: |
| 307 | FillVector3D(cornerpoint, bounds[0], bounds[2], bounds[5]); |
| 308 | break; |
| 309 | case 2: |
| 310 | FillVector3D(cornerpoint, bounds[0], bounds[3], bounds[4]); |
| 311 | break; |
| 312 | case 3: |
| 313 | FillVector3D(cornerpoint, bounds[0], bounds[3], bounds[5]); |
| 314 | break; |
| 315 | case 4: |
| 316 | FillVector3D(cornerpoint, bounds[1], bounds[2], bounds[4]); |
| 317 | break; |
| 318 | case 5: |
| 319 | FillVector3D(cornerpoint, bounds[1], bounds[2], bounds[5]); |
| 320 | break; |
| 321 | case 6: |
| 322 | FillVector3D(cornerpoint, bounds[1], bounds[3], bounds[4]); |
| 323 | break; |
| 324 | case 7: |
| 325 | FillVector3D(cornerpoint, bounds[1], bounds[3], bounds[5]); |
| 326 | break; |
| 327 | default: |
| 328 | { |
| 329 | itkExceptionMacro(<< "A cube only has 8 corners. These are labeled 0-7."); |
| 330 | } |
| 331 | } |
| 332 | if (m_ImageGeometry) |
| 333 | { |
| 334 | // Here i have to adjust the 0.5 offset manually, because the cornerpoint is the corner of the |
| 335 | // bounding box. The bounding box itself is no image, so it is corner-based |
| 336 | FillVector3D(cornerpoint, cornerpoint[0] - 0.5, cornerpoint[1] - 0.5, cornerpoint[2] - 0.5); |
| 337 | } |
| 338 | return this->GetIndexToWorldTransform()->TransformPoint(cornerpoint); |
| 339 | } |
| 340 | |
| 341 | mitk::Point3D mitk::BaseGeometry::GetCornerPoint(bool xFront, bool yFront, bool zFront) const |
| 342 | { |