15 #include "itkImageRegionConstIteratorWithIndex.h" 24 template <
typename TPixel,
unsigned int VImageDimension>
26 TPixel *itkNotUsed(dummy))
28 itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>> iterBinaryImage(
29 itkImage, itkImage->GetLargestPossibleRegion());
30 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType currentIndex;
31 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType minIndex;
32 for (
unsigned int i = 0; i < VImageDimension; ++i)
35 typename itk::ImageRegionConstIteratorWithIndex<itk::Image<TPixel, VImageDimension>>::IndexType maxIndex;
36 for (
unsigned int i = 0; i < VImageDimension; ++i)
39 m_CenterOfMass.Fill(0.0);
42 while (!iterBinaryImage.IsAtEnd())
44 if (iterBinaryImage.Get() >
static_cast<TPixel
>(0.0))
47 currentIndex = iterBinaryImage.GetIndex();
48 itk::Vector<ScalarType, VImageDimension> currentPoint;
49 for (
unsigned int i = 0; i < VImageDimension; ++i)
50 currentPoint[i] = currentIndex[i];
55 static_cast<ScalarType>(m_Volume + 1)))
56 + currentPoint /
static_cast<ScalarType>(m_Volume + 1);
62 for (
unsigned int i = 0; i < VImageDimension; ++i)
64 if (currentIndex[i] < minIndex[i])
65 minIndex[i] = currentIndex[i];
66 if (currentIndex[i] > maxIndex[i])
67 maxIndex[i] = currentIndex[i];
74 m_MinIndexOfBoundingBox[2] = 0.0;
75 m_MaxIndexOfBoundingBox[2] = 0.0;
76 for (
unsigned int i = 0; i < VImageDimension; ++i)
78 m_MinIndexOfBoundingBox[i] = minIndex[i];
79 m_MaxIndexOfBoundingBox[i] = maxIndex[i];
102 Vector3D spacing = image->GetSlicedGeometry()->GetSpacing();
103 float volumeML = (
ScalarType)m_Volume * spacing[0] * spacing[1] * spacing[2] / 1000.0;
CalculateSegmentationVolume()
DataNode * GetGroupNode()
~CalculateSegmentationVolume() override
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
Access a mitk-image with known dimension by an itk-image.
DataCollection - Class to facilitate loading/accessing structured data.
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
mitk::Image::Pointer image
void ItkImageProcessing(itk::Image< TPixel, VImageDimension > *itkImage, TPixel *dummy=nullptr)
void GetPointerParameter(const char *parameter, itk::SmartPointer< T > &value) const
bool ThreadedUpdateFunction() override
bool ReadyToRun() override
Class for nodes of the DataTree.