File: itkMSEImageCalculator.h

package info (click to toggle)
volview 3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 25,204 kB
  • sloc: cpp: 132,585; ansic: 11,612; tcl: 236; sh: 64; makefile: 25; xml: 8
file content (118 lines) | stat: -rw-r--r-- 3,702 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*=========================================================================

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef __itkMSEImageCalculator_h
#define __itkMSEImageCalculator_h

#include "itkObject.h"
#include "itkObjectFactory.h"

namespace itk
{

/** \class MSEImageCalculator
 * This calculator computes the MSE between two images.
 * It is templated over the image types.  
 *
 * \ingroup Operators
 */
template <class TInputImage1, class TInputImage2 = TInputImage1>
class ITK_EXPORT MSEImageCalculator : public Object 
{
public:
  /** Standard class typedefs. */
  typedef MSEImageCalculator Self;
  typedef Object                        Superclass;
  typedef SmartPointer<Self>            Pointer;
  typedef SmartPointer<const Self>      ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(MSEImageCalculator, Object);

  /** Type definition for the input image. */
  typedef TInputImage1  Image1Type;
  typedef TInputImage2  Image2Type;

  /** Pointer type for the image. */
  typedef typename TInputImage1::Pointer  Image1Pointer;
  typedef typename TInputImage2::Pointer  Image2Pointer;
  
  /** Const Pointer type for the image. */
  typedef typename TInputImage1::ConstPointer Image1ConstPointer;
  typedef typename TInputImage2::ConstPointer Image2ConstPointer;

  /** Type definition for the input image pixel type. */
  typedef typename TInputImage1::PixelType Pixel1Type;
  typedef typename TInputImage2::PixelType Pixel2Type;
  
  /** Type definition for the input image index type. */
  typedef typename TInputImage1::IndexType Index1Type;
  typedef typename TInputImage2::IndexType Index2Type;
  
  /** Type definition for the input image region type. */
  typedef typename TInputImage1::RegionType RegionType;

  typedef typename TInputImage1::PointType  PointType;
  typedef typename PointType::VectorType    VectorType;

  /** Set the input image. */
  itkSetConstObjectMacro(Image1,Image1Type);
  itkSetConstObjectMacro(Image2,Image2Type);

  /** Compute the minimum and maximum values of intensity of the input image. 
   * Returns the MSE computed */
  double Compute();

  /** Return the minimum intensity value. */
  itkGetConstMacro(MSE,double); 
  
  /** Set the region over which the values will be computed */
  void SetRegion( const RegionType & region );

  /** Set the radius. This calculator computes the MSE of the sphere within a 
   * particular radius from the center */
  itkSetMacro( Radius, double );
  itkGetMacro( Radius, double );
  itkSetMacro( Center, PointType );
  itkGetMacro( Center, PointType );

protected:
  MSEImageCalculator();
  virtual ~MSEImageCalculator() {};
  void PrintSelf(std::ostream& os, Indent indent) const;

private:
  MSEImageCalculator(const Self&); //purposely not implemented
  void operator=(const Self&); //purposely not implemented
  
  PointType            m_Center;
  double               m_Radius;
  double               m_MSE;
  Image1ConstPointer   m_Image1;
  Image2ConstPointer   m_Image2;

  RegionType           m_Region;
  bool                 m_RegionSetByUser;
};

} // end namespace itk


#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMSEImageCalculator.txx"
#endif

#endif /* __itkMSEImageCalculator_h */