20 #include <itkImageRegionConstIteratorWithIndex.h>
62 itkExceptionMacro(<<
"Image not set!");
75 template <
typename TPixel,
unsigned int VImageDimension>
80 typedef itk::Image<TPixel, VImageDimension>
ImageType;
81 typedef typename ImageType::IndexType IndexType;
82 typedef itk::ImageRegionConstIteratorWithIndex<ImageType> IteratorType;
90 IteratorType it(image, image->GetBufferedRegion());
91 for (it.GoToBegin(); !it.IsAtEnd(); ++it)
93 const IndexType &index = it.GetIndex();
94 unsigned int pixel =
static_cast<unsigned int>(it.Get());
111 double voxelVolume = spacing[0] * spacing[1] * spacing[2];
ImageTimeSelector::Pointer m_InputTimeSelector
std::vector< Point3D > PointVector
const Point3D & GetCentroid(unsigned int label) const
std::vector< double > VolumeVector
virtual ~LabeledImageVolumeCalculator()
DataCollection - Class to facilitate loading/accessing structured data.
PointVector m_CentroidVector
const mitk::Vector3D GetSpacing() const
Get the spacing (size of a pixel).
void _InternalCalculateVolumes(itk::Image< TPixel, VImageDimension > *image, LabeledImageVolumeCalculator *volumeCalculator, BaseGeometry *geometry)
Image::ConstPointer m_Image
VolumeVector m_VolumeVector
map::core::discrete::Elements< 3 >::InternalImageType ImageType
double GetVolume(unsigned int label) const
const VolumeVector & GetVolumes() const
const PointVector & GetCentroids() const
LabeledImageVolumeCalculator()
Class for calculating the volume (or area) for each label in a labeled image.
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)...
#define AccessByItk_2(mitkImage, itkImageTypeFunction, arg1, arg2)
BaseGeometry Describes the geometry of a data object.