itkComputeStatisticsWherePositiveFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkComputeStatisticsWherePositiveFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/03/29 14:53:40 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 #ifndef __itkComputeStatisticsWherePositiveFilter_h
00018 #define __itkComputeStatisticsWherePositiveFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkImage.h"
00022 #include "itkArray.h"
00023 
00024 namespace itk
00025 {
00029 template <class TInputImage, class TOutputImage>
00030 class ITK_EXPORT ComputeStatisticsWherePositiveFilter : public ImageToImageFilter< TInputImage, TOutputImage >
00031 {
00032 public:
00034   typedef TInputImage InputImageType;
00035   typedef TOutputImage OutputImageType;
00036 
00038   typedef ComputeStatisticsWherePositiveFilter                 Self;
00039   typedef ImageToImageFilter< InputImageType, OutputImageType> Superclass;
00040   typedef SmartPointer<Self>                                   Pointer;
00041   typedef SmartPointer<const Self>                             ConstPointer;
00042 
00044   itkNewMacro(Self);
00045 
00047   itkTypeMacro( ComputeStatisticsWherePositiveFilter, ImageToImageFilter );
00048 
00050   typedef typename InputImageType::PixelType               InputPixelType;
00051   typedef typename OutputImageType::PixelType              OutputPixelType;
00052   typedef typename NumericTraits<InputPixelType>::RealType InputRealType;
00053   typedef typename InputImageType::RegionType              InputImageRegionType;
00054   typedef typename OutputImageType::RegionType             OutputImageRegionType;
00055   typedef typename InputImageType::SizeType                InputSizeType;
00056   
00058   typedef itk::Array<double>                               StoreType;
00059   typedef itk::Array<unsigned long>                        CountType;
00060   
00062   itkGetMacro( Mean, double );
00063   itkGetMacro( Std, double );
00064   itkGetMacro( Min, double );
00065   itkGetMacro( Max, double );
00066   itkGetMacro( Ready, bool );
00067 protected:
00068   ComputeStatisticsWherePositiveFilter();
00069   virtual ~ComputeStatisticsWherePositiveFilter() {}
00070   void ThreadedGenerateData( const OutputImageRegionType& outputRegionForThread, int threadId );
00071   // Override Modified() method to fix the ready variable:
00072   void Modified(){
00073     this->Superclass::Modified();
00074     m_Ready = false;
00075   }
00076   using itk::Object::Modified;
00077   void BeforeThreadedGenerateData();
00078   void AfterThreadedGenerateData();
00079 private:
00080   ComputeStatisticsWherePositiveFilter(const Self&); // purposely not implemented
00081   void operator=(const Self&);                       // purposely not implemented
00082 
00083   // Per-thread values 
00084   StoreType m_TMean;
00085   StoreType m_TStd;
00086   StoreType m_TMin;
00087   StoreType m_TMax;
00088   CountType m_TCount;
00089   
00090   // Overall values:
00091   double m_Mean;
00092   double m_Std;
00093   double m_Min;
00094   double m_Max;
00095 
00096   // Are the data already computed?
00097   bool m_Ready;
00098 };
00099   
00100 } // end namespace itk
00101 
00102 #ifndef ITK_MANUAL_INSTANTIATION
00103 #include "itkComputeStatisticsWherePositiveFilter.txx"
00104 #endif
00105 
00106 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1