ITK  4.8.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 
161 
164 
167 
171 
175 
179 
184 
185 
202  virtual void SetFixedParameters( const FixedParametersType & parameters ) ITK_OVERRIDE;
204 
210 
222  virtual void SetCoefficientImages( const CoefficientImageArray & images ) ITK_OVERRIDE;
223 
224 #ifdef ITKV3_COMPATIBILITY
225  virtual void SetCoefficientImage( const CoefficientImageArray & images )
226  {
227  this->SetCoefficientImages( images );
228  }
229  /* Only for backwards compatibility with ITKv3. */
230  CoefficientImageArray GetCoefficientImage()
231  {
232  return this->GetCoefficientImages();
233  }
234 #endif
235 
238 
240  typedef typename Superclass::SizeType SizeType;
244 
247 
250 
253 
263  virtual void TransformPoint( const InputPointType & inputPoint, OutputPointType & outputPoint,
264  WeightsType & weights, ParameterIndexArrayType & indices, bool & inside ) const ITK_OVERRIDE;
266 
267  virtual void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const ITK_OVERRIDE;
268 
270  virtual NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE;
271 
274 
276  typedef typename Superclass::PixelType PixelType;
277 
279 
281  virtual void SetGridOrigin( const OriginType & );
282 
284  itkGetConstMacro( GridOrigin, OriginType );
285 
287  virtual void SetGridSpacing( const SpacingType & );
288 
290  itkGetConstMacro( GridSpacing, SpacingType );
291 
293  virtual void SetGridDirection( const DirectionType & );
294 
296  itkGetConstMacro( GridDirection, DirectionType );
297 
299  virtual void SetGridRegion( const RegionType & );
300 
302  itkGetConstMacro( GridRegion, RegionType );
303 
304  typedef Transform<TParametersValueType,
305  itkGetStaticConstMacro(SpaceDimension),
306  itkGetStaticConstMacro(SpaceDimension)> BulkTransformType;
307  typedef typename BulkTransformType::ConstPointer BulkTransformPointer;
311  itkSetConstObjectMacro(BulkTransform, BulkTransformType);
312  itkGetConstObjectMacro(BulkTransform, BulkTransformType);
314 
316  itkGetConstReferenceMacro(ValidRegion, RegionType);
317 
318 protected:
320  void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
321 
323  virtual ~BSplineDeformableTransform();
324 
325 private:
326 
328  virtual void SetFixedParametersGridSizeFromTransformDomainInformation() const ITK_OVERRIDE;
329 
331  virtual void SetFixedParametersGridOriginFromTransformDomainInformation() const ITK_OVERRIDE;
332 
334  virtual void SetFixedParametersGridSpacingFromTransformDomainInformation() const ITK_OVERRIDE;
335 
337  virtual void SetFixedParametersGridDirectionFromTransformDomainInformation() const ITK_OVERRIDE;
338 
340  virtual void SetCoefficientImageInformationFromFixedParameters() ITK_OVERRIDE;
341 
342  BSplineDeformableTransform( const Self & ); // purposely not implemented
343  void operator=( const Self & ); // purposely not implemented
344 
346  virtual bool InsideValidRegion( ContinuousIndexType & ) const ITK_OVERRIDE;
347 
356  const RegionType & m_GridRegion;
357  const OriginType & m_GridOrigin;
358  const SpacingType & m_GridSpacing;
359  const DirectionType & m_GridDirection;
360 
362  BulkTransformPointer m_BulkTransform;
363 
364  RegionType m_ValidRegion;
365 
367  unsigned long m_Offset;
371 
372  void UpdateValidGridRegion();
373 
374 }; // class BSplineDeformableTransform
375 } // namespace itk
376 
377 #ifndef ITK_MANUAL_INSTANTIATION
378 #include "itkBSplineDeformableTransform.hxx"
379 #endif
380 
381 #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::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
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:51
Superclass::ParametersType ParametersType
virtual const BulkTransformType * GetBulkTransform() const
Superclass::JacobianType JacobianType