19 #include "itkPSMCommandLineClass.h" 20 #include "itkPSMProjectReader.h" 22 #include "itkImageFileReader.h" 23 #include "itkExceptionObject.h" 24 #include "itkGDCMImageIOFactory.h" 25 #include "itkMetaImageIOFactory.h" 26 #include "itkObjectFactoryBase.h" 27 #include "itkNrrdImageIOFactory.h" 28 #include "itkExceptionObject.h" 31 int main(
int argc,
char *argv[])
33 std::string output_path =
"";
34 std::string input_path_prefix =
"";
35 std::string errstring =
"";
39 std::cout <<
"Wrong number of arguments. \nUse: " 40 <<
"psmCommandLineTool parameter_file [output_path] [input_path]\n" 41 <<
"See itk::PSMParameterFileReader for documentation on the parameter file format.\n" 42 <<
"Note that input_path will be prefixed to any file names and paths in the xml parameter file.\n" 49 output_path = std::string(argv[2]);
54 input_path_prefix = std::string(argv[3]);
60 itk::ObjectFactoryBase::RegisterFactory(itk::MetaImageIOFactory::New());
61 itk::ObjectFactoryBase::RegisterFactory(itk::GDCMImageIOFactory::New());
62 itk::ObjectFactoryBase::RegisterFactory(itk::NrrdImageIOFactory::New());
97 const size_t numOfDimensions = 3;
98 if (numOfDimensions == 2)
100 std::cout <<
"Running 2D optimization code" << std::endl;
101 itk::PSMCommandLineClass<2>::Pointer psmClass
103 psmClass->
Run(argv[1], input_path_prefix, output_path);
104 }
else if (numOfDimensions == 3)
106 std::cout <<
"Running 3D optimization code" << std::endl;
107 itk::PSMCommandLineClass<3>::Pointer psmClass
109 psmClass->
Run(argv[1], input_path_prefix, output_path);
113 catch (itk::ExceptionObject &e)
115 std::cerr <<
"ITK exception with description: " << e.GetDescription()
116 <<
"\n at location:" << e.GetLocation()
117 <<
"\n in file:" << e.GetFile() << std::endl;
123 errstring =
"Unknown exception thrown";
void Run(const char *fname, std::string input_path_prefix, std::string output_path)
This class provides a command line tool to run the Particle Shape Modeling. It runs the optimization ...