ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkBSplineDeformableTransform.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 itkBSplineDeformableTransform_h
19 #define itkBSplineDeformableTransform_h
20 
21 #include "itkConfigure.h" // Needed to determine value of ITKV3_COMPATIBILITY
23 
24 namespace itk
25 {
113 template<typename TParametersValueType=double,
114  unsigned int NDimensions = 3,
115  unsigned int VSplineOrder = 3>
117  public BSplineBaseTransform<TParametersValueType,NDimensions,VSplineOrder>
118 {
119 public:
125 
127  // Explicit New() method, used here because we need to split the itkNewMacro()
128  // in order to overload the CreateAnother() method so that we can copy the m_BulkTransform
129  // explicitly.
130  // TODO: shouldn't it be done with the Clone() method?
131  itkSimpleNewMacro(Self);
132  virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE
133  {
135  Pointer copyPtr = Self::New().GetPointer();
136  //THE FOLLOWING LINE IS DIFFERENT FROM THE DEFAULT MACRO!
137  copyPtr->m_BulkTransform = this->GetBulkTransform();
138  smartPtr = static_cast<Pointer>( copyPtr );
139  return smartPtr;
140  }
142 
145 
148 
150  itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
151 
153  itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
154 
156  typedef TParametersValueType ScalarType;
157 
163 
166 
169 
173 
177 
181 
186 
187 
204  virtual void SetFixedParameters( const FixedParametersType & parameters ) ITK_OVERRIDE;
206 
211 
223  virtual void SetCoefficientImages( const CoefficientImageArray & images ) ITK_OVERRIDE;
224 
225 #ifdef ITKV3_COMPATIBILITY
226  virtual void SetCoefficientImage( const CoefficientImageArray & images )
227  {
228  this->SetCoefficientImages( images );
229  }
230  /* Only for backwards compatibility with ITKv3. */
231  CoefficientImageArray GetCoefficientImage()
232  {
233  return this->GetCoefficientImages();
234  }
235 #endif
236 
239 
241  typedef typename Superclass::SizeType SizeType;
245 
248 
251 
254 
264  virtual void TransformPoint( const InputPointType & inputPoint, OutputPointType & outputPoint,
265  WeightsType & weights, ParameterIndexArrayType & indices, bool & inside ) const ITK_OVERRIDE;
267 
268  virtual void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const ITK_OVERRIDE;
269 
271  virtual NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE;
272 
275 
277  typedef typename Superclass::PixelType PixelType;
278 
280 
282  virtual void SetGridOrigin( const OriginType & );
283 
285  itkGetConstMacro( GridOrigin, OriginType );
286 
288  virtual void SetGridSpacing( const SpacingType & );
289 
291  itkGetConstMacro( GridSpacing, SpacingType );
292 
294  virtual void SetGridDirection( const DirectionType & );
295 
297  itkGetConstMacro( GridDirection, DirectionType );
298 
300  virtual void SetGridRegion( const RegionType & );
301 
303  itkGetConstMacro( GridRegion, RegionType );
304 
305  typedef Transform<TParametersValueType,
306  itkGetStaticConstMacro(SpaceDimension),
307  itkGetStaticConstMacro(SpaceDimension)> BulkTransformType;
308  typedef typename BulkTransformType::ConstPointer BulkTransformPointer;
312  itkSetConstObjectMacro(BulkTransform, BulkTransformType);
313  itkGetConstObjectMacro(BulkTransform, BulkTransformType);
315 
317  itkGetConstReferenceMacro(ValidRegion, RegionType);
318 
319 protected:
321  void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
322 
324  virtual ~BSplineDeformableTransform();
325 
326 private:
327 
329  virtual void SetFixedParametersGridSizeFromTransformDomainInformation() const ITK_OVERRIDE;
330 
332  virtual void SetFixedParametersGridOriginFromTransformDomainInformation() const ITK_OVERRIDE;
333 
335  virtual void SetFixedParametersGridSpacingFromTransformDomainInformation() const ITK_OVERRIDE;
336 
338  virtual void SetFixedParametersGridDirectionFromTransformDomainInformation() const ITK_OVERRIDE;
339 
341  virtual void SetCoefficientImageInformationFromFixedParameters() ITK_OVERRIDE;
342 
343  BSplineDeformableTransform( const Self & ) ITK_DELETE_FUNCTION;
344  void operator=( const Self & ) ITK_DELETE_FUNCTION;
345 
347  virtual bool InsideValidRegion( ContinuousIndexType & ) const ITK_OVERRIDE;
348 
357  const RegionType & m_GridRegion;
358  const OriginType & m_GridOrigin;
359  const SpacingType & m_GridSpacing;
360  const DirectionType & m_GridDirection;
361 
363  BulkTransformPointer m_BulkTransform;
364 
365  RegionType m_ValidRegion;
366 
368  unsigned long m_Offset;
372 
373  void UpdateValidGridRegion();
374 
375 }; // class BSplineDeformableTransform
376 } // namespace itk
377 
378 #ifndef ITK_MANUAL_INSTANTIATION
379 #include "itkBSplineDeformableTransform.hxx"
380 #endif
381 
382 #endif /* itkBSplineDeformableTransform_h */
Point< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> OutputPointType
CovariantVector< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> InputCovariantVectorType
Superclass::OutputVnlVectorType OutputVnlVectorType
virtual NumberOfParametersType GetNumberOfParameters() const override
Light weight base class for most itk classes.
virtual void SetFixedParametersGridOriginFromTransformDomainInformation() const override
BSplineInterpolationWeightFunction< ScalarType, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder)> WeightsFunctionType
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override
WeightsFunctionType::ContinuousIndexType ContinuousIndexType
virtual void SetGridDirection(const DirectionType &)
void PrintSelf(std::ostream &os, Indent indent) const override
ImageType::SpacingType SpacingType
Vector< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> InputVectorType
virtual bool InsideValidRegion(ContinuousIndexType &) const override
virtual void SetGridOrigin(const OriginType &)
An image region represents a structured region of data.
Image< ParametersValueType, itkGetStaticConstMacro(SpaceDimension)> ImageType
virtual void TransformPoint(const InputPointType &inputPoint, OutputPointType &outputPoint, WeightsType &weights, ParameterIndexArrayType &indices, bool &inside) const override
ImageRegion< itkGetStaticConstMacro(SpaceDimension)> RegionType
Superclass::FixedParametersValueType FixedParametersValueType
Superclass::NumberOfParametersType NumberOfParametersType
ObjectType * GetPointer() const
virtual void SetFixedParameters(const FixedParametersType &parameters) override
Superclass::ContinuousIndexType ContinuousIndexType
virtual void SetCoefficientImages(const CoefficientImageArray &images) override
Superclass::NumberOfParametersType NumberOfParametersType
Array< unsigned long > ParameterIndexArrayType
ParametersType::ValueType ParametersValueType
Superclass::ParametersValueType ParametersValueType
vnl_vector_fixed< TParametersValueType, SpaceDimension > OutputVnlVectorType
virtual ::itk::LightObject::Pointer CreateAnother(void) const override
vnl_vector_fixed< TParametersValueType, SpaceDimension > InputVnlVectorType
virtual void SetCoefficientImageInformationFromFixedParameters() override
CovariantVector< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> OutputCovariantVectorType
WeightsFunctionType::WeightsType WeightsType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Superclass::ParameterIndexArrayType ParameterIndexArrayType
NumberOfParametersType GetNumberOfParametersPerDimension() const override
virtual void SetGridSpacing(const SpacingType &)
Superclass::WeightsFunctionType WeightsFunctionType
Superclass::FixedParametersType FixedParametersType
Superclass::InputCovariantVectorType InputCovariantVectorType
virtual void SetFixedParametersGridDirectionFromTransformDomainInformation() const override
FixedArray< ImagePointer, NDimensions > CoefficientImageArray
BSplineBaseTransform< TParametersValueType, NDimensions, VSplineOrder > Superclass
A base class with common elements of BSplineTransform and BSplineDeformableTransform.
Superclass::FixedParametersType FixedParametersType
virtual void SetFixedParametersGridSpacingFromTransformDomainInformation() const override
Superclass::CoefficientImageArray CoefficientImageArray
OutputPointType TransformPoint(const InputPointType &point) const override
A templated class holding a point in n-Dimensional image space.
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::FixedParametersValueType FixedParametersValueType
Definition: itkTransform.h:116
const CoefficientImageArray GetCoefficientImages() const
Superclass::OutputVectorType OutputVectorType
Point< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> InputPointType
virtual void SetFixedParametersGridSizeFromTransformDomainInformation() const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetGridRegion(const RegionType &)
Superclass::InputVnlVectorType InputVnlVectorType
Vector< TParametersValueType, itkGetStaticConstMacro(SpaceDimension)> OutputVectorType
Deformable transform using a BSpline representation.
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Superclass::ParametersType ParametersType
virtual const BulkTransformType * GetBulkTransform() const
Superclass::JacobianType JacobianType