go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkKNNGraphAlphaMutualInformationImageToImageMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkKNNGraphAlphaMutualInformationImageToImageMetric_h
19 #define __itkKNNGraphAlphaMutualInformationImageToImageMetric_h
20 
23 
25 #include "itkArray.h"
26 #include "itkListSampleCArray.h"
27 #include "itkBinaryTreeBase.h"
29 
31 #include "itkANNkDTree.h"
32 #include "itkANNbdTree.h"
33 #include "itkANNBruteForceTree.h"
34 
39 
41 #include "itkArray2D.h"
42 
43 namespace itk
44 {
73 template< class TFixedImage, class TMovingImage >
75  public MultiInputImageToImageMetricBase< TFixedImage, TMovingImage >
76 {
77 public:
78 
82  TFixedImage, TMovingImage > Superclass;
84  typedef SmartPointer< const Self > ConstPointer;
85 
87  itkNewMacro( Self );
88 
92 
94  typedef typename
110  typedef typename Superclass::RealType RealType;
128  typedef typename
132  typedef typename
134  typedef typename
137 
146 
148  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
149  itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
150 
152  typedef Array< double > MeasurementVectorType;
153  typedef typename MeasurementVectorType::ValueType MeasurementVectorValueType;
154  typedef typename Statistics::ListSampleCArray<
157 
164 
171 
174 
175  typedef typename DerivativeType::ValueType DerivativeValueType;
176  typedef typename TransformJacobianType::ValueType TransformJacobianValueType;
177 
184  void SetANNkDTree( unsigned int bucketSize, std::string splittingRule );
185 
187  void SetANNkDTree( unsigned int bucketSize, std::string splittingRuleFixed,
188  std::string splittingRuleMoving, std::string splittingRuleJoint );
189 
191  void SetANNbdTree( unsigned int bucketSize, std::string splittingRule,
192  std::string shrinkingRule );
193 
195  void SetANNbdTree( unsigned int bucketSize, std::string splittingRuleFixed,
196  std::string splittingRuleMoving, std::string splittingRuleJoint,
197  std::string shrinkingRuleFixed, std::string shrinkingRuleMoving,
198  std::string shrinkingRuleJoint );
199 
201  void SetANNBruteForceTree( void );
202 
209  void SetANNStandardTreeSearch( unsigned int kNearestNeighbors,
210  double errorBound );
211 
213  void SetANNFixedRadiusTreeSearch( unsigned int kNearestNeighbors,
214  double errorBound, double squaredRadius );
215 
217  void SetANNPriorityTreeSearch( unsigned int kNearestNeighbors,
218  double errorBound );
219 
225  virtual void Initialize( void ) throw ( ExceptionObject );
226 
228  void GetDerivative( const TransformParametersType & parameters,
229  DerivativeType & Derivative ) const;
230 
232  MeasureType GetValue( const TransformParametersType & parameters ) const;
233 
235  void GetValueAndDerivative( const TransformParametersType & parameters,
236  MeasureType & Value, DerivativeType & Derivative ) const;
237 
239  itkSetClampMacro( Alpha, double, 0.0, 1.0 );
240 
242  itkGetConstReferenceMacro( Alpha, double );
243 
245  itkSetClampMacro( AvoidDivisionBy, double, 0.0, 1.0 );
246 
248  itkGetConstReferenceMacro( AvoidDivisionBy, double );
249 
250 protected:
251 
254 
256  virtual ~KNNGraphAlphaMutualInformationImageToImageMetric() {}
257 
259  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
260 
262  BinaryKNNTreePointer m_BinaryKNNTreeFixed;
263  BinaryKNNTreePointer m_BinaryKNNTreeMoving;
264  BinaryKNNTreePointer m_BinaryKNNTreeJoint;
265 
266  BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherFixed;
267  BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherMoving;
268  BinaryKNNTreeSearchPointer m_BinaryKNNTreeSearcherJoint;
269 
270  double m_Alpha;
272 
273 private:
274 
275  KNNGraphAlphaMutualInformationImageToImageMetric( const Self & ); // purposely not implemented
276  void operator=( const Self & ); // purposely not implemented
277 
283  typedef std::vector< TransformJacobianType > TransformJacobianContainerType;
284  //typedef std::vector<ParameterIndexArrayType> TransformJacobianIndicesContainerType;
285  typedef std::vector< NonZeroJacobianIndicesType > TransformJacobianIndicesContainerType;
286  typedef Array2D< double > SpatialDerivativeType;
287  typedef std::vector< SpatialDerivativeType > SpatialDerivativeContainerType;
288 
301  const ListSamplePointer & listSampleFixed,
302  const ListSamplePointer & listSampleMoving,
303  const ListSamplePointer & listSampleJoint,
304  const bool & doDerivative,
305  TransformJacobianContainerType & jacobians,
306  TransformJacobianIndicesContainerType & jacobiansIndices,
307  SpatialDerivativeContainerType & spatialDerivatives ) const;
308 
314  const MovingImagePointType & mappedPoint,
315  SpatialDerivativeType & featureGradients ) const;
316 
321  virtual void UpdateDerivativeOfGammas(
322  const SpatialDerivativeType & D1sparse,
323  const SpatialDerivativeType & D2sparse_M,
324  const SpatialDerivativeType & D2sparse_J,
325  //const ParameterIndexArrayType & D1indices,
326  //const ParameterIndexArrayType & D2indices_M,
327  //const ParameterIndexArrayType & D2indices_J,
328  const NonZeroJacobianIndicesType & D1indices,
329  const NonZeroJacobianIndicesType & D2indices_M,
330  const NonZeroJacobianIndicesType & D2indices_J,
331  const MeasurementVectorType & diff_M,
332  const MeasurementVectorType & diff_J,
333  const MeasureType & distance_M,
334  const MeasureType & distance_J,
335  DerivativeType & dGamma_M,
336  DerivativeType & dGamma_J ) const;
337 
338 };
339 
340 } // end namespace itk
341 
342 #ifndef ITK_MANUAL_INSTANTIATION
343 #include "itkKNNGraphAlphaMutualInformationImageToImageMetric.hxx"
344 #endif
345 
346 #endif // end #ifndef __itkKNNGraphAlphaMutualInformationImageToImageMetric_h
Superclass::FixedImageConstPointer FixedImageConstPointer
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
std::vector< InterpolatorPointer > InterpolatorVectorType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
Superclass::MovingImageConstPointer MovingImageConstPointer
void GetDerivative(const TransformParametersType &parameters, DerivativeType &Derivative) const
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
void SetANNStandardTreeSearch(unsigned int kNearestNeighbors, double errorBound)
Implements a metric base class that takes multiple inputs.
std::vector< FixedImageConstPointer > FixedImageVectorType
Superclass::TransformJacobianType TransformJacobianType
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
virtual void EvaluateMovingFeatureImageDerivatives(const MovingImagePointType &mappedPoint, SpatialDerivativeType &featureGradients) const
MeasureType GetValue(const TransformParametersType &parameters) const
virtual void ComputeListSampleValuesAndDerivativePlusJacobian(const ListSamplePointer &listSampleFixed, const ListSamplePointer &listSampleMoving, const ListSamplePointer &listSampleJoint, const bool &doDerivative, TransformJacobianContainerType &jacobians, TransformJacobianIndicesContainerType &jacobiansIndices, SpatialDerivativeContainerType &spatialDerivatives) const
TransformType::InputPointType FixedImagePointType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
ImageSamplerBase< FixedImageType > ImageSamplerType
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
void SetANNkDTree(unsigned int bucketSize, std::string splittingRule)
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
A ListSampleBase that internally uses a CArray, which can be accessed.
Superclass::GradientImageFilterType GradientImageFilterType
std::vector< FixedImageRegionType > FixedImageRegionVectorType
Superclass::MovingImageDerivativeType MovingImageDerivativeType
std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
MultiInputImageToImageMetricBase< TFixedImage, TMovingImage > Superclass
MovingImageType::RegionType MovingImageRegionType
std::vector< MovingImageConstPointer > MovingImageVectorType
virtual void UpdateDerivativeOfGammas(const SpatialDerivativeType &D1sparse, const SpatialDerivativeType &D2sparse_M, const SpatialDerivativeType &D2sparse_J, const NonZeroJacobianIndicesType &D1indices, const NonZeroJacobianIndicesType &D2indices_M, const NonZeroJacobianIndicesType &D2indices_J, const MeasurementVectorType &diff_M, const MeasurementVectorType &diff_J, const MeasureType &distance_M, const MeasureType &distance_J, DerivativeType &dGamma_M, DerivativeType &dGamma_J) const
void SetANNbdTree(unsigned int bucketSize, std::string splittingRule, std::string shrinkingRule)
Statistics::ListSampleCArray< MeasurementVectorType, double > ListSampleType
Superclass::TransformParametersType TransformParametersType
std::vector< MovingImageMaskPointer > MovingImageMaskVectorType
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
std::vector< FixedImageMaskPointer > FixedImageMaskVectorType
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
void SetANNFixedRadiusTreeSearch(unsigned int kNearestNeighbors, double errorBound, double squaredRadius)
virtual void PrintSelf(std::ostream &os, Indent indent) const
Superclass::GradientImageFilterPointer GradientImageFilterPointer
void SetANNPriorityTreeSearch(unsigned int kNearestNeighbors, double errorBound)


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo