2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/SARTConfig.cpp $
5 $LastChangedRevision: 123 $
6 $Date: 2014-07-11 09:44:57 -0400 (Fri, 11 Jul 2014) $
8 ***********************************************************
11 #include "SARTConfig.h"
18 REAL SARTConfig::relaxiation = 1;
19 REAL SARTConfig::zeroThreshold = Consts.zero;
21 SARTConfig::SARTConfig()
25 SARTConfig::~SARTConfig()
29 void SARTConfig::printErrorMessage(char* errorString)
31 fprintf(output, "\n wrong configuration for SART --> default values might be applied ...");
32 fprintf(output, "\n error message: %s", errorString);
33 fprintf(output, "\n check documentation for further details !!!");
36 BOOLEAN SARTConfig::readSARTConfiguration()
39 // definition of possible set-up parameters
40 static const INTEGER strParameterRelaxation = CHAR2INT('r', 'e', 'l', 'a');
41 static const INTEGER strParameterConstValue = CHAR2INT('c', 'o', 'n', 's');
43 INTEGER currentParameterValueInt;
44 REAL currentParameterValueReal;
46 INTEGER* allowedExpressions = new INTEGER[10];
47 INTEGER numberOfAllowedExpressions = 0;
49 // FORMAT OF INPUT COMMAND:
53 // RELAXATION CONSTANT r ... optional
58 // SART Execution Sample
59 // RELAXATION CONSTANT 1.9
62 allowedExpressions[0] = strParameterRelaxation;
63 numberOfAllowedExpressions = 1;
64 currentParameterValueInt = InFile.getwrd(TRUE, &eol, allowedExpressions,
65 numberOfAllowedExpressions);
67 // optional parameters --> EOL causes no error
70 switch (currentParameterValueInt)
73 case strParameterRelaxation:
76 allowedExpressions[0] = strParameterConstValue;
77 numberOfAllowedExpressions = 1;
78 currentParameterValueInt = InFile.getwrd(FALSE, &eol,
79 allowedExpressions, numberOfAllowedExpressions);
81 switch (currentParameterValueInt)
83 case strParameterConstValue:
85 // check if 0 < r <= 2
86 currentParameterValueReal = InFile.getnum(FALSE, &eol);
87 if (currentParameterValueReal > 0.0 && currentParameterValueReal <= 2.0)
89 SARTConfig::relaxiation = currentParameterValueReal;
93 SARTConfig::printErrorMessage("relaxation parameter must fit to 0.0 < r <= 2.0");
98 SARTConfig::printErrorMessage("second parameter must be CONS[TANT]");
103 SARTConfig::printErrorMessage("first parameter must be RELA[XATION]");
108 fprintf(output, "\n relaxation parameter is %4.3f",
109 SARTConfig::relaxiation);
111 delete[] allowedExpressions;