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

Method CalculateCenterOfMassProcessing

Modules/Multilabel/src/mitkLabelSetImage.cpp:1261–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259
1260template <typename ImageType>
1261void mitk::MultiLabelSegmentation::CalculateCenterOfMassProcessing(ImageType *itkImage, LabelValueType pixelValue)
1262{
1263 if (ImageType::GetImageDimension() != 3)
1264 {
1265 return;
1266 }
1267
1268 auto label = this->GetLabel(pixelValue);
1269 if (label.IsNotNull())
1270 {
1271 using ShapeLabelMapFilterType = itk::LabelImageToShapeLabelMapFilter<ImageType>;
1272 auto shapeLabelMapFilter = ShapeLabelMapFilterType::New();
1273 shapeLabelMapFilter->SetInput(itkImage);
1274 shapeLabelMapFilter->Update();
1275 const auto *labelMap = shapeLabelMapFilter->GetOutput();
1276
1277 if (labelMap->HasLabel(pixelValue))
1278 {
1279 const auto *labelObject = labelMap->GetLabelObject(pixelValue);
1280 const auto &physicalCentroid = labelObject->GetCentroid();
1281
1282 mitk::Point3D coordinates;
1283 coordinates[0] = physicalCentroid[0];
1284 coordinates[1] = physicalCentroid[1];
1285 coordinates[2] = physicalCentroid[2];
1286
1287 mitk::Point3D pos;
1288 this->GetSlicedGeometry()->WorldToIndex(coordinates, pos);
1289
1290 label->UpdateCenterOfMass(pos, coordinates);
1291 }
1292 }
1293}
1294
1295template <typename ImageType>
1296void mitk::MultiLabelSegmentation::EraseLabelProcessing(ImageType *itkImage, LabelValueType pixelValue)

Callers

nothing calls this directly

Calls 9

GetLabelMethod · 0.95
IsNotNullMethod · 0.80
GetSlicedGeometryMethod · 0.80
NewFunction · 0.50
SetInputMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
WorldToIndexMethod · 0.45
UpdateCenterOfMassMethod · 0.45

Tested by

no test coverage detected