Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLabeledImageVolumeCalculator.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLabeledImageVolumeCalculator_h
14 #define mitkLabeledImageVolumeCalculator_h
15 
17 #include <itkObject.h>
18 
19 #include <mitkImage.h>
20 #include <mitkImageTimeSelector.h>
21 
22 #include <itkImage.h>
23 
24 namespace mitk
25 {
39  {
40  public:
42  typedef std::vector<double> VolumeVector;
44  typedef std::vector<Point3D> PointVector;
45 
47  itkFactorylessNewMacro(Self);
48  itkCloneMacro(Self);
49 
54  itkSetConstObjectMacro(Image, mitk::Image);
55 
61  virtual void Calculate();
62 
69  double GetVolume(unsigned int label) const;
70 
77  const Point3D &GetCentroid(unsigned int label) const;
78 
83  const VolumeVector &GetVolumes() const;
84 
89  const PointVector &GetCentroids() const;
90 
91  protected:
93 
95 
96  template <typename TPixel, unsigned int VImageDimension>
97  void _InternalCalculateVolumes(itk::Image<TPixel, VImageDimension> *image,
98  LabeledImageVolumeCalculator *volumeCalculator,
99  BaseGeometry *geometry);
100 
101  ImageTimeSelector::Pointer m_InputTimeSelector;
102 
103  Image::ConstPointer m_Image;
104 
107 
109  };
110 }
111 
112 #endif
#define MITKDATATYPESEXT_EXPORT
Abstract base class describing the geometry of a data object.
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
Calculates the volume and centroid for each label in a labeled image.
const VolumeVector & GetVolumes() const
Get the vector of volumes for all labels.
std::vector< Point3D > PointVector
Vector of per-label centroid points.
const Point3D & GetCentroid(unsigned int label) const
Get the centroid (center of mass) for a specific label.
mitkClassMacroItkParent(LabeledImageVolumeCalculator, itk::Object)
std::vector< double > VolumeVector
Vector of per-label volume values.
const PointVector & GetCentroids() const
Get the vector of centroids for all labels.
void _InternalCalculateVolumes(itk::Image< TPixel, VImageDimension > *image, LabeledImageVolumeCalculator *volumeCalculator, BaseGeometry *geometry)
virtual void Calculate()
Perform the volume and centroid calculation.
double GetVolume(unsigned int label) const
Get the volume for a specific label.
Find image slices visible on a given plane.