19 #include "itkImageRegionConstIteratorWithIndex.h"
28 template <
typename TPixel,
unsigned int VImageDimension>
30 TPixel *itkNotUsed(dummy))
32 itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>> iterBinaryImage(
33 itkImage, itkImage->GetLargestPossibleRegion());
34 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType currentIndex;
35 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType minIndex;
36 for (
unsigned int i = 0; i < VImageDimension; ++i)
39 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType maxIndex;
40 for (
unsigned int i = 0; i < VImageDimension; ++i)
43 m_CenterOfMass.Fill(0.0);
46 while (!iterBinaryImage.IsAtEnd())
48 if (iterBinaryImage.Get() >
static_cast<TPixel
>(0.0))
51 currentIndex = iterBinaryImage.GetIndex();
52 itk::Vector<ScalarType, VImageDimension> currentPoint;
53 for (
unsigned int i = 0; i < VImageDimension; ++i)
54 currentPoint[i] = currentIndex[i];
59 static_cast<ScalarType>(m_Volume + 1)))
60 + currentPoint /
static_cast<ScalarType>(m_Volume + 1);
66 for (
unsigned int i = 0; i < VImageDimension; ++i)
68 if (currentIndex[i] < minIndex[i])
69 minIndex[i] = currentIndex[i];
70 if (currentIndex[i] > maxIndex[i])
71 maxIndex[i] = currentIndex[i];
78 m_MinIndexOfBoundingBox[2] = 0.0;
79 m_MaxIndexOfBoundingBox[2] = 0.0;
80 for (
unsigned int i = 0; i < VImageDimension; ++i)
82 m_MinIndexOfBoundingBox[i] = minIndex[i];
83 m_MaxIndexOfBoundingBox[i] = maxIndex[i];
106 Vector3D spacing = image->GetSlicedGeometry()->GetSpacing();
107 float volumeML = (
ScalarType)m_Volume * spacing[0] * spacing[1] * spacing[2] / 1000.0;
CalculateSegmentationVolume()
DataNode * GetGroupNode()
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
Access a mitk-image with known dimension by an itk-image.
DataCollection - Class to facilitate loading/accessing structured data.
virtual ~CalculateSegmentationVolume()
virtual bool ThreadedUpdateFunction() override
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
virtual bool ReadyToRun() override
void ItkImageProcessing(itk::Image< TPixel, VImageDimension > *itkImage, TPixel *dummy=NULL)
void GetPointerParameter(const char *parameter, itk::SmartPointer< T > &value) const
Class for nodes of the DataTree.