36 #ifndef __itkImageMosaicVarianceMetric_h
37 #define __itkImageMosaicVarianceMetric_h
39 #include <itkImageBase.h>
40 #include <itkTransform.h>
41 #include <itkInterpolateImageFunction.h>
42 #include <itkSingleValuedCostFunction.h>
43 #include <itkExceptionObject.h>
44 #include <itkGradientRecursiveGaussianImageFilter.h>
68 template <
class TImage,
class TInterpolator>
74 typedef SingleValuedCostFunction Superclass;
75 typedef SmartPointer<Self> Pointer;
76 typedef SmartPointer<const Self> ConstPointer;
86 typedef TImage image_t;
87 typedef typename TImage::PixelType pixel_t;
90 itkStaticConstMacro(ImageDimension,
unsigned int, TImage::ImageDimension);
92 typedef itk::Image<
unsigned char,
93 itkGetStaticConstMacro(ImageDimension)> mask_t;
96 typedef Transform<Superclass::ParametersValueType,
97 itkGetStaticConstMacro(ImageDimension),
100 typedef typename transform_t::InputPointType point_t;
101 typedef typename transform_t::ParametersType params_t;
102 typedef typename transform_t::JacobianType jacobian_t;
109 typedef CovariantVector<scalar_t, itkGetStaticConstMacro(ImageDimension)>
112 typedef Image<gradient_pixel_t, itkGetStaticConstMacro(ImageDimension)>
115 typedef GradientRecursiveGaussianImageFilter<image_t, gradient_image_t>
125 itkGetConstReferenceMacro( NumberOfPixelsCounted,
unsigned long );
128 itkSetMacro( MosaicRegion,
typename image_t::RegionType );
129 itkGetConstReferenceMacro( MosaicRegion,
typename image_t::RegionType );
150 void setup_param_map(
const std::vector<bool> & params_shared,
151 const std::vector<bool> & params_active);
158 params_t GetTransformParameters()
const;
165 void SetTransformParameters(
const params_t & parameters)
const;
172 unsigned int GetNumberOfParameters()
const;
177 virtual void Initialize() throw (ExceptionObject);
180 measure_t GetValue(const params_t & parameters)
const
183 derivative_t derivative;
184 GetValueAndDerivative(parameters, measure, derivative);
190 derivative_t & derivative)
const
193 GetValueAndDerivative(parameters, measure, derivative);
197 void GetValueAndDerivative(
const params_t & parameters,
199 derivative_t & derivative)
const;
230 const jacobian_t * J_;
234 void CalcMosaicBBox(point_t & mosaic_min,
235 point_t & mosaic_max,
236 std::vector<point_t> & image_min,
237 std::vector<point_t> & image_max)
const;
240 typename image_t::Pointer variance(measure_t & max_var,
241 measure_t & avg_var)
const;
243 typename image_t::Pointer variance(
const typename TImage::SpacingType & sp,
244 const pnt2d_t & mosaic_min,
245 const pnt2d_t & mosaic_max,
247 measure_t & avg_var)
const;
249 typename image_t::Pointer variance(
const typename TImage::SpacingType & sp,
250 const pnt2d_t & mosaic_min,
251 const typename TImage::SizeType & sz,
253 measure_t & avg_var)
const;
255 typename image_t::Pointer variance()
const
259 return variance(max_var, avg_var);
263 std::vector<typename image_t::ConstPointer> image_;
264 std::vector<typename mask_t::ConstPointer> mask_;
267 mutable std::vector<typename transform_t::Pointer> transform_;
270 std::vector<typename interpolator_t::Pointer> interpolator_;
273 std::vector<typename gradient_image_t::ConstPointer> gradient_;
277 std::vector<std::vector<unsigned int> > address_;
280 unsigned int n_shared_;
281 unsigned int n_unique_;
285 std::vector<bool> param_active_;
292 m_NumberOfPixelsCounted(0)
295 virtual ~ImageMosaicVarianceMetric()
299 void PrintSelf(std::ostream & os, Indent indent)
const;
302 mutable unsigned long m_NumberOfPixelsCounted;
306 ImageMosaicVarianceMetric(
const Self &);
307 void operator = (
const Self &);
309 typename image_t::RegionType m_MosaicRegion;
314 #ifndef ITK_MANUAL_INSTANTIATION
315 #include <Core/ITKCommon/Optimizers/itkImageMosaicVarianceMetric.txx>
316 #endif // ITK_MANUAL_INSTANTIATION
318 #endif // __itkImageMosaicVarianceMetric_h
Computes mean pixel variance within the overlapping regions of a mosaic.
Definition: itkImageMosaicVarianceMetric.h:69
Definition: itkNormalizeImageFilterWithMask.h:48
ImageMosaicVarianceMetric Self
Definition: itkImageMosaicVarianceMetric.h:73
Superclass::MeasureType measure_t
Definition: itkImageMosaicVarianceMetric.h:119
Transform< Superclass::ParametersValueType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension)> transform_t
Definition: itkImageMosaicVarianceMetric.h:98
Superclass::DerivativeType derivative_t
Definition: itkImageMosaicVarianceMetric.h:122
Definition: itkImageMosaicVarianceMetric.h:207
void GetDerivative(const params_t ¶meters, derivative_t &derivative) const
Definition: itkImageMosaicVarianceMetric.h:189
float scalar_t
Definition: itkImageMosaicVarianceMetric.h:107
TInterpolator interpolator_t
Definition: itkImageMosaicVarianceMetric.h:85