go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxElastixMain.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 __elxElastixMain_h
19 #define __elxElastixMain_h
20 
21 #include "elxComponentDatabase.h"
22 #include "elxComponentLoader.h"
23 
24 #include "elxElastixBase.h"
25 #include "itkObject.h"
26 
27 #include <iostream>
28 #include <fstream>
29 
31 
32 #ifdef ELASTIX_USE_OPENCL
33 #include "itkOpenCLContext.h"
34 #endif
35 
36 namespace elastix
37 {
38 
44 
55 extern int xoutSetup( const char * logfilename, bool setupLogging, bool setupCout );
56 
98 class ElastixMain : public itk::Object
99 {
100 public:
101 
103  typedef ElastixMain Self;
104  typedef itk::Object Superclass;
105  typedef itk::SmartPointer< Self > Pointer;
106  typedef itk::SmartPointer< const Self > ConstPointer;
107 
109  itkNewMacro( Self );
110 
112  itkTypeMacro( ElastixMain, Object );
113 
117  typedef itk::Object ObjectType;
118  typedef ObjectType::Pointer ObjectPointer;
119  typedef itk::DataObject DataObjectType;
120  typedef DataObjectType::Pointer DataObjectPointer;
121 
132 
143 
147 
150 
152  itkSetMacro( FixedImagePixelType, PixelTypeDescriptionType );
153  itkSetMacro( MovingImagePixelType, PixelTypeDescriptionType );
154  itkSetMacro( FixedImageDimension, ImageDimensionType );
155  itkSetMacro( MovingImageDimension, ImageDimensionType );
156  itkGetMacro( FixedImagePixelType, PixelTypeDescriptionType );
157  itkGetMacro( MovingImagePixelType, PixelTypeDescriptionType );
158  itkGetMacro( FixedImageDimension, ImageDimensionType );
159  itkGetMacro( MovingImageDimension, ImageDimensionType );
160 
165  itkSetObjectMacro( FixedImageContainer, DataObjectContainerType );
166  itkSetObjectMacro( MovingImageContainer, DataObjectContainerType );
167  itkGetObjectMacro( FixedImageContainer, DataObjectContainerType );
168  itkGetObjectMacro( MovingImageContainer, DataObjectContainerType );
169 
174  itkSetObjectMacro( FixedMaskContainer, DataObjectContainerType );
175  itkSetObjectMacro( MovingMaskContainer, DataObjectContainerType );
176  itkGetObjectMacro( FixedMaskContainer, DataObjectContainerType );
177  itkGetObjectMacro( MovingMaskContainer, DataObjectContainerType );
178 
183  itkSetObjectMacro( ResultImageContainer, DataObjectContainerType );
184  itkGetObjectMacro( ResultImageContainer, DataObjectContainerType );
185 
186  itkSetObjectMacro( ResultDeformationFieldContainer, DataObjectContainerType );
187  itkGetObjectMacro( ResultDeformationFieldContainer, DataObjectContainerType );
188 
190  itkSetObjectMacro( Configuration, ConfigurationType );
191  itkGetObjectMacro( Configuration, ConfigurationType );
192 
197  itkGetObjectMacro( Elastix, ObjectType );
198 
202  virtual ElastixBaseType * GetElastixBase( void ) const;
203 
209  itkGetObjectMacro( FinalTransform, ObjectType );
210 
215  itkSetObjectMacro( InitialTransform, ObjectType );
216  itkGetObjectMacro( InitialTransform, ObjectType );
217 
221  const FlatDirectionCosinesType & arg );
222 
223  virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat( void ) const;
224 
226  void SetElastixLevel( unsigned int level );
227 
228  unsigned int GetElastixLevel( void );
229 
231  void SetTotalNumberOfElastixLevels( unsigned int levels );
232 
233  unsigned int GetTotalNumberOfElastixLevels( void );
234 
236  itkGetConstMacro( DBIndex, DBIndexType );
237 
242  virtual void EnterCommandLineArguments( ArgumentMapType & argmap );
243 
244  virtual void EnterCommandLineArguments( ArgumentMapType & argmap,
245  ParameterMapType & inputMap );
246 
247  // Version used when elastix is used as a library.
248  virtual void EnterCommandLineArguments( ArgumentMapType & argmap,
249  std::vector< ParameterMapType > & inputMaps );
250 
256  virtual int Run( void );
257 
262  virtual int Run( ArgumentMapType & argmap );
263 
264  virtual int Run( ArgumentMapType & argmap, ParameterMapType & inputMap );
265 
270  virtual void SetProcessPriority( void ) const;
271 
276  virtual void SetMaximumNumberOfThreads( void ) const;
277 
280  {
281  return s_CDB.GetPointer();
282  }
283 
284 
286  {
287  if( s_CDB != arg )
288  {
289  s_CDB = arg;
290  }
291  }
292 
293 
295  virtual ParameterMapType GetTransformParametersMap( void ) const;
296 
297  static void UnloadComponents( void );
298 
299 protected:
300 
301  ElastixMain();
302  virtual ~ElastixMain();
303 
307  ObjectPointer m_Elastix;
308 
310  ConfigurationPointer m_Configuration;
311 
313  std::vector< ConfigurationPointer > m_Configurations;
314 
316  PixelTypeDescriptionType m_FixedImagePixelType;
317  ImageDimensionType m_FixedImageDimension;
318  PixelTypeDescriptionType m_MovingImagePixelType;
319  ImageDimensionType m_MovingImageDimension;
320 
321  DBIndexType m_DBIndex;
322 
324  DataObjectContainerPointer m_FixedImageContainer;
325  DataObjectContainerPointer m_MovingImageContainer;
326  DataObjectContainerPointer m_FixedMaskContainer;
327  DataObjectContainerPointer m_MovingMaskContainer;
328  DataObjectContainerPointer m_ResultImageContainer;
329  DataObjectContainerPointer m_ResultDeformationFieldContainer;
330 
332  ObjectPointer m_FinalTransform;
333 
335  ObjectPointer m_InitialTransform;
339  ParameterMapType m_TransformParametersMap;
340 
341  FlatDirectionCosinesType m_OriginalFixedImageDirection;
342 
343  static ComponentDatabasePointer s_CDB;
344  static ComponentLoaderPointer s_ComponentLoader;
345  virtual int LoadComponents( void );
346 
351  virtual int InitDBIndex( void );
352 
356  virtual ObjectPointer CreateComponent( const ComponentDescriptionType & name );
357 
373  virtual ObjectContainerPointer CreateComponents(
374  const ComponentDescriptionType & key,
375  const ComponentDescriptionType & defaultComponentName,
376  int & errorcode,
377  bool mandatoryComponent = true );
378 
380  void GetImageInformationFromFile( const std::string & filename,
381  ImageDimensionType & imageDimension ) const;
382 
383 private:
384 
385  ElastixMain( const Self & ); // purposely not implemented
386  void operator=( const Self & ); // purposely not implemented
387 
388 };
389 
390 } // end namespace elastix
391 
392 #endif // end #ifndef __elxElastixMain_h
DataObjectType::Pointer DataObjectPointer
DataObjectContainerPointer m_FixedImageContainer
DataObjectContainerType::Pointer DataObjectContainerPointer
ObjectPointer(* PtrToCreator)(void)
static ComponentDatabase * GetComponentDatabase(void)
static ComponentLoaderPointer s_ComponentLoader
std::vector< ConfigurationPointer > m_Configurations
static void UnloadComponents(void)
itk::SmartPointer< Self > Pointer
virtual void SetOriginalFixedImageDirectionFlat(const FlatDirectionCosinesType &arg)
virtual void EnterCommandLineArguments(ArgumentMapType &argmap)
ElastixBase::ConfigurationType ConfigurationType
virtual ObjectContainerPointer CreateComponents(const ComponentDescriptionType &key, const ComponentDescriptionType &defaultComponentName, int &errorcode, bool mandatoryComponent=true)
ObjectPointer m_FinalTransform
DataObjectContainerPointer m_ResultImageContainer
static ComponentDatabasePointer s_CDB
ElastixBase::ObjectContainerPointer ObjectContainerPointer
itk::SmartPointer< Self > Pointer
ImageDimensionType m_FixedImageDimension
DataObjectContainerPointer m_MovingMaskContainer
int xoutSetup(const char *logfilename, bool setupLogging, bool setupCout)
ElastixBase::DataObjectContainerType DataObjectContainerType
std::vector< double > FlatDirectionCosinesType
ComponentDatabase ComponentDatabaseType
itk::SmartPointer< Self > Pointer
itk::VectorContainer< unsigned int, ObjectPointer > ObjectContainerType
void GetImageInformationFromFile(const std::string &filename, ImageDimensionType &imageDimension) const
ParameterFileParser::ParameterMapType ParameterMapType
ConfigurationType::Pointer ConfigurationPointer
ComponentDatabaseType::PtrToCreator PtrToCreator
ElastixBase::FlatDirectionCosinesType FlatDirectionCosinesType
ConfigurationType::CommandLineArgumentMapType ArgumentMapType
PixelTypeDescriptionType m_FixedImagePixelType
virtual ParameterMapType GetTransformParametersMap(void) const
DataObjectContainerPointer m_FixedMaskContainer
virtual int InitDBIndex(void)
DataObjectContainerPointer m_ResultDeformationFieldContainer
ComponentDatabaseType::Pointer ComponentDatabasePointer
ComponentDatabaseType::PixelTypeDescriptionType PixelTypeDescriptionType
itk::SmartPointer< const Self > ConstPointer
ComponentLoaderType::Pointer ComponentLoaderPointer
virtual void SetProcessPriority(void) const
ObjectPointer m_Elastix
PixelTypeDescriptionType m_MovingImagePixelType
ObjectType::Pointer ObjectPointer
A class with all functionality to configure elastix.
DataObjectContainerPointer m_MovingImageContainer
FlatDirectionCosinesType m_OriginalFixedImageDirection
Determines which components (metrics, transforms, etc.) are available.
virtual ObjectPointer CreateComponent(const ComponentDescriptionType &name)
itk::DataObject DataObjectType
itk::SmartPointer< Self > Pointer
itk::ParameterMapInterface::ParameterMapType ParameterMapType
ElastixBase::ObjectContainerType ObjectContainerType
void SetTotalNumberOfElastixLevels(unsigned int levels)
ImageDimensionType m_MovingImageDimension
void operator=(const Self &)
ElastixBase::DataObjectContainerPointer DataObjectContainerPointer
ObjectContainerType::Pointer ObjectContainerPointer
ElastixBase ElastixBaseType
ParameterMapType m_TransformParametersMap
ObjectPointer m_InitialTransform
ConfigurationPointer m_Configuration
ComponentLoader ComponentLoaderType
A class that deals with user given parameters and command line arguments.
ComponentDatabaseType::ImageDimensionType ImageDimensionType
The ComponentDatabase class is a class that stores the New() functions of all components.
ComponentDatabaseType::IndexType DBIndexType
ComponentDatabaseType::ComponentDescriptionType ComponentDescriptionType
virtual int LoadComponents(void)
virtual void SetMaximumNumberOfThreads(void) const
itk::VectorContainer< unsigned int, DataObjectPointer > DataObjectContainerType
void SetElastixLevel(unsigned int level)
virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat(void) const
static void SetComponentDatabase(ComponentDatabase *arg)
unsigned int GetTotalNumberOfElastixLevels(void)
This class creates an interface for elastix.
virtual ElastixBaseType * GetElastixBase(void) const
std::map< std::string, std::string > CommandLineArgumentMapType
unsigned int GetElastixLevel(void)
virtual int Run(void)


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo