16 #include <itkImageRegionConstIteratorWithIndex.h> 58 itkExceptionMacro(<<
"Image not set!");
71 template <
typename TPixel,
unsigned int VImageDimension>
76 typedef itk::Image<TPixel, VImageDimension>
ImageType;
77 typedef typename ImageType::IndexType IndexType;
78 typedef itk::ImageRegionConstIteratorWithIndex<ImageType> IteratorType;
86 IteratorType it(image, image->GetBufferedRegion());
87 for (it.GoToBegin(); !it.IsAtEnd(); ++it)
89 const IndexType &index = it.GetIndex();
90 auto pixel =
static_cast<unsigned int>(it.Get());
107 double voxelVolume = spacing[0] * spacing[1] * spacing[2];
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
ImageTimeSelector::Pointer m_InputTimeSelector
std::vector< Point3D > PointVector
itk::Image< unsigned char, 3 > ImageType
std::vector< double > VolumeVector
DataCollection - Class to facilitate loading/accessing structured data.
PointVector m_CentroidVector
const Point3D & GetCentroid(unsigned int label) const
void _InternalCalculateVolumes(itk::Image< TPixel, VImageDimension > *image, LabeledImageVolumeCalculator *volumeCalculator, BaseGeometry *geometry)
Image::ConstPointer m_Image
VolumeVector m_VolumeVector
double GetVolume(unsigned int label) const
const PointVector & GetCentroids() const
const VolumeVector & GetVolumes() const
mitk::Image::Pointer image
~LabeledImageVolumeCalculator() override
LabeledImageVolumeCalculator()
Class for calculating the volume (or area) for each label in a labeled image.
const mitk::Vector3D GetSpacing() const
Get the spacing (size of a pixel).
#define AccessByItk_2(mitkImage, itkImageTypeFunction, arg1, arg2)
BaseGeometry Describes the geometry of a data object.