00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $ 00006 Version: $Revision: 17179 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef _MITK_LABELEDIMAGEVOLUMECALCULATOR_H 00020 #define _MITK_LABELEDIMAGEVOLUMECALCULATOR_H 00021 00022 #include <itkObject.h> 00023 #include "MitkExtExports.h" 00024 00025 #include "mitkImage.h" 00026 #include "mitkImageTimeSelector.h" 00027 00028 #include <itkImage.h> 00029 00030 00031 namespace mitk 00032 { 00033 00042 class MitkExt_EXPORT LabeledImageVolumeCalculator : public itk::Object 00043 { 00044 public: 00045 00046 typedef std::vector< double > VolumeVector; 00047 typedef std::vector< Point3D > PointVector; 00048 00049 mitkClassMacro( LabeledImageVolumeCalculator, itk::Object ); 00050 itkNewMacro( LabeledImageVolumeCalculator ); 00051 00052 itkSetConstObjectMacro( Image, mitk::Image ); 00053 00054 00055 virtual void Calculate(); 00056 00057 00058 double GetVolume( unsigned int label ) const; 00059 00060 const Point3D &GetCentroid( unsigned int label ) const; 00061 00062 00063 const VolumeVector &GetVolumes() const; 00064 00065 const PointVector &GetCentroids() const; 00066 00067 00068 protected: 00069 00070 LabeledImageVolumeCalculator(); 00071 00072 virtual ~LabeledImageVolumeCalculator(); 00073 00074 00075 template < typename TPixel, unsigned int VImageDimension > 00076 void _InternalCalculateVolumes( 00077 itk::Image< TPixel, VImageDimension > *image, 00078 LabeledImageVolumeCalculator *volumeCalculator, 00079 Geometry3D *geometry ); 00080 00081 00082 ImageTimeSelector::Pointer m_InputTimeSelector; 00083 00084 00085 Image::ConstPointer m_Image; 00086 00087 00088 VolumeVector m_VolumeVector; 00089 PointVector m_CentroidVector; 00090 00091 Point3D m_DummyPoint; 00092 00093 }; 00094 00095 } 00096 00097 #endif // #define _MITK_LABELEDIMAGEVOLUMECALCULATOR_H