Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members

#include <xmipp_program.h>

Inherited by Alignment::AProgAlignSignificant< T >, AProgMovieAlignmentCorrelation< T >, ML2DBaseProgram, MultireferenceAligneability, Phantom_transform_parameters, PhantomMovieProgram, ProgAdjustVolume, ProgAlign2d, ProgAlignDualTiltSeries, ProgAlignTiltPairs, ProgAlignVolumes, ProgAnalyzeCluster, ProgAngResAlign, ProgAngularAccuracyPCA, ProgAngularBreakSymmetry, ProgAngularDistance, ProgAngularDistributionShow, ProgAngularEstimateTiltAxis, ProgAngularNeighbourhood, ProgAngularProjectionMatching, ProgAngularProjectLibrary, ProgAngularRotate, ProgApplyCoeffZernike3D, ProgApplyVolDeformSph, ProgARTPseudo, ProgassignmentTiltPair, ProgClassifyCL2D, ProgClassifyCL2DCore, ProgClassifyCL3D, ProgClassifyFirstSplit, ProgClassifyFirstSplit3, ProgClassifyFTTRI, ProgClassifyKmeans2D, ProgClassifySignificant, ProgCommonLine, ProgCompareClass, ProgCompareDensity, ProgCompareViews, ProgCoordinatesNoisyZonesFilter, ProgCTFBasicParams, ProgCtfCorrectAmplitude3D, ProgCtfCreateCtfdat, ProgCTFEstimateFromMicrograph, ProgCtfGroup, ProgCTFPhaseFlipping, ProgCTFShow, ProgDetectMissingWedge, ProgDimRed, ProgEliminateEmptyParticles, ProgEvaluateClass, ProgEvaluateCoordinates, ProgExtractFeatures, ProgExtractSubset, ProgFindCenter2D, ProgForwardZernikeVol, ProgFSO, ProgGpuCorrelation, ProgHistogram, ProgIDRXrayTomo [virtual], ProgImagePeakHighContrast, ProgImageRotationalPCA, ProgImageVectorize, ProgKenderSOM, ProgLocalVolumeAdjust, ProgLocSharpening, ProgMakeSpectra, ProgMetadataHistogram, ProgMetadataImport, ProgMetadataSplit, ProgMetadataSplit3D, ProgMetadataUtilities, ProgMicrographAutomaticPicking2, ProgMicrographScissor, ProgMLRefine3D, ProgMLTomo, ProgMonogenicSignalRes, ProgMonoTomo, ProgMonoTomo, ProgMovieEstimateGain, ProgMovieFilterDose, ProgMPIRun, ProgMrcCreateMetaData, ProgOddEven, ProgOpticalAligment, ProgPdbAnalysis, ProgPdbConverter, ProgPDBDictionary, ProgPdbNmaDeform, ProgPdbReduce, ProgPdbSphDeform, ProgPdbValueToVol, ProgPerformanceTest, ProgPhantomCreate, ProgProject, ProgProjectTomography, ProgPSFXrCreate, ProgReconsADMM, ProgReconsBase [virtual], ProgReconstructSignificant, ProgResBFactor, ProgResDir, ProgResliceVol, ProgResLocalFilter, ProgResolutionFsc, ProgResolutionIBW, ProgScoreMicrograph, ProgSeparateObjects, ProgSortByStatistics, ProgSortImages, ProgSSNR, ProgTest, ProgTestWork, ProgTomoAlignRefinement, ProgTomoExtractParticleStacks, ProgTomoExtractSubtomograms, ProgTomoFilterCoordinates, ProgTomographAlignment, ProgTomoMapBack, ProgTomoRemoveFluctuations, ProgTomoSimulateTiltseries, ProgTomoTSFilterDose, ProgValidationNonTilt, ProgValidationTiltPairs, ProgVolDeformSph, ProgVolumeDeformSphGpu, ProgVolumeEnhanceContrast, ProgVolumeFindSymmetry, ProgVolumeHalvesRestoration, ProgVolumeHalvesRestorationGpu< T >, ProgVolumeHomogenizer, ProgVolumeInitialSimulatedAnnealing, ProgVolumePCA, ProgVolumeSegment, ProgVolumeStructureFactor, ProgVolumeSubtraction, ProgVolumeToPseudoatoms, ProgVolumeToWeb, ProgVolumeValidationPCA, ProgXrayImport, ProgXrayProject [virtual], PSDEstimatorProgram, PythonProgram, XmippMetadataProgram [virtual], and XmippMpiProgram [virtual].

Collaboration diagram for XmippProgram:
Collaboration graph
[legend]

Public Member Functions

const char * getParam (const char *param, int arg=0)
 
const char * getParam (const char *param, const char *subparam, int arg=0)
 
int getIntParam (const char *param, int arg=0)
 
int getIntParam (const char *param, const char *subparam, int arg=0)
 
double getDoubleParam (const char *param, int arg=0)
 
double getDoubleParam (const char *param, const char *subparam, int arg=0)
 
float getFloatParam (const char *param, int arg=0)
 
float getFloatParam (const char *param, const char *subparam, int arg=0)
 
void getListParam (const char *param, StringVector &list)
 
int getCountParam (const char *param)
 
bool checkParam (const char *param)
 
bool existsParam (const char *param)
 
void addParamsLine (const String &line)
 
void addParamsLine (const char *line)
 
ParamDefgetParamDef (const char *param) const
 
virtual void run ()
 
virtual void quit (int exit_code=0) const
 
virtual int tryRun ()
 
void initProgress (size_t total, size_t stepBin=60)
 
void setProgress (size_t value=0)
 
void endProgress ()
 
Functions to be implemented by subclasses.
void processDefaultComment (const char *param, const char *left)
 
void setDefaultComment (const char *param, const char *comment)
 
virtual void initComments ()
 
virtual void defineParams ()
 
virtual void readParams ()
 
Program definitions

Following functions will be used in defineParams() for define the arguments of a program. Very useful for checking the command line parameters and for standard usage message.

void setProgramName (const char *name)
 
void addUsageLine (const char *line, bool verbatim=false)
 
void clearUsage ()
 
void addExampleLine (const char *example, bool verbatim=true)
 
void addSeeAlsoLine (const char *seeAlso)
 
void addKeywords (const char *keywords)
 
Public common functions

The functions in this section are available for all programs and should not be reimplemented in derived class, since they are thought to have the same behaivor and it depends on the definition of each program.

const char * name () const
 
virtual void usage (int verb=0) const
 
virtual void usage (const String &param, int verb=2)
 
int version () const
 
virtual void show () const
 
virtual void read (int argc, const char **argv, bool reportErrors=true)
 
virtual void read (int argc, char **argv, bool reportErrors=true)
 
void read (const String &argumentsLine)
 
Constructors
 XmippProgram ()
 
 XmippProgram (int argc, const char **argv)
 
virtual ~XmippProgram ()
 

Public Attributes

bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Protected Member Functions

void defineCommons ()
 

Protected Attributes

int errorCode
 
ProgramDefprogDef
 Program definition and arguments parser. More...
 
std::map< String, CommentListdefaultComments
 
int argc
 Original command line arguments. More...
 
const char ** argv
 

Detailed Description

This class represent an Xmipp Program. It have some of the basic functionalities of the programs like argument parsing, checking, usage printing.

Definition at line 52 of file xmipp_program.h.

Constructor & Destructor Documentation

◆ XmippProgram() [1/2]

XmippProgram::XmippProgram ( )

Constructor

Definition at line 146 of file xmipp_program.cpp.

147 {
148  //by defaul all programs have verbose = 1
149  // this can be changed on mpi slaves node for no output at all
150  verbose = 1;
151  progDef = NULL;
152  runWithoutArgs = doRun = false;
153  errorCode = 0;
154 }
bool runWithoutArgs
Definition: xmipp_program.h:95
int verbose
Verbosity level.
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ XmippProgram() [2/2]

XmippProgram::XmippProgram ( int  argc,
const char **  argv 
)

Constructor for read params

Definition at line 156 of file xmipp_program.cpp.

157 {
158  runWithoutArgs = doRun = false;
159  errorCode = 0;
160  init();
161  read(argc, argv);
162 }
virtual void read(int argc, const char **argv, bool reportErrors=true)
int argc
Original command line arguments.
Definition: xmipp_program.h:86
bool runWithoutArgs
Definition: xmipp_program.h:95
const char ** argv
Definition: xmipp_program.h:87

◆ ~XmippProgram()

XmippProgram::~XmippProgram ( )
virtual

Destructor

Definition at line 164 of file xmipp_program.cpp.

165 {
166  delete progDef;
167 }
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

Member Function Documentation

◆ addExampleLine()

void XmippProgram::addExampleLine ( const char *  example,
bool  verbatim = true 
)

Add examples

Definition at line 286 of file xmipp_program.cpp.

287 {
288  progDef->examples.addComment(example, verbatim);
289 }
CommentList examples
examples of use
Definition: argsparser.h:243
void addComment(const String &comment, int visible=0, bool wikiVerbatim=false)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ addKeywords()

void XmippProgram::addKeywords ( const char *  keywords)

Add keywords to the program definition

Definition at line 315 of file xmipp_program.cpp.

316 {
317  progDef->keywords += " ";
318  progDef->keywords += keywords;
319 }
String keywords
Definition: argsparser.h:246
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ addParamsLine() [1/2]

void XmippProgram::addParamsLine ( const String line)

Add a params definition line

Definition at line 305 of file xmipp_program.cpp.

306 {
307  progDef->pLexer->addLine(line);
308 }
ArgLexer * pLexer
Definition: argsparser.h:150
void addLine(const String &line)
Definition: argsparser.cpp:99
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ addParamsLine() [2/2]

void XmippProgram::addParamsLine ( const char *  line)

Definition at line 310 of file xmipp_program.cpp.

311 {
312  progDef->pLexer->addLine((String)line);
313 }
ArgLexer * pLexer
Definition: argsparser.h:150
std::string String
Definition: xmipp_strings.h:34
void addLine(const String &line)
Definition: argsparser.cpp:99
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ addSeeAlsoLine()

void XmippProgram::addSeeAlsoLine ( const char *  seeAlso)

Add other programs. Separated by commas and without xmipp_

Definition at line 290 of file xmipp_program.cpp.

291 {
292  if (progDef->seeAlso=="")
293  progDef->seeAlso = seeAlso;
294  else
295  {
296  progDef->seeAlso +=", ";
297  progDef->seeAlso +=seeAlso;
298  }
299 }
String seeAlso
Definition: argsparser.h:247
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ addUsageLine()

void XmippProgram::addUsageLine ( const char *  line,
bool  verbatim = false 
)

Add usage line

Definition at line 282 of file xmipp_program.cpp.

283 {
284  progDef->usageComments.addComment(line,verbatim);
285 }
CommentList usageComments
comments of usage
Definition: argsparser.h:242
void addComment(const String &comment, int visible=0, bool wikiVerbatim=false)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ checkParam()

bool XmippProgram::checkParam ( const char *  param)

Check if the param was supplied to command line

Definition at line 379 of file xmipp_program.cpp.

380 {
381  ParamDef * paramDef = progDef->findParam(param);
382  if (paramDef == NULL)
383  REPORT_ERROR(ERR_ARG_INCORRECT, ((String)"Doesn't exists param: " + param));
384  return paramDef->counter == 1;
385 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
Incorrect argument received.
Definition: xmipp_error.h:113
struct _parameter * param
std::string String
Definition: xmipp_strings.h:34
int counter
for count the number of times it appears in command line
Definition: argsparser.h:201
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ clearUsage()

void XmippProgram::clearUsage ( )

Clear usage

Definition at line 301 of file xmipp_program.cpp.

302 {
304 }
CommentList usageComments
comments of usage
Definition: argsparser.h:242
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ defineCommons()

void XmippProgram::defineCommons ( )
protected

Define Commons

Add some common definitions to all Xmipp programs

This are a set of internal command for MetaProgram usage they should be hidden

Definition at line 54 of file xmipp_program.cpp.

55 {
57  addParamsLine("== Common options ==");
58  processDefaultComment("-v","[-v+ <verbose_level=1>]");
59  addParamsLine("alias --verbose;");
60  addParamsLine("[-h+* <param=\"\">] : If not param is supplied show this help message.");
61  addParamsLine(" : Otherwise, specific param help is showed,");
62  addParamsLine(" : param should be provided without the '-'");
63  addParamsLine("alias --help;");
64  addParamsLine("[--more*] : Show additional options.");
65 
68  addParamsLine("==+++++ Internal section ==");
69  addParamsLine("[--xmipp_write_definition* <dbname>] : Print metadata info about the program to sqlite database");
70  addParamsLine("[--xmipp_write_wiki* ] : Print metadata info about the program in wiki format");
71  addParamsLine("[--xmipp_write_autocomplete* <scriptfile>] : Add program autocomplete bash options to script file");
72  addParamsLine("[--xmipp_protocol_script <script>] : This is only meanful when execute throught protocols");
73  addParamsLine("[--xmipp_validate_params] : Validate input params");
74 }
void processDefaultComment(const char *param, const char *left)
void addParamsLine(const String &line)

◆ defineParams()

void XmippProgram::defineParams ( )
virtual

Function in which the param of each Program are defined.

Reimplemented in ProgMask, ProgFindCenter2D, ProgMicrographAutomaticPicking2, ProgClassifyCL3D, ProgClassifyCL2D, ProgNormalize, ProgMLTomo, BasicMpiMetadataProgram< BASE_CLASS >, BasicMpiMetadataProgram< ProgAngularContinuousAssign >, BasicMpiMetadataProgram< ProgPSDSort >, BasicMpiMetadataProgram< ProgEliminateByEnergy >, BasicMpiMetadataProgram< ProgThreshold >, BasicMpiMetadataProgram< ProgCorrectWiener2D >, BasicMpiMetadataProgram< ProgAngularDiscreteAssign >, BasicMpiMetadataProgram< ProgMask >, BasicMpiMetadataProgram< ProgTomoExtractSubvolume >, BasicMpiMetadataProgram< ProgFilter >, BasicMpiMetadataProgram< ProgTransformGeometry >, BasicMpiMetadataProgram< ProgImageSSNR >, BasicMpiMetadataProgram< ProgNormalize >, BasicMpiMetadataProgram< ProgImageResize >, BasicMpiMetadataProgram< ProgCorrectPhaseFlip2D >, BasicMpiMetadataProgram< ProgOperate >, BasicMpiMetadataProgram< ProgSymmetrize >, BasicMpiMetadataProgram< ProgCtfCorrectIdr >, MpiMetadataProgram, ProgRecFourier, ProgRecFourierAccel, ProgRecFourierGPU, ProgForwardZernikeSubtomos, ProgForwardZernikeImages, ProgForwardZernikeImagesPriors, ProgTomographAlignment, ProgAngularProjectLibrary, ProgMLF2D, ProgFlexibleAlignment, ProgParallelForwardArtZernike3D, ProgAngularSphAlignment, ProgAngularSphAlignmentGpu, ProgAngularContinuousAssign2, ProgForwardArtZernike3D, ProgFSO, ProgForwardArtZernike3DSubtomos, MpiProgAngularClassAverage, ProgNmaAlignmentVol, ProgAngularProjectionMatching, ProgVolumeToPseudoatoms, ProgConstructPDBDictionary, ProgCTFBasicParams, ProgNmaAlignment, ProgSubtractProjection, ProgReconstructSignificant, ProgArtZernike3D, ProgCtfGroup, ProgAlignVolumes, ProgRecFourierStarPU, ProgClassifyFTTRI, ProgImagePeakHighContrast, ProgAngResAlign, ProgImageRotationalPCA, XmippMetadataProgram, ProgSubtomoSubtraction, ProgForwardZernikeVol, ProgTomoTSFilterDose, ProgMovieFilterDose, ProgVolumeInitialSimulatedAnnealing, ProgMLRefine3D, ProgAngularDiscreteAssign, ProgML2D, ProgVolumeDeformSphGpu, ProgXrayImport, ProgMatrixDimRed, ProgXrayProject, ProgSortImages, ProgVolDeformSph, ProgReconsADMM, ProgClassifySignificant, ProgTomoExtractSubvolume, ProgCommonLine, ProgOpticalAligment, ProgProject, ProgIDRXrayTomo, ProgTomoAlignRefinement, ProgPSDSort, ProgRecWbp, ProgDimRed, ProgMPIRecFourier, MpiProgAngularProjectionMatching, ProgClassifyCL2DCore, ProgMpiAngularProjectLibrary, ProgTomoSimulateTiltseries, ProgCTFEstimateFromMicrograph, ProgSSNR, ProgSimulateMicroscope, ProgAnalyzeCluster, ProgTransformImageGreyLevels, ProgPdbConverter, ProgVolumeSetAlign, ProgReconsXrayART, ProgExtractFeatures, ProgScoreMicrograph, ProgPDBDictionary, ProgAngularDistance, ProgVolumeHalvesRestoration, ProgVolumeSegment, ProgAngularContinuousAssign, ProgDetectMissingWedge, ProgVolumeCorrectBfactor, ProgTomoExtractSubtomograms, ProgPdbValueToVol, ProgSymmetrize, ProgCtfCorrectIdr, ProgVolumePCA, ProgResDir, ProgOperate, MultireferenceAligneability, ProgConvImg, ProgCtfCorrectAmplitude3D, ProgMonogenicSignalRes, ProgEvaluateClass, ProgClassifyFirstSplit3, ProgARTPseudo, ProgVolumeValidationPCA, ProgCTFEnhancePSD, ProgResLocalFilter, ProgRecFourierMpiStarPU, ProgMonoTomo, ProgMonoTomo, ProgAngularDistributionShow, ProgAngularNeighbourhood, ProgMetadataSplit3D, ProgVolumeHomogenizer, ProgVolumeEnhanceContrast, ProgVolumeHalvesRestorationGpu< T >, ProgEvaluateCoordinates, ProgEliminateEmptyParticles, ProgVolumeToWeb, ProgTransformDimRed, ProgAlign2d, ProgCorrectWiener2D, ProgassignmentTiltPair, AProgMovieAlignmentCorrelation< T >, ProgPdbSphDeform, ProgClassifyFirstSplit, ProgClassifyKmeans2D, ProgThreshold, ProgTomoExtractParticleStacks, ProgGpuCorrelation, ProgMPIRun, ProgAdjustVolume, ProgTomoRemoveFluctuations, ProgImageResize, ProgAngularAccuracyPCA, ProgCTFEstimateFromPSD, ProgLocSharpening, ProgResolutionIBW, ProgAlignDualTiltSeries, ProgTransformDownsample, ProgPerformanceTest, ProgCompareDensity, ProgCompareViews, ProgAngularBreakSymmetry, ProgStatistics, ProgTomoMapBack, ProgAlignTiltPairs, ProgVolumeFindSymmetry, ProgCtfCreateCtfdat, ProgApplyVolDeformSph, ProgMakeSpectra, ProgCTFEstimateFromPSDFast, ProgValidationNonTilt, ProgValidationTiltPairs, ProgCTFPhaseFlipping, ProgSortByStatistics, ProgMovieEstimateGain, ProgPdbAnalysis, ProgCoordinatesNoisyZonesFilter, PythonProgram, ProgPdbNmaDeform, ProgMorphology, ProgTransformGeometry, ProgAngularAssignmentMag, ProgCompareClass, Alignment::AProgAlignSignificant< T >, ProgKenderSOM, ProgPdbReduce, ProgReconsART, Alignment::ProgAlignSignificantGPU< T >, ProgTransRangeAdjust, ProgWindow, ProgAngularEstimateTiltAxis, ProgEliminateByEnergy, ProgFilter, ProgCTFShow, ProgSeparateObjects, ProgMetadataSplit, Phantom_transform_parameters, ProgProjectTomography, ProgMPIXrayProject, ProgCorrectPhaseFlip2D, ProgMetadataUtilities, ProgResolutionFsc, ProgHistogram, MpiProgAngularAssignmentMag, ProgMetadataHistogram, ProgHeader, ProgImageSSNR, ProgAddNoise, ProgRestoreWithPDBDictionary, ProgMPIRecWbp, ProgAngularRotate, ProgMovieAlignmentCorrelation< T >, ProgTestWork, ProgPSFXrCreate, MpiProgAngularSphAlignment, MpiProgForwardZernikeImages, MpiProgForwardZernikeImagesPriors, MpiProgForwardZernikeSubtomos, ProgMovieAlignmentCorrelationGPU< T >, ProgSpiderTranslate, ProgCenterImage, ProgPhantomCreate, ProgMetadataImport, FlipParameters, ProgImageVectorize, ProgMicrographScissor, ProgImageResiduals, ProgVolumeStructureFactor, ProgRandomizePhases, ProgVolumeCenter, ProgExtractSubset, ProgMrcCreateMetaData, MpiProgTransformImageGreyLevels, MpiProgAngularContinuousAssign2, MpiProgSubtomoSubtraction, and MpiProgSubtractProjection.

Definition at line 169 of file xmipp_program.cpp.

170 {
171  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "function 'defineParams'");
172 }
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211

◆ endProgress()

void XmippProgram::endProgress ( )

Notify end of work

Definition at line 271 of file xmipp_program.cpp.

272 {
273  if (verbose)
274  progress_bar(progressTotal);
275 }
void progress_bar(long rlen)
int verbose
Verbosity level.

◆ existsParam()

bool XmippProgram::existsParam ( const char *  param)

Return true if the program is defined

Definition at line 387 of file xmipp_program.cpp.

388 {
389  ParamDef * paramDef = progDef->findParam(param);
390  return paramDef != NULL;
391 }
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
struct _parameter * param
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getCountParam()

int XmippProgram::getCountParam ( const char *  param)

Get the number of arguments supplied to the param

Definition at line 371 of file xmipp_program.cpp.

372 {
373  ParamDef * paramDef = progDef->findParam(param);
374  if (paramDef == NULL)
375  REPORT_ERROR(ERR_ARG_INCORRECT, ((String)"Doesn't exists param: " + param));
376  return paramDef->cmdArguments.size();
377 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
Incorrect argument received.
Definition: xmipp_error.h:113
std::vector< const char * > cmdArguments
Definition: argsparser.h:199
struct _parameter * param
std::string String
Definition: xmipp_strings.h:34
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getDoubleParam() [1/2]

double XmippProgram::getDoubleParam ( const char *  param,
int  arg = 0 
)

Definition at line 341 of file xmipp_program.cpp.

342 {
343  return textToFloat(progDef->getParam(param, arg));
344 }
float textToFloat(const char *str)
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getDoubleParam() [2/2]

double XmippProgram::getDoubleParam ( const char *  param,
const char *  subparam,
int  arg = 0 
)

Definition at line 346 of file xmipp_program.cpp.

347 {
348  return textToFloat(progDef->getParam(param, subparam, arg));
349 }
float textToFloat(const char *str)
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getFloatParam() [1/2]

float XmippProgram::getFloatParam ( const char *  param,
int  arg = 0 
)

Definition at line 351 of file xmipp_program.cpp.

352 {
353  return textToFloat(progDef->getParam(param, arg));
354 }
float textToFloat(const char *str)
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getFloatParam() [2/2]

float XmippProgram::getFloatParam ( const char *  param,
const char *  subparam,
int  arg = 0 
)

Definition at line 356 of file xmipp_program.cpp.

357 {
358  return textToFloat(progDef->getParam(param, subparam, arg));
359 }
float textToFloat(const char *str)
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getIntParam() [1/2]

int XmippProgram::getIntParam ( const char *  param,
int  arg = 0 
)

Definition at line 331 of file xmipp_program.cpp.

332 {
333  return textToInteger(progDef->getParam(param, arg));
334 }
struct _parameter * param
int textToInteger(const char *str)
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getIntParam() [2/2]

int XmippProgram::getIntParam ( const char *  param,
const char *  subparam,
int  arg = 0 
)

Definition at line 336 of file xmipp_program.cpp.

337 {
338  return textToInteger(progDef->getParam(param, subparam, arg));
339 }
struct _parameter * param
int textToInteger(const char *str)
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getListParam()

void XmippProgram::getListParam ( const char *  param,
StringVector list 
)

Get arguments supplied to param as a list

Definition at line 361 of file xmipp_program.cpp.

362 {
363  ParamDef * paramDef = progDef->findParam(param);
364  if (paramDef == NULL)
365  REPORT_ERROR(ERR_ARG_INCORRECT, ((String)"Doesn't exists param: " + param));
366  list.clear();
367  for (size_t i = 0; i < paramDef->cmdArguments.size(); ++i)
368  list.push_back(paramDef->cmdArguments[i]);
369 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
#define i
Incorrect argument received.
Definition: xmipp_error.h:113
std::vector< const char * > cmdArguments
Definition: argsparser.h:199
struct _parameter * param
std::string String
Definition: xmipp_strings.h:34
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getParam() [1/2]

const char * XmippProgram::getParam ( const char *  param,
int  arg = 0 
)

Get the argument of this param, first start at 0 position

Definition at line 321 of file xmipp_program.cpp.

322 {
323  return progDef->getParam(param, arg);
324 }
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getParam() [2/2]

const char * XmippProgram::getParam ( const char *  param,
const char *  subparam,
int  arg = 0 
)

Definition at line 326 of file xmipp_program.cpp.

327 {
328  return progDef->getParam(param, subparam, arg);
329 }
struct _parameter * param
const char * getParam(const char *paramName, size_t paramNumber=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ getParamDef()

ParamDef * XmippProgram::getParamDef ( const char *  param) const

Get Parameter definition

Definition at line 394 of file xmipp_program.cpp.

395 {
396  return progDef->findParam(param);
397 }
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
struct _parameter * param
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ initComments()

void XmippProgram::initComments ( )
virtual

Initialize comments for -v, ...

Reimplemented in XmippMetadataProgram.

Definition at line 33 of file xmipp_program.cpp.

34 {
35  CommentList comments;
36  comments.addComment("Verbosity level, 0 means no output.");
37  defaultComments["-v"] = comments;
38 }
void addComment(const String &comment, int visible=0, bool wikiVerbatim=false)
std::map< String, CommentList > defaultComments
Definition: xmipp_program.h:83

◆ initProgress()

void XmippProgram::initProgress ( size_t  total,
size_t  stepBin = 60 
)

Functions related to progress notification Set the total amount of work and initialize the progress to 0 The update step is calculated as step = XMIPP_MAX(1, total/stepBin) so, the updates only are done at step multiples

Init progress

Definition at line 251 of file xmipp_program.cpp.

252 {
253  if (verbose)
254  {
255  progressTotal = total;
256  progressStep = XMIPP_MAX(1, total / stepBin);
257  progressLast = 0;
258  init_progress_bar(total);
259  }
260 }
void init_progress_bar(long total)
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
int verbose
Verbosity level.

◆ name()

const char * XmippProgram::name ( ) const

Returns the name of the program the name of the program is defined by each subclass of this base class.

Definition at line 399 of file xmipp_program.cpp.

400 {
401  return progDef->name.c_str();
402 }
String name
Definition: argsparser.h:152
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ processDefaultComment()

void XmippProgram::processDefaultComment ( const char *  param,
const char *  left 
)

Add the comments for a given default parameter

Definition at line 40 of file xmipp_program.cpp.

41 {
42  addParamsLine(((String)left+":"+defaultComments[param].comments[0]).c_str());
43  int imax=defaultComments[param].comments.size();
44  for (int i=1; i<imax; ++i)
45  addParamsLine(((String)":"+defaultComments[param].comments[i]).c_str());
46 }
#define i
struct _parameter * param
std::string String
Definition: xmipp_strings.h:34
void addParamsLine(const String &line)
std::map< String, CommentList > defaultComments
Definition: xmipp_program.h:83

◆ quit()

void XmippProgram::quit ( int  exit_code = 0) const
virtual

function to exit the program can be useful redefined for mpi programs

Definition at line 179 of file xmipp_program.cpp.

180 {
181  exit(exit_code);
182 }

◆ read() [1/3]

void XmippProgram::read ( int  argc,
const char **  argv,
bool  reportErrors = true 
)
virtual

Read the command line arguments If an error occurs while reading arguments, the error message will be printed and the usage of the program showed. So you don't need to do that in readParams();

If not arguments are provided show the console program help

Reimplemented in PythonProgram.

Definition at line 191 of file xmipp_program.cpp.

192 {
193  if (progDef == NULL)
194  init();
195 
196  setProgramName(argv[0]);
197 
198  doRun = false;
199  errorCode = 0; //suppose no errors
201  //this behavior will be defined with environment variable XMIPP_BEHAVIOR
202  if (argc == 1)
203  {
204  if (runWithoutArgs) {
205  doRun = true;
206  } else {
207  usage();
208  }
209  }
210  else
211  {
212 
213  this->argc = argc;
214  this->argv = argv;
215  progDef->read(argc, argv, reportErrors);
216  if (!checkBuiltIns())
217  {
218  if (verbose) //if 0, ignore the parameter, useful for mpi programs
219  verbose = getIntParam("--verbose");
220  this->readParams();
221  doRun = !checkParam("--xmipp_validate_params"); //just validation, not run
222  }
223  }
224 }
virtual void usage(int verb=0) const
void read(int argc, const char **argv, bool reportErrors=true)
Read and validate commmand line.
Definition: argsparser.cpp:951
int argc
Original command line arguments.
Definition: xmipp_program.h:86
bool runWithoutArgs
Definition: xmipp_program.h:95
void setProgramName(const char *name)
const char ** argv
Definition: xmipp_program.h:87
int verbose
Verbosity level.
virtual void readParams()
bool checkParam(const char *param)
int getIntParam(const char *param, int arg=0)
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ read() [2/3]

void XmippProgram::read ( int  argc,
char **  argv,
bool  reportErrors = true 
)
virtual

Read the command line arguments A convenience wrapper

Reimplemented in ProgRecFourierMpiStarPU, MpiProgVolumeSetAlign, PythonProgram, MpiProgAngularSphAlignment, MpiProgForwardZernikeImages, MpiProgForwardZernikeImagesPriors, MpiProgForwardZernikeSubtomos, MpiProgTransformImageGreyLevels, MpiProgAngularContinuousAssign2, MpiProgSubtomoSubtraction, and MpiProgSubtractProjection.

Definition at line 226 of file xmipp_program.cpp.

227 {
228  read(argc,(const char **)argv,reportErrors);
229 }
virtual void read(int argc, const char **argv, bool reportErrors=true)
int argc
Original command line arguments.
Definition: xmipp_program.h:86
const char ** argv
Definition: xmipp_program.h:87

◆ read() [3/3]

void XmippProgram::read ( const String argumentsLine)

Read arguments from an string. This function should do the same as reading arguments but first convert the string to arguments.

Definition at line 231 of file xmipp_program.cpp.

232 {
233  int argc;
234  char ** argv=NULL;
235  char * copy=NULL;
236 
237  generateCommandLine(argumentsLine, argc, argv, copy);
238  read(argc, (const char **)argv);
239  delete[] copy;
240  delete[] argv[0]; // the only one allocated, the rest is pointing to 'copy'
241  delete[] argv;
242 }
virtual void read(int argc, const char **argv, bool reportErrors=true)
int argc
Original command line arguments.
Definition: xmipp_program.h:86
const char ** argv
Definition: xmipp_program.h:87
void generateCommandLine(const std::string &command_line, int &argcp, char **&argvp, char *&copy)
Definition: args.cpp:238

◆ readParams()

void XmippProgram::readParams ( )
virtual

Function in which each program will read parameters that it need. If some error occurs the usage will be printed out.

Reimplemented in ProgMask, ProgFindCenter2D, ProgMicrographAutomaticPicking2, ProgClassifyCL3D, ProgNormalize, ProgClassifyCL2D, ProgMLTomo, BasicMpiMetadataProgram< BASE_CLASS >, BasicMpiMetadataProgram< ProgAngularContinuousAssign >, BasicMpiMetadataProgram< ProgPSDSort >, BasicMpiMetadataProgram< ProgEliminateByEnergy >, BasicMpiMetadataProgram< ProgThreshold >, BasicMpiMetadataProgram< ProgCorrectWiener2D >, BasicMpiMetadataProgram< ProgAngularDiscreteAssign >, BasicMpiMetadataProgram< ProgMask >, BasicMpiMetadataProgram< ProgTomoExtractSubvolume >, BasicMpiMetadataProgram< ProgFilter >, BasicMpiMetadataProgram< ProgTransformGeometry >, BasicMpiMetadataProgram< ProgImageSSNR >, BasicMpiMetadataProgram< ProgNormalize >, BasicMpiMetadataProgram< ProgImageResize >, BasicMpiMetadataProgram< ProgCorrectPhaseFlip2D >, BasicMpiMetadataProgram< ProgOperate >, BasicMpiMetadataProgram< ProgSymmetrize >, BasicMpiMetadataProgram< ProgCtfCorrectIdr >, MpiMetadataProgram, ProgRecFourier, ProgMetadataUtilities, ProgRecFourierAccel, ProgRecFourierGPU, ProgAlignVolumes, ProgTomographAlignment, ProgForwardZernikeSubtomos, ProgMLF2D, ProgFlexibleAlignment, ProgAngularProjectLibrary, ProgForwardZernikeImages, ProgWindow, ProgForwardZernikeImagesPriors, ProgFSO, ProgParallelForwardArtZernike3D, ProgAngularSphAlignment, MpiProgAngularClassAverage, ProgNmaAlignmentVol, ProgAngularSphAlignmentGpu, ProgAngularContinuousAssign2, ProgForwardArtZernike3D, ProgForwardArtZernike3DSubtomos, ProgNmaAlignment, ProgConstructPDBDictionary, ProgAngularProjectionMatching, ProgVolumeToPseudoatoms, ProgReconstructSignificant, ProgSubtractProjection, ProgRecFourierStarPU, ProgAngResAlign, ProgCTFBasicParams, ProgCtfGroup, ProgArtZernike3D, XmippMetadataProgram, ProgClassifyFTTRI, ProgImagePeakHighContrast, ProgOpticalAligment, ProgForwardZernikeVol, ProgImageRotationalPCA, ProgMLRefine3D, ProgSubtomoSubtraction, ProgVolumeDeformSphGpu, ProgVolumeInitialSimulatedAnnealing, ProgML2D, ProgTomoTSFilterDose, ProgMovieFilterDose, ProgXrayProject, ProgAngularDiscreteAssign, ProgXrayImport, ProgMatrixDimRed, ProgVolDeformSph, ProgVolumeFindSymmetry, ProgReconsADMM, ProgTomoExtractSubvolume, ProgMetadataHistogram, ProgKenderSOM, ProgMicrographScissor, ProgMorphology, ProgIDRXrayTomo, ProgClassifySignificant, ProgCommonLine, MpiProgAngularProjectionMatching, ProgProject, ProgPdbConverter, ProgPSDSort, ProgVolumeSetAlign, ProgSSNR, ProgSortImages, ProgTomoAlignRefinement, ProgReconsXrayART, ProgRecWbp, ProgValidationTiltPairs, ProgDimRed, ProgMPIRecFourier, ProgCTFEstimateFromMicrograph, ProgPDBDictionary, ProgClassifyCL2DCore, ProgSimulateMicroscope, ProgScoreMicrograph, ProgAnalyzeCluster, ProgMpiAngularProjectLibrary, ProgPdbValueToVol, ProgTransformImageGreyLevels, ProgExtractFeatures, ProgHeader, ProgStatistics, ProgVolumeCorrectBfactor, ProgAngularDistance, ProgMetadataSplit, ProgTomoExtractSubtomograms, ProgOperate, ProgVolumeHalvesRestoration, ProgResDir, ProgVolumeSegment, ProgTomoSimulateTiltseries, ProgARTPseudo, ProgConvImg, ProgAngularContinuousAssign, ProgMonogenicSignalRes, ProgSymmetrize, ProgRecFourierMpiStarPU, ProgVolumeEnhanceContrast, ProgTomoExtractParticleStacks, ProgTransRangeAdjust, MultireferenceAligneability, ProgResLocalFilter, ProgMonoTomo, ProgMonoTomo, ProgDetectMissingWedge, ProgVolumePCA, ProgPdbSphDeform, ProgAddNoise, ProgEvaluateClass, ProgassignmentTiltPair, ProgVolumeValidationPCA, ProgCTFEnhancePSD, Phantom_transform_parameters, ProgVolumeHomogenizer, ProgCtfCorrectIdr, ProgCtfCorrectAmplitude3D, ProgClassifyFirstSplit3, ProgAdjustVolume, ProgCompareDensity, ProgCompareViews, ProgCorrectWiener2D, ProgHistogram, ProgPSFXrCreate, ProgImageResize, ProgAngularNeighbourhood, ProgMetadataSplit3D, ProgLocSharpening, ProgVolumeHalvesRestorationGpu< T >, ProgAlignTiltPairs, ProgEvaluateCoordinates, ProgAngularRotate, ProgEliminateEmptyParticles, ProgThreshold, ProgApplyVolDeformSph, ProgMakeSpectra, ProgTransformDimRed, ProgAlign2d, ProgAngularAccuracyPCA, AProgMovieAlignmentCorrelation< T >, ProgCenterImage, ProgMetadataImport, ProgSpiderTranslate, ProgTomoRemoveFluctuations, ProgClassifyFirstSplit, ProgPdbAnalysis, ProgClassifyKmeans2D, ProgResolutionIBW, ProgTransformDownsample, ProgCTFPhaseFlipping, ProgGpuCorrelation, ProgImageVectorize, ProgMovieEstimateGain, ProgPdbNmaDeform, ProgCoordinatesNoisyZonesFilter, ProgCTFEstimateFromPSD, ProgPdbReduce, PythonProgram, ProgAlignDualTiltSeries, ProgPerformanceTest, ProgMPIRun, ProgValidationNonTilt, ProgTransformGeometry, ProgAngularAssignmentMag, ProgAngularBreakSymmetry, ProgSortByStatistics, ProgTomoMapBack, ProgPhantomCreate, ProgAngularEstimateTiltAxis, ProgCTFEstimateFromPSDFast, ProgReconsART, ProgVolumeToWeb, Alignment::ProgAlignSignificantGPU< T >, ProgRandomizePhases, FlipParameters, ProgTestWork, ProgCTFShow, Alignment::AProgAlignSignificant< T >, ProgFilter, ProgCompareClass, ProgProjectTomography, ProgVolumeStructureFactor, ProgVolumeCenter, ProgResolutionFsc, MpiProgAngularSphAlignment, MpiProgForwardZernikeImages, MpiProgForwardZernikeImagesPriors, MpiProgForwardZernikeSubtomos, ProgEliminateByEnergy, ProgMrcCreateMetaData, MpiProgAngularAssignmentMag, ProgAngularDistributionShow, ProgCorrectPhaseFlip2D, ProgImageSSNR, ProgRestoreWithPDBDictionary, ProgMPIRecWbp, MpiProgTransformImageGreyLevels, ProgMovieAlignmentCorrelation< T >, ProgMovieAlignmentCorrelationGPU< T >, ProgCtfCreateCtfdat, MpiProgAngularContinuousAssign2, ProgImageResiduals, ProgSeparateObjects, MpiProgSubtomoSubtraction, MpiProgSubtractProjection, and ProgExtractSubset.

Definition at line 184 of file xmipp_program.cpp.

185 {
186  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "function 'readParams'");
187 }
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211

◆ run()

void XmippProgram::run ( )
virtual

This function will be start running the program. it also should be implemented by derived classes.

Reimplemented in ProgFindCenter2D, ProgMetadataUtilities, ProgMpiAngularProjectLibrary, ProgOpticalAligment, ProgMicrographAutomaticPicking2, ProgClassifyCL3D, ProgClassifyCL2D, ML2DBaseProgram, ProgSortImages, ProgAlignVolumes, ProgMLTomo, ProgTomographAlignment, ProgImagePeakHighContrast, ProgVolumeFindSymmetry, ProgRecFourier, ProgClassifyFTTRI, XmippMetadataProgram, ProgAngularProjectLibrary, ProgFSO, ProgCtfGroup, Phantom_transform_parameters, ProgImageRotationalPCA, MpiProgAngularClassAverage, ProgAngularProjectionMatching, ProgVolumeToPseudoatoms, ProgKenderSOM, ProgConstructPDBDictionary, ProgReconstructSignificant, ProgRecFourierStarPU, ProgAngResAlign, ProgMicrographScissor, ProgMLRefine3D, ProgForwardZernikeVol, ProgVolumeDeformSphGpu, ProgVolumeInitialSimulatedAnnealing, ProgResDir, ProgExtractFeatures, ProgTomoTSFilterDose, ProgCommonLine, ProgMovieFilterDose, ProgXrayImport, ProgMatrixDimRed, ProgXrayProject, ProgVolDeformSph, ProgMetadataHistogram, ProgMetadataSplit, ProgClassifySignificant, ProgClassifyCL2DCore, ProgRecFourierAccel, ProgMonoTomo, ProgTomoAlignRefinement, ProgAngularRotate, ProgReconsADMM, ProgPdbConverter, ProgIDRXrayTomo, ProgMonoTomo, ProgCTFEstimateFromMicrograph, ProgMPIRecFourier, ProgHistogram, ProgProject, ProgAnalyzeCluster, ProgRecWbp, ProgLocSharpening, ProgVolumeSegment, ProgTomoSimulateTiltseries, ProgSSNR, ProgAngularDistance, ProgMonogenicSignalRes, ProgPdbValueToVol, ProgResLocalFilter, ProgCtfCorrectAmplitude3D, ProgReconsXrayART, ProgValidationTiltPairs, ProgPDBDictionary, ProgScoreMicrograph, ProgAlignDualTiltSeries, ProgAngularDistributionShow, ProgPSFXrCreate, ProgVolumeHalvesRestoration, ProgTomoExtractSubtomograms, ProgVolumeHomogenizer, ProgCtfCreateCtfdat, ProgARTPseudo, ProgDetectMissingWedge, ProgVolumePCA, ProgMPIRun, ProgAlign2d, ProgAngularNeighbourhood, ProgRecFourierMpiStarPU, ProgVolumeToWeb, ProgassignmentTiltPair, ProgEvaluateClass, ProgImageVectorize, ProgVolumeValidationPCA, ProgCTFEstimateFromPSD, ProgAdjustVolume, MultireferenceAligneability, ProgPdbSphDeform, ProgVolumeEnhanceContrast, ProgClassifyFirstSplit3, ProgTomoExtractParticleStacks, ProgVolumeHalvesRestorationGpu< T >, ProgTransformDimRed, ProgMetadataSplit3D, ProgTomoRemoveFluctuations, ProgAlignTiltPairs, ProgEvaluateCoordinates, ProgCompareDensity, ProgCompareViews, ProgEliminateEmptyParticles, AProgMovieAlignmentCorrelation< T >, ProgGpuCorrelation, ProgAngularBreakSymmetry, ProgClassifyFirstSplit, ProgRecFourierGPU, ProgMetadataImport, ProgClassifyKmeans2D, ProgMakeSpectra, ProgResolutionIBW, ProgPerformanceTest, ProgApplyVolDeformSph, ProgVolumeStructureFactor, ProgSeparateObjects, ProgTomoMapBack, ProgSortByStatistics, ProgPdbAnalysis, ProgProjectTomography, ProgAngularAccuracyPCA, ProgCTFEstimateFromPSDFast, ProgPdbNmaDeform, ProgPdbReduce, ProgMrcCreateMetaData, ProgResolutionFsc, ProgPhantomCreate, ProgCTFPhaseFlipping, ProgMovieEstimateGain, ProgValidationNonTilt, ProgCompareClass, ProgCoordinatesNoisyZonesFilter, PythonProgram, ProgAngularEstimateTiltAxis, ProgTestWork, ProgReconsART, Alignment::AProgAlignSignificant< T >, ProgCTFShow, ProgMPIReconsArt, ProgRestoreWithPDBDictionary, ProgMPIXrayProject, and ProgExtractSubset.

Definition at line 174 of file xmipp_program.cpp.

175 {
176  REPORT_ERROR(ERR_NOT_IMPLEMENTED, "function 'run'");
177 }
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211

◆ setDefaultComment()

void XmippProgram::setDefaultComment ( const char *  param,
const char *  comment 
)

Set default comment

Definition at line 48 of file xmipp_program.cpp.

49 {
50  defaultComments[param].clear();
51  defaultComments[param].addComment(comment);
52 }
struct _parameter * param
std::map< String, CommentList > defaultComments
Definition: xmipp_program.h:83

◆ setProgramName()

void XmippProgram::setProgramName ( const char *  name)

Set the program name

Definition at line 277 of file xmipp_program.cpp.

278 {
279  progDef->name = name;
280 }
String name
Definition: argsparser.h:152
const char * name() const
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ setProgress()

void XmippProgram::setProgress ( size_t  value = 0)

Notify progress on work

Definition at line 263 of file xmipp_program.cpp.

264 {
265  progressLast = value ? value : progressLast + 1;
266  if (verbose && progressLast % progressStep == 0)
267  progress_bar(progressLast);
268 }
void progress_bar(long rlen)
int verbose
Verbosity level.

◆ show()

void XmippProgram::show ( ) const
virtual

◆ tryRun()

int XmippProgram::tryRun ( )
virtual

Call the run function inside a try/catch block The function will return the error code when 0 means success and a value greater than 0 represents the error type

Reimplemented in XmippMpiProgram, and ProgRecFourierMpiStarPU.

Definition at line 244 of file xmipp_program.cpp.

245 {
246  if (doRun)
247  this->run();
248  return errorCode;
249 }
virtual void run()

◆ usage() [1/2]

void XmippProgram::usage ( int  verb = 0) const
virtual

Print the usage of the program, reduced version

Reimplemented in MpiProgML2D.

Definition at line 404 of file xmipp_program.cpp.

405 {
406  if (verbose)
407  {
408  ConsolePrinter cp;
409  char * var = getenv("XMIPP_COLOR_OFF");
410  if (var != NULL)
411  cp.color = false;
412  cp.printProgram(*progDef, verb);
413  }
414 }
int verbose
Verbosity level.
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80
virtual void printProgram(const ProgramDef &program, int v=0)
Definition: argsprinter.cpp:50

◆ usage() [2/2]

void XmippProgram::usage ( const String param,
int  verb = 2 
)
virtual

Print help about specific parameter

Definition at line 416 of file xmipp_program.cpp.

417 {
418  if (verbose)
419  {
420  ConsolePrinter cp;
421  ParamDef * paramDef = progDef->findParam(param);
422  if (paramDef == NULL)
423  REPORT_ERROR(ERR_ARG_INCORRECT, ((String)"Doesn't exists param: " + param));
424  cp.printParam(*paramDef, verb);
425  }
426  quit(0);
427 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
ParamDef * findParam(const String &param)
Definition: argsparser.cpp:905
virtual void printParam(const ParamDef &param, int v=0)
virtual void quit(int exit_code=0) const
Incorrect argument received.
Definition: xmipp_error.h:113
int verbose
Verbosity level.
struct _parameter * param
std::string String
Definition: xmipp_strings.h:34
ProgramDef * progDef
Program definition and arguments parser.
Definition: xmipp_program.h:80

◆ version()

int XmippProgram::version ( ) const

Return the version of the program

Definition at line 432 of file xmipp_program.cpp.

433 {
435 }
Case or algorithm not implemented yet.
Definition: xmipp_error.h:177
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211

Member Data Documentation

◆ argc

int XmippProgram::argc
protected

Original command line arguments.

Definition at line 86 of file xmipp_program.h.

◆ argv

const char** XmippProgram::argv
protected

Definition at line 87 of file xmipp_program.h.

◆ debug

int XmippProgram::debug

debug flag

Definition at line 163 of file xmipp_program.h.

◆ defaultComments

std::map<String, CommentList> XmippProgram::defaultComments
protected

Default comments

Definition at line 83 of file xmipp_program.h.

◆ doRun

bool XmippProgram::doRun

Flag to check whether to run or not

Definition at line 91 of file xmipp_program.h.

◆ errorCode

int XmippProgram::errorCode
protected

Value to store possible error codes

Definition at line 78 of file xmipp_program.h.

◆ progDef

ProgramDef* XmippProgram::progDef
protected

Program definition and arguments parser.

Definition at line 80 of file xmipp_program.h.

◆ runWithoutArgs

bool XmippProgram::runWithoutArgs

Flag to mark if the program should run without arguments or just print the usage(default behavior)

Definition at line 95 of file xmipp_program.h.

◆ verbose

int XmippProgram::verbose

Verbosity level.

Definition at line 161 of file xmipp_program.h.


The documentation for this class was generated from the following files: