| 33 | } |
| 34 | |
| 35 | void mitk::BoundingObject::FitGeometry(mitk::BaseGeometry *aGeometry3D) |
| 36 | { |
| 37 | // Adjusted this function to fix |
| 38 | // BUG 6951 - Image Cropper - Bounding Box is strange |
| 39 | // Still, the behavior of the BoundingObject is really strange. |
| 40 | // One would think that writing "setGeometry(aGeometry3D)" here would do the job. |
| 41 | // But apparently the boundingObject can only be handled correctly, when it's |
| 42 | // indexBounds are from -1 to 1 in all axis (so it is only 2x2x2 Pixels big) and the spacing |
| 43 | // specifies it's actual bounds. This behavior needs to be analyzed and maybe changed. |
| 44 | // Check also BUG 11406 |
| 45 | |
| 46 | GetGeometry()->SetIdentity(); |
| 47 | GetGeometry()->Compose(aGeometry3D->GetIndexToWorldTransform()); |
| 48 | GetGeometry()->SetOrigin(aGeometry3D->GetCenter()); |
| 49 | |
| 50 | mitk::Vector3D size; |
| 51 | for (unsigned int i = 0; i < 3; ++i) |
| 52 | size[i] = (aGeometry3D->GetExtentInMM(i) / 2.0); |
| 53 | GetGeometry()->SetSpacing(size); |
| 54 | GetTimeGeometry()->Update(); |
| 55 | } |
nothing calls this directly
no test coverage detected