SMILX  1.01
elxElastixMain.cxx
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
19 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
20 #include <windows.h>
21 #endif
22 
23 #include "elxElastixMain.h"
24 #include "elxMacro.h"
25 #include "itkMultiThreader.h"
26 
27 namespace elastix
28 {
29 
30 using namespace xl;
31 
42 xoutbase_type g_xout;
43 xoutsimple_type g_WarningXout;
44 xoutsimple_type g_ErrorXout;
45 xoutsimple_type g_StandardXout;
46 xoutsimple_type g_CoutOnlyXout;
47 xoutsimple_type g_LogOnlyXout;
48 std::ofstream g_LogFileStream;
49 
57 int
58 xoutSetup( const char * logfilename, bool setupLogging, bool setupCout )
59 {
61  using namespace xl;
62 
63  int returndummy = 0;
64  set_xout( &g_xout );
65 
66  if( setupLogging )
67  {
69  g_LogFileStream.open( logfilename );
70  if( !g_LogFileStream.is_open() )
71  {
72  std::cerr << "ERROR: LogFile cannot be opened!" << std::endl;
73  return 1;
74  }
75  }
76 
78  if( setupLogging )
79  {
80  returndummy |= xout.AddOutput( "log", &g_LogFileStream );
81  }
82  if( setupCout )
83  {
84  returndummy |= xout.AddOutput( "cout", &std::cout );
85  }
86 
88  returndummy |= g_LogOnlyXout.AddOutput( "log", &g_LogFileStream );
89  returndummy |= g_CoutOnlyXout.AddOutput( "cout", &std::cout );
90 
92  g_WarningXout.SetOutputs( xout.GetCOutputs() );
93  g_ErrorXout.SetOutputs( xout.GetCOutputs() );
94  g_StandardXout.SetOutputs( xout.GetCOutputs() );
95 
96  g_WarningXout.SetOutputs( xout.GetXOutputs() );
97  g_ErrorXout.SetOutputs( xout.GetXOutputs() );
98  g_StandardXout.SetOutputs( xout.GetXOutputs() );
99 
101  returndummy |= xout.AddTargetCell( "warning", &g_WarningXout );
102  returndummy |= xout.AddTargetCell( "error", &g_ErrorXout );
103  returndummy |= xout.AddTargetCell( "standard", &g_StandardXout );
104  returndummy |= xout.AddTargetCell( "logonly", &g_LogOnlyXout );
105  returndummy |= xout.AddTargetCell( "coutonly", &g_CoutOnlyXout );
106 
108  xout[ "standard" ] << std::fixed;
109  xout[ "standard" ] << std::showpoint;
110 
112  return returndummy;
113 
114 } // end xoutSetup()
115 
116 
117 
123 {
125  this->m_Configuration = ConfigurationType::New();
126 
127  this->m_Elastix = 0;
128 
129  this->m_FixedImagePixelType = "";
130  this->m_FixedImageDimension = 0;
131 
132  this->m_MovingImagePixelType = "";
133  this->m_MovingImageDimension = 0;
134 
135  this->m_DBIndex = 0;
136 
137  this->m_FixedImageContainer = 0;
138  this->m_MovingImageContainer = 0;
139 
140  this->m_FixedMaskContainer = 0;
141  this->m_MovingMaskContainer = 0;
142 
143  this->m_ResultImageContainer = 0;
144 
145  this->m_FinalTransform = 0;
146  this->m_InitialTransform = 0;
147  this->m_TransformParametersMap.clear();
148 
149 } // end Constructor
150 
151 
156 ElastixMain::ComponentDatabasePointer ElastixMain::s_CDB = 0;
157 ElastixMain::ComponentLoaderPointer ElastixMain::s_ComponentLoader = 0;
158 
164 {
165  //nothing
166 } // end Destructor
167 
168 
173 void
175 ::EnterCommandLineArguments( ArgumentMapType & argmap )
176 {
177 
181  int dummy = this->m_Configuration->Initialize( argmap );
182  if( dummy )
183  {
184  xout[ "error" ] << "ERROR: Something went wrong during initialisation "
185  << "of the configuration object." << std::endl;
186  }
187 
188 } // end EnterCommandLineParameters()
189 
190 
195 void
197 ::EnterCommandLineArguments( ArgumentMapType & argmap,
198  ParameterMapType & inputMap )
199 {
203  int dummy = this->m_Configuration->Initialize( argmap, inputMap );
204  if( dummy )
205  {
206  xout[ "error" ] << "ERROR: Something went wrong during initialisation of the configuration object." << std::endl;
207  }
208 
209 } // end EnterCommandLineArguments()
210 
211 
216 void
218 ::EnterCommandLineArguments( ArgumentMapType & argmap,
219  std::vector< ParameterMapType > & inputMaps )
220 {
221  this->m_Configurations.clear();
222  this->m_Configurations.resize( inputMaps.size() );
223 
224  for( size_t i = 0; i < inputMaps.size(); ++i )
225  {
229  this->m_Configurations[ i ] = ConfigurationType::New();
230  int dummy = this->m_Configurations[ i ]->Initialize( argmap, inputMaps[ i ] );
231  if( dummy )
232  {
233  xout[ "error" ] << "ERROR: Something went wrong during initialisation of configuration object " << i << "." << std::endl;
234  }
235  }
236 
238  this->m_Configuration = this->m_Configurations[ inputMaps.size() - 1 ];
239 } // end EnterCommandLineArguments()
240 
241 
249 int
251 {
252 
254  this->SetProcessPriority();
255  this->SetMaximumNumberOfThreads();
256 
258  int errorCode = this->InitDBIndex();
259  if( errorCode != 0 )
260  {
261  return errorCode;
262  }
263 
265  try
266  {
268  this->m_Elastix = this->CreateComponent( "Elastix" );
269  }
270  catch( itk::ExceptionObject & excp )
271  {
273  xl::xout[ "error" ] << excp << std::endl;
274  errorCode = 1;
275  return errorCode;
276  }
277 
279  this->GetElastixBase()->SetConfiguration( this->m_Configuration );
280  this->GetElastixBase()->SetComponentDatabase( this->s_CDB );
281  this->GetElastixBase()->SetDBIndex( this->m_DBIndex );
282 
287  this->GetElastixBase()->SetRegistrationContainer(
288  this->CreateComponents( "Registration", "MultiResolutionRegistration",
289  errorCode ) );
290 
291  this->GetElastixBase()->SetFixedImagePyramidContainer(
292  this->CreateComponents( "FixedImagePyramid", "FixedSmoothingImagePyramid",
293  errorCode ) );
294 
295  this->GetElastixBase()->SetMovingImagePyramidContainer(
296  this->CreateComponents( "MovingImagePyramid", "MovingSmoothingImagePyramid",
297  errorCode ) );
298 
299  this->GetElastixBase()->SetImageSamplerContainer(
300  this->CreateComponents( "ImageSampler", "", errorCode, false ) );
301 
302  this->GetElastixBase()->SetInterpolatorContainer(
303  this->CreateComponents( "Interpolator", "BSplineInterpolator",
304  errorCode ) );
305 
306  this->GetElastixBase()->SetMetricContainer(
307  this->CreateComponents( "Metric", "", errorCode ) );
308 
309  this->GetElastixBase()->SetOptimizerContainer(
310  this->CreateComponents( "Optimizer", "", errorCode ) );
311 
312  this->GetElastixBase()->SetResampleInterpolatorContainer(
313  this->CreateComponents( "ResampleInterpolator", "FinalBSplineInterpolator",
314  errorCode ) );
315 
316  this->GetElastixBase()->SetResamplerContainer(
317  this->CreateComponents( "Resampler", "DefaultResampler",
318  errorCode ) );
319 
320  this->GetElastixBase()->SetTransformContainer(
321  this->CreateComponents( "Transform", "", errorCode ) );
322 
324  if( errorCode != 0 )
325  {
326  xout[ "error" ] << "ERROR:" << std::endl;
327  xout[ "error" ] << "One or more components could not be created." << std::endl;
328  return 1;
329  }
330 
334  this->GetElastixBase()->SetFixedImageContainer( this->GetFixedImageContainer() );
335  this->GetElastixBase()->SetMovingImageContainer( this->GetMovingImageContainer() );
336  this->GetElastixBase()->SetFixedMaskContainer( this->GetFixedMaskContainer() );
337  this->GetElastixBase()->SetMovingMaskContainer( this->GetMovingMaskContainer() );
338  this->GetElastixBase()->SetResultImageContainer( this->GetResultImageContainer() );
339 
341  this->GetElastixBase()->SetInitialTransform( this->GetInitialTransform() );
342 
346  this->GetElastixBase()->SetOriginalFixedImageDirectionFlat(
347  this->GetOriginalFixedImageDirectionFlat() );
348 
350  try
351  {
352  errorCode = this->GetElastixBase()->Run();
353  }
354  catch( itk::ExceptionObject & excp1 )
355  {
357  xl::xout[ "error" ] << excp1 << std::endl;
358  errorCode = 1;
359  }
360  catch( std::exception & excp2 )
361  {
363  xl::xout[ "error" ] << "std: " << excp2.what() << std::endl;
364  errorCode = 1;
365  }
366  catch( ... )
367  {
369  xl::xout[ "error" ] << "ERROR: an unknown non-ITK, non-std exception was caught.\n"
370  << "Please report this to elastix@bigr.nl." << std::endl;
371  errorCode = 1;
372  }
373 
375  this->m_FinalTransform = this->GetElastixBase()->GetFinalTransform();
376 
378  this->m_TransformParametersMap = this->GetElastixBase()->GetTransformParametersMap();
379 
381  this->SetFixedImageContainer( this->GetElastixBase()->GetFixedImageContainer() );
382  this->SetMovingImageContainer( this->GetElastixBase()->GetMovingImageContainer() );
383  this->SetFixedMaskContainer( this->GetElastixBase()->GetFixedMaskContainer() );
384  this->SetMovingMaskContainer( this->GetElastixBase()->GetMovingMaskContainer() );
385  this->SetResultImageContainer( this->GetElastixBase()->GetResultImageContainer() );
386 
389  this->SetOriginalFixedImageDirectionFlat(
390  this->GetElastixBase()->GetOriginalFixedImageDirectionFlat() );
391 
393  return errorCode;
394 
395 } // end Run()
396 
397 
402 int
403 ElastixMain::Run( ArgumentMapType & argmap )
404 {
405  this->EnterCommandLineArguments( argmap );
406  return this->Run();
407 } // end Run()
408 
409 
414 int
416 ::Run( ArgumentMapType & argmap,
417  ParameterMapType & inputMap )
418 {
419  this->EnterCommandLineArguments( argmap, inputMap );
420  return this->Run();
421 } // end Run()
422 
423 
432 int
434 {
436  if( this->m_Configuration->IsInitialized() )
437  {
439  if( this->m_FixedImagePixelType.empty() )
440  {
442  this->m_FixedImagePixelType = "float"; // \note: this assumes elastix was compiled for float
443  this->m_Configuration->ReadParameter( this->m_FixedImagePixelType,
444  "FixedInternalImagePixelType", 0 );
445  }
446 
448  if( this->m_FixedImageDimension == 0 )
449  {
450 #ifndef _ELASTIX_BUILD_LIBRARY
451 
452  std::string fixedImageFileName
453  = this->m_Configuration->GetCommandLineArgument( "-f" );
454  if( fixedImageFileName == "" )
455  {
456  fixedImageFileName = this->m_Configuration->GetCommandLineArgument( "-f0" );
457  }
458  try
459  {
460  this->GetImageInformationFromFile( fixedImageFileName,
461  this->m_FixedImageDimension );
462  }
463  catch( itk::ExceptionObject & err )
464  {
465  xout[ "error" ] << "ERROR: could not read fixed image." << std::endl;
466  xout[ "error" ] << err << std::endl;
467  return 1;
468  }
469 
474  unsigned int fixDimParameterFile = 0;
475  bool foundInParameterFile = this->m_Configuration->ReadParameter( fixDimParameterFile,
476  "FixedImageDimension", 0, false );
477 
479  if( foundInParameterFile )
480  {
481  if( fixDimParameterFile != this->m_FixedImageDimension )
482  {
483  xout[ "error" ] << "ERROR: problem defining fixed image dimension.\n"
484  << " The parameter file says: " << fixDimParameterFile << "\n"
485  << " The fixed image header says: " << this->m_FixedImageDimension << "\n"
486  << " Note that from elastix 4.6 the parameter file definition \"FixedImageDimension\" "
487  << "is not needed anymore.\n Please remove this entry from your parameter file."
488  << std::endl;
489  return 1;
490  }
491  }
492 #else
493  this->m_Configuration->ReadParameter( this->m_FixedImageDimension,
494  "FixedImageDimension", 0, false );
495 #endif
496 
498  if( this->m_FixedImageDimension == 0 )
499  {
500  xout[ "error" ] << "ERROR:" << std::endl;
501  xout[ "error" ] << "The FixedImageDimension is not given." << std::endl;
502  return 1;
503  }
504  }
505 
507  if( this->m_MovingImagePixelType.empty() )
508  {
510  this->m_MovingImagePixelType = "float"; // \note: this assumes elastix was compiled for float
511  this->m_Configuration->ReadParameter( this->m_MovingImagePixelType,
512  "MovingInternalImagePixelType", 0 );
513  }
514 
516  if( this->m_MovingImageDimension == 0 )
517  {
518 #ifndef _ELASTIX_BUILD_LIBRARY
519 
520  std::string movingImageFileName
521  = this->m_Configuration->GetCommandLineArgument( "-m" );
522  if( movingImageFileName == "" )
523  {
524  movingImageFileName = this->m_Configuration->GetCommandLineArgument( "-m0" );
525  }
526  try
527  {
528  this->GetImageInformationFromFile( movingImageFileName,
529  this->m_MovingImageDimension );
530  }
531  catch( itk::ExceptionObject & err )
532  {
533  xout[ "error" ] << "ERROR: could not read moving image." << std::endl;
534  xout[ "error" ] << err << std::endl;
535  return 1;
536  }
537 
542  unsigned int movDimParameterFile = 0;
543  bool foundInParameterFile = this->m_Configuration->ReadParameter( movDimParameterFile,
544  "MovingImageDimension", 0, false );
545 
547  if( foundInParameterFile )
548  {
549  if( movDimParameterFile != this->m_MovingImageDimension )
550  {
551  xout[ "error" ] << "ERROR: problem defining moving image dimension.\n"
552  << " The parameter file says: " << movDimParameterFile << "\n"
553  << " The moving image header says: " << this->m_MovingImageDimension << "\n"
554  << " Note that from elastix 4.6 the parameter file definition \"MovingImageDimension\" "
555  << "is not needed anymore.\n Please remove this entry from your parameter file."
556  << std::endl;
557  return 1;
558  }
559  }
560 
561 #else
562  this->m_Configuration->ReadParameter( this->m_MovingImageDimension,
563  "MovingImageDimension", 0, false );
564 #endif
565 
567  if( this->m_MovingImageDimension == 0 )
568  {
569  xout[ "error" ] << "ERROR:" << std::endl;
570  xout[ "error" ] << "The MovingImageDimension is not given." << std::endl;
571  return 1;
572  }
573  }
574 
576  if( this->s_CDB.IsNull() )
577  {
578  int loadReturnCode = this->LoadComponents();
579  if( loadReturnCode != 0 )
580  {
581  xout[ "error" ] << "Loading components failed" << std::endl;
582  return loadReturnCode;
583  }
584  }
585 
586  if( this->s_CDB.IsNotNull() )
587  {
589  this->m_DBIndex = this->s_CDB->GetIndex(
590  this->m_FixedImagePixelType,
591  this->m_FixedImageDimension,
592  this->m_MovingImagePixelType,
593  this->m_MovingImageDimension );
594  if( this->m_DBIndex == 0 )
595  {
596  xout[ "error" ] << "ERROR:" << std::endl;
597  xout[ "error" ] << "Something went wrong in the ComponentDatabase" << std::endl;
598  return 1;
599  }
600  } // end if s_CDB!=0
601 
602  } // end if m_Configuration->Initialized();
603  else
604  {
605  xout[ "error" ] << "ERROR:" << std::endl;
606  xout[ "error" ] << "The configuration object has not been initialized." << std::endl;
607  return 1;
608  }
609 
611  return 0;
612 
613 } // end InitDBIndex()
614 
615 
620 void
621 ElastixMain::SetElastixLevel( unsigned int level )
622 {
624  this->m_Configuration->SetElastixLevel( level );
625 
626 } // end SetElastixLevel()
627 
628 
633 unsigned int
635 {
637  return this->m_Configuration->GetElastixLevel();
638 
639 } // end GetElastixLevel()
640 
641 
646 void
648 {
650  this->m_Configuration->SetTotalNumberOfElastixLevels( levels );
651 
652 } // end SetTotalNumberOfElastixLevels()
653 
654 
659 unsigned int
661 {
663  return this->m_Configuration->GetTotalNumberOfElastixLevels();
664 
665 } // end GetTotalNumberOfElastixLevels()
666 
667 
675 int
677 {
679  if( this->s_CDB.IsNull() )
680  {
681  this->s_CDB = ComponentDatabaseType::New();
682  }
683 
685  if( this->s_ComponentLoader.IsNull() )
686  {
687  this->s_ComponentLoader = ComponentLoaderType::New();
688  this->s_ComponentLoader->SetComponentDatabase( s_CDB );
689  }
690 
692  const char * argv0
693  = this->m_Configuration->GetCommandLineArgument( "-argv0" ).c_str();
694 
696  return this->s_ComponentLoader->LoadComponents( argv0 );
697 
698 } // end LoadComponents()
699 
700 
705 void
707 {
708  s_CDB = 0;
709  s_ComponentLoader->SetComponentDatabase( 0 );
710 
711  if( s_ComponentLoader )
712  {
713  s_ComponentLoader->UnloadComponents();
714  }
715 
716  s_ComponentLoader = 0;
717 
718 } // end UnloadComponents()
719 
720 
727 {
728  ElastixBaseType * testpointer;
729 
731  testpointer = dynamic_cast< ElastixBaseType * >( this->m_Elastix.GetPointer() );
732  if( !testpointer )
733  {
734  itkExceptionMacro( << "Probably GetElastixBase() is called before having called Run()" );
735  }
736 
737  return testpointer;
738 
739 } // end GetElastixBase()
740 
741 
746 ElastixMain::ObjectPointer
748  const ComponentDescriptionType & name )
749 {
751  PtrToCreator testcreator = 0;
752  ObjectPointer testpointer = 0;
753  testcreator = this->s_CDB->GetCreator( name, this->m_DBIndex );
754  testpointer = testcreator ? testcreator() : NULL;
755  if( testpointer.IsNull() )
756  {
757  itkExceptionMacro( << "The following component could not be created: " << name );
758  }
759 
760  return testpointer;
761 
762 } // end CreateComponent()
763 
764 
769 ElastixMain::ObjectContainerPointer
771  const std::string & key,
772  const ComponentDescriptionType & defaultComponentName,
773  int & errorcode, bool mandatoryComponent )
774 {
775  ComponentDescriptionType componentName = defaultComponentName;
776  unsigned int componentnr = 0;
777  ObjectContainerPointer objectContainer = ObjectContainerType::New();
778  objectContainer->Initialize();
779 
784  bool found = this->m_Configuration->ReadParameter(
785  componentName, key, componentnr, true );
786 
791  if( !found && ( defaultComponentName == "" ) )
792  {
793  if( mandatoryComponent )
794  {
795  xout[ "error" ]
796  << "ERROR: the following component has not been specified: "
797  << key << std::endl;
798  errorcode = 1;
799  return objectContainer;
800  }
801  else
802  {
803  /* Just return an empty container without nagging. */
804  errorcode = 0;
805  return objectContainer;
806  }
807  }
808 
810  try
811  {
812  objectContainer->CreateElementAt( componentnr )
813  = this->CreateComponent( componentName );
814  }
815  catch( itk::ExceptionObject & excp )
816  {
817  xout[ "error" ]
818  << "ERROR: error occurred while creating "
819  << key << " "
820  << componentnr << "." << std::endl;
821  xout[ "error" ] << excp << std::endl;
822  errorcode = 1;
823  return objectContainer;
824  }
825 
827  while( found )
828  {
829  ++componentnr;
830  found = this->m_Configuration->ReadParameter(
831  componentName, key, componentnr, false );
832  if( found )
833  {
834  try
835  {
836  objectContainer->CreateElementAt( componentnr )
837  = this->CreateComponent( componentName );
838  }
839  catch( itk::ExceptionObject & excp )
840  {
841  xout[ "error" ]
842  << "ERROR: error occurred while creating "
843  << key << " "
844  << componentnr << "." << std::endl;
845  xout[ "error" ] << excp << std::endl;
846  errorcode = 1;
847  return objectContainer;
848  }
849  } // end if
850  } // end while
851 
852  return objectContainer;
853 
854 } // end CreateComponents()
855 
856 
861 void
863 {
865  std::string processPriority = "";
866  processPriority = this->m_Configuration->GetCommandLineArgument( "-priority" );
867  if( processPriority == "high" )
868  {
869 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
870  SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS );
871 #endif
872  }
873  else if( processPriority == "abovenormal" )
874  {
875 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
876  SetPriorityClass( GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS );
877 #endif
878  }
879  else if( processPriority == "normal" )
880  {
881 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
882  SetPriorityClass( GetCurrentProcess(), NORMAL_PRIORITY_CLASS );
883 #endif
884  }
885  else if( processPriority == "belownormal" )
886  {
887 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
888  SetPriorityClass( GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS );
889 #endif
890  }
891  else if( processPriority == "idle" )
892  {
893 #if defined( _WIN32 ) && !defined( __CYGWIN__ )
894  SetPriorityClass( GetCurrentProcess(), IDLE_PRIORITY_CLASS );
895 #endif
896  }
897  else if( processPriority != "" )
898  {
899  xl::xout[ "warning" ]
900  << "Unsupported -priority value. Specify one of <high, abovenormal, normal, belownormal, idle, ''>." << std::endl;
901  }
902 
903 } // end SetProcessPriority()
904 
905 
910 void
912 {
914  std::string maximumNumberOfThreadsString = "";
915  maximumNumberOfThreadsString
916  = this->m_Configuration->GetCommandLineArgument( "-threads" );
917 
919  if( maximumNumberOfThreadsString != "" )
920  {
921  const int maximumNumberOfThreads
922  = atoi( maximumNumberOfThreadsString.c_str() );
923  itk::MultiThreader::SetGlobalMaximumNumberOfThreads(
924  maximumNumberOfThreads );
925  }
926 } // end SetMaximumNumberOfThreads()
927 
928 
933 void
935  const FlatDirectionCosinesType & arg )
936 {
937  this->m_OriginalFixedImageDirection = arg;
938 } // end SetOriginalFixedImageDirectionFlat()
939 
940 
945 const ElastixMain::FlatDirectionCosinesType &
947 {
948  return this->m_OriginalFixedImageDirection;
949 } // end GetOriginalFixedImageDirectionFlat()
950 
951 
958 {
959  return this->m_TransformParametersMap;
960 } // end GetTransformParametersMap()
961 
962 
967 void
969  const std::string & filename,
970  ImageDimensionType & imageDimension ) const
971 {
972  if( filename != "" )
973  {
975  const unsigned int DummyDimension = 3;
976  typedef short DummyPixelType;
977  typedef itk::Image< DummyPixelType, DummyDimension > DummyImageType;
978 
980  typedef itk::ImageFileReader< DummyImageType > ReaderType;
981  ReaderType::Pointer testReader = ReaderType::New();
982  testReader->SetFileName( filename.c_str() );
983 
985  testReader->GenerateOutputInformation();
986 
988  itk::ImageIOBase::Pointer testImageIO = testReader->GetImageIO();
989  //itk::ImageIOBase::IOComponentType componentType = testImageIO->GetComponentType();
990  //pixelType = itk::ImageIOBase::GetComponentTypeAsString( componentType );
991  if( testImageIO.IsNull() )
992  {
995  itkExceptionMacro( << "ERROR: ImageIO object was not created, but no exception was thrown." );
996  }
997  imageDimension = testImageIO->GetNumberOfDimensions();
998  } // end if
999 
1000 } // end GetImageInformationFromFile()
1001 
1002 
1003 } // end namespace elastix
virtual void EnterCommandLineArguments(ArgumentMapType &argmap)
virtual int LoadComponents(void)
void GetImageInformationFromFile(const std::string &filename, ImageDimensionType &imageDimension) const
int xoutSetup(const char *logfilename, bool setupLogging, bool setupCout)
virtual int InitDBIndex(void)
ElastixBase ElastixBaseType
virtual ParameterMapType GetTransformParametersMap(void) const
void SetTotalNumberOfElastixLevels(unsigned int levels)
virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat(void) const
virtual ObjectPointer CreateComponent(const ComponentDescriptionType &name)
virtual void SetProcessPriority(void) const
virtual void SetOriginalFixedImageDirectionFlat(const FlatDirectionCosinesType &arg)
static void UnloadComponents(void)
virtual ObjectContainerPointer CreateComponents(const ComponentDescriptionType &key, const ComponentDescriptionType &defaultComponentName, int &errorcode, bool mandatoryComponent=true)
static ComponentDatabasePointer s_CDB
void SetElastixLevel(unsigned int level)
itk::ParameterMapInterface::ParameterMapType ParameterMapType
virtual int Run(void)
unsigned int GetTotalNumberOfElastixLevels(void)
unsigned int GetElastixLevel(void)
virtual ElastixBaseType * GetElastixBase(void) const
virtual void SetMaximumNumberOfThreads(void) const
xoutbase_type g_xout