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 
187  itkSetObjectMacro( Configuration, ConfigurationType );
188  itkGetObjectMacro( Configuration, ConfigurationType );
189 
194  itkGetObjectMacro( Elastix, ObjectType );
195 
199  virtual ElastixBaseType * GetElastixBase( void ) const;
200 
206  itkGetObjectMacro( FinalTransform, ObjectType );
207 
212  itkSetObjectMacro( InitialTransform, ObjectType );
213  itkGetObjectMacro( InitialTransform, ObjectType );
214 
218  const FlatDirectionCosinesType & arg );
219 
220  virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat( void ) const;
221 
223  void SetElastixLevel( unsigned int level );
224 
225  unsigned int GetElastixLevel( void );
226 
228  void SetTotalNumberOfElastixLevels( unsigned int levels );
229 
230  unsigned int GetTotalNumberOfElastixLevels( void );
231 
233  itkGetConstMacro( DBIndex, DBIndexType );
234 
239  virtual void EnterCommandLineArguments( ArgumentMapType & argmap );
240 
241  virtual void EnterCommandLineArguments( ArgumentMapType & argmap,
242  ParameterMapType & inputMap );
243 
244  // Version used when elastix is used as a library.
245  virtual void EnterCommandLineArguments( ArgumentMapType & argmap,
246  std::vector< ParameterMapType > & inputMaps );
247 
253  virtual int Run( void );
254 
259  virtual int Run( ArgumentMapType & argmap );
260 
261  virtual int Run( ArgumentMapType & argmap, ParameterMapType & inputMap );
262 
267  virtual void SetProcessPriority( void ) const;
268 
273  virtual void SetMaximumNumberOfThreads( void ) const;
274 
277  {
278  return s_CDB.GetPointer();
279  }
280 
281 
283  {
284  if( s_CDB != arg )
285  {
286  s_CDB = arg;
287  }
288  }
289 
290 
292  virtual ParameterMapType GetTransformParametersMap( void ) const;
293 
294  static void UnloadComponents( void );
295 
296 protected:
297 
298  ElastixMain();
299  virtual ~ElastixMain();
300 
304  ObjectPointer m_Elastix;
305 
307  ConfigurationPointer m_Configuration;
308 
310  std::vector< ConfigurationPointer > m_Configurations;
311 
313  PixelTypeDescriptionType m_FixedImagePixelType;
314  ImageDimensionType m_FixedImageDimension;
315  PixelTypeDescriptionType m_MovingImagePixelType;
316  ImageDimensionType m_MovingImageDimension;
317 
318  DBIndexType m_DBIndex;
319 
321  DataObjectContainerPointer m_FixedImageContainer;
322  DataObjectContainerPointer m_MovingImageContainer;
323  DataObjectContainerPointer m_FixedMaskContainer;
324  DataObjectContainerPointer m_MovingMaskContainer;
325  DataObjectContainerPointer m_ResultImageContainer;
326 
328  ObjectPointer m_FinalTransform;
329 
331  ObjectPointer m_InitialTransform;
335  ParameterMapType m_TransformParametersMap;
336 
337  FlatDirectionCosinesType m_OriginalFixedImageDirection;
338 
339  static ComponentDatabasePointer s_CDB;
340  static ComponentLoaderPointer s_ComponentLoader;
341  virtual int LoadComponents( void );
342 
347  virtual int InitDBIndex( void );
348 
352  virtual ObjectPointer CreateComponent( const ComponentDescriptionType & name );
353 
369  virtual ObjectContainerPointer CreateComponents(
370  const ComponentDescriptionType & key,
371  const ComponentDescriptionType & defaultComponentName,
372  int & errorcode,
373  bool mandatoryComponent = true );
374 
376  void GetImageInformationFromFile( const std::string & filename,
377  ImageDimensionType & imageDimension ) const;
378 
379 private:
380 
381  ElastixMain( const Self & ); // purposely not implemented
382  void operator=( const Self & ); // purposely not implemented
383 
384 };
385 
386 } // end namespace elastix
387 
388 #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 ElastixBaseType * GetElastixBase(void) const
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
ParameterFileParser::ParameterMapType ParameterMapType
ConfigurationType::Pointer ConfigurationPointer
ComponentDatabaseType::PtrToCreator PtrToCreator
ElastixBase::FlatDirectionCosinesType FlatDirectionCosinesType
virtual void SetMaximumNumberOfThreads(void) const
ConfigurationType::CommandLineArgumentMapType ArgumentMapType
PixelTypeDescriptionType m_FixedImagePixelType
DataObjectContainerPointer m_FixedMaskContainer
virtual int InitDBIndex(void)
void GetImageInformationFromFile(const std::string &filename, ImageDimensionType &imageDimension) const
ComponentDatabaseType::Pointer ComponentDatabasePointer
ComponentDatabaseType::PixelTypeDescriptionType PixelTypeDescriptionType
itk::SmartPointer< const Self > ConstPointer
ComponentLoaderType::Pointer ComponentLoaderPointer
virtual ParameterMapType GetTransformParametersMap(void) const
ObjectPointer m_Elastix
PixelTypeDescriptionType m_MovingImagePixelType
virtual void SetProcessPriority(void) const
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)
itk::VectorContainer< unsigned int, DataObjectPointer > DataObjectContainerType
void SetElastixLevel(unsigned int level)
static void SetComponentDatabase(ComponentDatabase *arg)
virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat(void) const
unsigned int GetTotalNumberOfElastixLevels(void)
This class creates an interface for elastix.
std::map< std::string, std::string > CommandLineArgumentMapType
unsigned int GetElastixLevel(void)
virtual int Run(void)


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo