00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include<ImLib3D/ImLib3D.hpp>
00021 #include<ImLib3D/ImageProcessorsDescription.hpp>
00022 #include<ImLib3D/ImageProcessorDescription.hpp>
00023 #include<ImLib3D/PluginManagement.hpp>
00024 #include<ImLib3D/XMLTools.hpp>
00025 #include<ImLib3D/BitImage3D.hpp>
00026 #include<ImLib3D/TypeSafeGenericPointer.hpp>
00027 #include"CallImLib3DImageProcessorByName.hpp"
00028
00029
00030 void
00031 Usage()
00032 {
00033 printf("Usage: imlib3d ImageProcessorName --help\n");
00034 printf(" imlib3d --list\n");
00035 printf(" imlib3d ImageProcessorName ImageProcessorArgs\n");
00036 printf("ImLib3D commandline processing\n");
00037 }
00038 int
00039 main(int argc,char **argv)
00040 {
00041 vector<string> args;
00042 for(int i=1;i<argc;i++){args.push_back(argv[i]);}
00043
00044 PluginManagement allProcessors;
00045
00046 if(args.size()==0 || args[0]=="-h" || args[0]=="-help" || args[0]=="--help" ){Usage();exit(0);}
00047 if(args[0]=="--query-imlib3d"){printf("imlib3d-main");exit(0);}
00048 if(args[0]=="--list")
00049 {
00050 allProcessors.PrintTree();
00051 exit(0);
00052 }
00053
00054 string processor=args[0];
00055 if(args.size()==1 || args[1]=="-h" || args[1]=="-help" || args[1]=="--help")
00056 {
00057 if(args.size()==1){Usage();}
00058 ImageProcessorDescription proc(args[0],allProcessors);
00059 proc.PrintHelp();
00060 exit(0);
00061 }
00062 if(args[1]=="--doxy")
00063 {
00064 ImageProcessorDescription proc(args[0],allProcessors);
00065 proc.PrintDoxyDoc();
00066 exit(0);
00067 }
00068 string procName=args[0];
00069
00070 SetErrorManagementType(ERROR_USE_EXCEPTIONS);
00071 vector<string> resArgs;
00072 ImageProcessorDescription imProcDescription(procName,allProcessors);
00073 try
00074 {
00075 resArgs=imProcDescription.ParseCmdLine(args);
00076 imProcDescription.ValidateArguments(resArgs);
00077 }
00078 catch(std::exception& __fail)
00079 {ThrowError("problem in parsing commandline \"%s\"",__fail.what());}
00080
00081 if(allProcessors.PluginNumber(procName)==0)
00082 {
00083 CallImLib3DImageProcessorByName(procName,resArgs,imProcDescription.ProcTemplateTypeName(resArgs));
00084 }
00085 else
00086 {
00087 allProcessors.ExecuteImageProcessor(imProcDescription.BuildCmdLine(resArgs));
00088 }
00089 }
00090
00091