go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxTransformBase.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 __elxTransformBase_h
19#define __elxTransformBase_h
20
22#include "elxMacro.h"
23
24#include "elxBaseComponentSE.h"
28#include "elxProgressCommand.h"
29
30#include <memory> // For unique_ptr.
31
32namespace elastix
33{
34//using namespace itk; //Not here, because a TransformBase class was added to ITK...
35
127template< class TElastix >
129 public BaseComponentSE< TElastix >
130{
131public:
133
137
140
142 using typename Superclass::ElastixType;
143 using typename Superclass::ElastixPointer;
144 using typename Superclass::ConfigurationType;
146 using typename Superclass::RegistrationType;
147 using typename Superclass::RegistrationPointer;
148
149 typedef typename ConfigurationType
151 typedef typename ConfigurationType
153
155 typedef typename ElastixType::CoordRepType CoordRepType;
156 typedef typename ElastixType::FixedImageType FixedImageType;
157 typedef typename ElastixType::MovingImageType MovingImageType;
158
163
166
168 itkStaticConstMacro( FixedImageDimension,
169 unsigned int, FixedImageType::ImageDimension );
170
172 itkStaticConstMacro( MovingImageDimension,
173 unsigned int, MovingImageType::ImageDimension );
174
176 typedef itk::Object ObjectType;
179 itkGetStaticConstMacro( FixedImageDimension ),
180 itkGetStaticConstMacro( MovingImageDimension ) > ITKBaseType;
182 itkGetStaticConstMacro( FixedImageDimension ) > CombinationTransformType;
183 typedef typename
185
188 typedef typename ParametersType::ValueType ValueType;
189
193
195 typedef itk::Vector<
196 float, FixedImageDimension > VectorPixelType;
197 typedef itk::Image<
199
201 typedef typename RegistrationType::ITKBaseType ITKRegistrationType;
202 typedef typename ITKRegistrationType::OptimizerType OptimizerType;
203 typedef typename OptimizerType::ScalesType ScalesType;
204
206 typedef typename ElastixType::ParameterMapType ParameterMapType;
207
210 {
211 return dynamic_cast< ITKBaseType * >( this );
212 }
213
214
216 virtual const ITKBaseType * GetAsITKBaseType( void ) const
217 {
218 return dynamic_cast< const ITKBaseType * >( this );
219 }
220
221
223 {
224 return dynamic_cast< const CombinationTransformType * >( this );
225 }
226
227
229 {
230 return dynamic_cast< CombinationTransformType * >( this );
231 }
232
233
237 int BeforeAllBase( void ) override;
238
242 virtual int BeforeAllTransformix( void );
243
247 void BeforeRegistrationBase( void ) override;
248
252 void AfterRegistrationBase( void ) override;
253
255 virtual const InitialTransformType * GetInitialTransform( void ) const;
256
259
261 virtual void SetTransformParametersFileName( const char * filename );
262
264 itkGetStringMacro( TransformParametersFileName );
265
267 virtual void ReadFromFile( void );
268
271 const ParametersType & param, ParameterMapType * paramsMap ) const;
272
274 virtual void WriteToFile( const ParametersType & param ) const;
275
277 virtual void WriteToFile( void ) const;
278
280 virtual void SetReadWriteTransformParameters( const bool _arg );
281
284 const char * transformParameterFileName );
285
289 virtual void ReadInitialTransformFromVector( const size_t index );
290
292 virtual void TransformPoints( void ) const;
293
295 virtual void TransformPointsSomePoints( const std::string filename ) const;
296
298 virtual void TransformPointsSomePointsVTK( const std::string filename ) const;
299
308 typename DeformationFieldImageType::Pointer GenerateDeformationFieldImage( void ) const;
309
310 void WriteDeformationFieldImage( typename DeformationFieldImageType::Pointer ) const;
311
313 virtual void TransformPointsAllPoints(void) const;
314
316 virtual void ComputeDeterminantOfSpatialJacobian( void ) const;
317
319 virtual void ComputeSpatialJacobian( void ) const;
320
324 virtual void SetFinalParameters( void );
325
326protected:
327
329 TransformBase() = default;
331 ~TransformBase() override = default;
332
339 void AutomaticScalesEstimation( ScalesType & scales ) const;
340
349 const unsigned int & numSubTransforms, ScalesType & scales ) const;
350
351private:
352
354 std::unique_ptr<ParametersType> m_TransformParametersPointer{};
357
360
362 {
363 if( !this->GetInitialTransform() )
364 {
365 return "NoInitialTransform";
366 }
367
368 const Self * t0 = dynamic_cast<const Self *>( this->GetInitialTransform() );
370 }
371
374
375};
376
377} // end namespace elastix
378
379#ifndef ITK_MANUAL_INSTANTIATION
380#include "elxTransformBase.hxx"
381#endif
382
383#endif // end #ifndef __elxTransformBase_h
The BaseComponentSE class is a base class for elastix components that provides some basic functionali...
Configuration::Pointer ConfigurationPointer
itk::WeakPointer< ElastixType > ElastixPointer
RegistrationType * RegistrationPointer
ElastixType::RegistrationBaseType RegistrationType
The ComponentDatabase class is a class that stores the New() functions of all components.
ObjectPointer(* PtrToCreator)(void)
std::map< std::string, std::string > CommandLineArgumentMapType
CommandLineArgumentMapType::value_type CommandLineEntryType
A specialized Command object for updating the progress of a filter.
This class is the elastix base class for all Transforms.
virtual void ReadInitialTransformFromFile(const char *transformParameterFileName)
virtual int BeforeAllTransformix(void)
ElastixType::FixedImageType FixedImageType
void BeforeRegistrationBase(void) override
std::string GetInitialTransformParametersFileName(void) const
ComponentDatabase ComponentDatabaseType
ITKRegistrationType::OptimizerType OptimizerType
ElastixType::ParameterMapType ParameterMapType
virtual void ComputeSpatialJacobian(void) const
virtual const char * GetTransformParametersFileName() const
DeformationFieldImageType::Pointer GenerateDeformationFieldImage(void) const
ParametersType::ValueType ValueType
virtual void ReadFromFile(void)
itk::AdvancedCombinationTransform< CoordRepType, itkGetStaticConstMacro(FixedImageDimension) > CombinationTransformType
ITKBaseType::InputPointType InputPointType
OptimizerType::ScalesType ScalesType
void AfterRegistrationBase(void) override
ComponentDatabase::PtrToCreator PtrToCreator
std::unique_ptr< ParametersType > m_TransformParametersPointer
elx::ProgressCommand ProgressCommandType
itk::Vector< float, FixedImageDimension > VectorPixelType
void AutomaticScalesEstimation(ScalesType &scales) const
ITK_DISALLOW_COPY_AND_ASSIGN(TransformBase)
int BeforeAllBase(void) override
ElastixType::MovingImageType MovingImageType
ParametersType m_FinalParameters
virtual void ReadInitialTransformFromVector(const vcl_size_t index)
RegistrationType::ITKBaseType ITKRegistrationType
virtual void SetTransformParametersFileName(const char *filename)
ITKBaseType::ParametersType ParametersType
virtual void TransformPointsSomePointsVTK(const std::string filename) const
virtual void WriteToFile(void) const
virtual const CombinationTransformType * GetAsCombinationTransform(void) const
virtual void TransformPointsAllPoints(void) const
virtual void WriteToFile(const ParametersType &param) const
ConfigurationType::CommandLineArgumentMapType CommandLineArgumentMapType
std::string m_TransformParametersFileName
virtual void TransformPointsSomePoints(const std::string filename) const
virtual CombinationTransformType * GetAsCombinationTransform(void)
virtual void SetReadWriteTransformParameters(const bool _arg)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
ElastixType::CoordRepType CoordRepType
itk::Image< VectorPixelType, FixedImageDimension > DeformationFieldImageType
void AutomaticScalesEstimationStackTransform(const unsigned int &numSubTransforms, ScalesType &scales) const
ITKBaseType::OutputPointType OutputPointType
itk::AdvancedTransform< CoordRepType, itkGetStaticConstMacro(FixedImageDimension), itkGetStaticConstMacro(MovingImageDimension) > ITKBaseType
ConfigurationType::CommandLineEntryType CommandLineEntryType
BaseComponentSE< TElastix > Superclass
virtual void CreateTransformParametersMap(const ParametersType &param, ParameterMapType *paramsMap) const
ComponentDatabaseType::ComponentDescriptionType ComponentDescriptionType
virtual ITKBaseType * GetAsITKBaseType(void)
void WriteDeformationFieldImage(typename DeformationFieldImageType::Pointer) const
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
virtual void SetInitialTransform(InitialTransformType *_arg)
virtual void TransformPoints(void) const
virtual void ComputeDeterminantOfSpatialJacobian(void) const
bool m_UseBinaryFormatForTransformationParameters
virtual const ITKBaseType * GetAsITKBaseType(void) const
~TransformBase() override=default
CombinationTransformType::InitialTransformType InitialTransformType
virtual void SetFinalParameters(void)
virtual const InitialTransformType * GetInitialTransform(void) const
This class combines two transforms: an 'initial transform' with a 'current transform'.
Transform maps points, vectors and covariant vectors from an input space to an output space.
Superclass::ParametersType ParametersType
Superclass::OutputPointType OutputPointType
Superclass::InputPointType InputPointType


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo