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

Method FitGeometry

Modules/DataTypesExt/src/mitkBoundingObject.cpp:35–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void 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}

Callers

nothing calls this directly

Calls 10

GetGeometryFunction · 0.85
GetCenterMethod · 0.80
GetExtentInMMMethod · 0.80
GetTimeGeometryFunction · 0.50
SetIdentityMethod · 0.45
ComposeMethod · 0.45
SetOriginMethod · 0.45
SetSpacingMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected