| 1259 | |
| 1260 | template <typename ImageType> |
| 1261 | void 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 | |
| 1295 | template <typename ImageType> |
| 1296 | void mitk::MultiLabelSegmentation::EraseLabelProcessing(ImageType *itkImage, LabelValueType pixelValue) |
nothing calls this directly
no test coverage detected