ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkRegistrationParameterScalesEstimator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 __itkRegistrationParameterScalesEstimator_h
19 #define __itkRegistrationParameterScalesEstimator_h
20 
21 #include "itkTransform.h"
24 #include "itkIdentityTransform.h"
26 
30 
31 namespace itk
32 {
33 
53 template < typename TMetric >
55  : public OptimizerParameterScalesEstimatorTemplate<typename TMetric::ParametersValueType>
56 {
57 public:
63 
66 
68  typedef typename Superclass::ScalesType ScalesType;
69 
72 
74  typedef typename Superclass::FloatType FloatType;
75 
76  typedef TMetric MetricType;
77  typedef typename MetricType::Pointer MetricPointer;
78  typedef typename MetricType::ConstPointer MetricConstPointer;
79 
81  typedef typename MetricType::FixedTransformType FixedTransformType;
82  typedef typename FixedTransformType::ConstPointer FixedTransformConstPointer;
83 
84  typedef typename MetricType::MovingTransformType MovingTransformType;
85  typedef typename MovingTransformType::ConstPointer MovingTransformConstPointer;
86 
88  itkStaticConstMacro(FixedDimension, SizeValueType, TMetric::FixedDimension );
89  itkStaticConstMacro(MovingDimension, SizeValueType, TMetric::MovingDimension );
90  itkStaticConstMacro(VirtualDimension, SizeValueType, TMetric::VirtualDimension );
92 
93  typedef typename TMetric::VirtualImageType VirtualImageType;
94  typedef typename TMetric::VirtualImageConstPointer VirtualImageConstPointer;
95  typedef typename TMetric::VirtualImagePointer VirtualImagePointer;
96  typedef typename TMetric::VirtualSpacingType VirtualSpacingType;
97  typedef typename TMetric::VirtualRegionType VirtualRegionType;
98  typedef typename TMetric::VirtualSizeType VirtualSizeType;
99  typedef typename TMetric::VirtualPointType VirtualPointType;
100  typedef typename TMetric::VirtualIndexType VirtualIndexType;
101 
102  typedef typename TMetric::VirtualPointSetType VirtualPointSetType;
103  typedef typename TMetric::VirtualPointSetPointer VirtualPointSetPointer;
104 
106  typedef enum { FullDomainSampling = 0,
111 
112  typedef std::vector<VirtualPointType> SamplePointContainerType;
113 
115  typedef typename TMetric::JacobianType JacobianType;
116 
121  itkSetObjectMacro(Metric, MetricType);
122 
127  itkSetMacro(TransformForward, bool);
128  itkGetConstMacro(TransformForward, bool);
130 
132  itkSetObjectMacro(VirtualDomainPointSet, VirtualPointSetType);
133  itkSetConstObjectMacro(VirtualDomainPointSet, VirtualPointSetType);
134  itkGetConstObjectMacro(VirtualDomainPointSet, VirtualPointSetType);
136 
138  itkSetMacro(CentralRegionRadius, IndexValueType);
139 
141  virtual void EstimateScales(ScalesType &scales) = 0;
142 
144  virtual FloatType EstimateStepScale(const ParametersType &step) = 0;
145 
147  virtual void EstimateLocalStepScales(const ParametersType &step, ScalesType &localStepScales) = 0;
148 
151 
153  virtual void SetScalesSamplingStrategy();
154 
156  virtual void SetStepScaleSamplingStrategy();
157 
158 protected:
161 
162  virtual void PrintSelf(std::ostream &os, Indent indent) const;
163 
165  bool CheckAndSetInputs();
166 
168  itkSetMacro(NumberOfRandomSamples, SizeValueType);
169 
172  itkSetMacro(SamplingStrategy, SamplingStrategyType);
173 
179 
185  template< typename TTransform > bool CheckGeneralAffineTransformTemplated();
186 
188  template< typename TTargetPointType > void TransformPoint( const VirtualPointType &point, TTargetPointType &mappedPoint);
189 
191  template< typename TContinuousIndexType > void TransformPointToContinuousIndex( const VirtualPointType &point,TContinuousIndexType &mappedIndex);
192 
194  void ComputeSquaredJacobianNorms( const VirtualPointType & p, ParametersType & squareNorms);
195 
198 
201 
203  bool IsBSplineTransform();
204 
207 
209  void UpdateTransformParameters(const ParametersType &deltaParameters);
210 
212  virtual void SampleVirtualDomain();
213 
216 
219 
222 
225 
228 
231 
234 
237 
240 
243 
246  itkGetMacro( SamplingStrategy, SamplingStrategyType )
247 
248 
250 
253 
256 
259 
262 
264 
265  // the threadhold to decide if the number of random samples uses logarithm
266  static const SizeValueType SizeOfSmallDomain = 1000;
267 
268 private:
269  RegistrationParameterScalesEstimator(const Self&); //purposely not implemented
270  void operator=(const Self&); //purposely not implemented
271 
277 
278  // sampling stategy
280 
281 }; //class RegistrationParameterScalesEstimator
282 
283 
284 } // namespace itk
285 
286 
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkRegistrationParameterScalesEstimator.hxx"
289 #endif
290 
291 #endif /* __itkRegistrationParameterScalesEstimator_h */
Light weight base class for most itk classes.
OptimizerParameters< TInternalComputationValueType > ScalesType
signed long IndexValueType
Definition: itkIntTypes.h:150
void UpdateTransformParameters(const ParametersType &deltaParameters)
void ComputeSquaredJacobianNorms(const VirtualPointType &p, ParametersType &squareNorms)
virtual void PrintSelf(std::ostream &os, Indent indent) const
OptimizerParameterScalesEstimatorTemplate< typename TMetric::ParametersValueType > Superclass
OptimizerParameters< TInternalComputationValueType > ParametersType
void TransformPointToContinuousIndex(const VirtualPointType &point, TContinuousIndexType &mappedIndex)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
OptimizerParameterScalesEstimatorTemplate is the base class offering a empty method of estimating the...
void TransformPoint(const VirtualPointType &point, TTargetPointType &mappedPoint)
virtual void EstimateScales(ScalesType &scales)=0
VirtualRegionType GetVirtualDomainCentralRegion()
Implements a registration helper class for estimating scales of transform parameters and step sizes...
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:58
virtual void EstimateLocalStepScales(const ParametersType &step, ScalesType &localStepScales)=0
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void SampleVirtualDomainWithRegion(VirtualRegionType region)
virtual FloatType EstimateStepScale(const ParametersType &step)=0
const TransformBaseTemplate< typename TMetric::MeasureType > * GetTransform()