[110] | 1 | /* src/duchamp.hh. Generated by configure. */ |
---|
[105] | 2 | #ifndef DUCHAMP_HH |
---|
| 3 | #define DUCHAMP_HH |
---|
| 4 | |
---|
[175] | 5 | #include <iostream> |
---|
[125] | 6 | #include <string> |
---|
| 7 | |
---|
[141] | 8 | #undef PACKAGE_BUGREPORT |
---|
| 9 | #undef PACKAGE_NAME |
---|
| 10 | #undef PACKAGE_STRING |
---|
| 11 | #undef PACKAGE_TARNAME |
---|
| 12 | #undef PACKAGE_VERSION |
---|
[110] | 13 | #include "config.h" |
---|
| 14 | |
---|
[71] | 15 | // how to convey whether a function has worked |
---|
[168] | 16 | enum OUTCOME {SUCCESS=0, FAILURE}; |
---|
[71] | 17 | |
---|
[110] | 18 | const std::string ERR_USAGE_MSG = |
---|
[85] | 19 | "Usage:: Duchamp -p [parameter file]\n\ |
---|
[57] | 20 | Other options:\n\ |
---|
[85] | 21 | -f <file> Use default parameters with imageFile=<file>\n\ |
---|
| 22 | -v Version number\n\ |
---|
| 23 | -h This help information\n"; |
---|
[57] | 24 | |
---|
[142] | 25 | const std::string ERR_USAGE_MSG_SHORT="Usage:: Duchamp -p [parameter file]\n"; |
---|
[57] | 26 | |
---|
[110] | 27 | const std::string PROGNAME = PACKAGE_NAME; |
---|
[57] | 28 | |
---|
[110] | 29 | const std::string VERSION = PACKAGE_VERSION; |
---|
[71] | 30 | |
---|
[120] | 31 | // Specialised functions to report warnings and errors. |
---|
| 32 | // These are defined in duchamp.cc |
---|
| 33 | void duchampWarning(std::string subroutine, std::string warning); |
---|
| 34 | void duchampError(std::string subroutine, std::string error); |
---|
| 35 | |
---|
[175] | 36 | // A simple functions to print a given number of backspaces or spaces |
---|
| 37 | // to std::cout |
---|
| 38 | inline void printBackSpace(int num){for(int i=0;i<num;i++) std::cout << '\b';}; |
---|
| 39 | inline void printSpace(int num){ for(int i=0;i<num;i++) std::cout << ' '; }; |
---|
| 40 | inline void printHash(int num){ for(int i=0;i<num;i++) std::cout << '#'; }; |
---|
[187] | 41 | class ProgressBar |
---|
| 42 | { |
---|
| 43 | /** |
---|
| 44 | * ProgressBar Class |
---|
| 45 | * A class that prints out a progress bar in the form |#### | |
---|
| 46 | * that shows how far through a function or loop you are. |
---|
| 47 | * The length of it defaults to 20, but can be set when declaring the |
---|
| 48 | * object. |
---|
| 49 | * There are three functions: |
---|
| 50 | * init(size) --> prints an empty bar, and defines the increment |
---|
| 51 | * update(num) --> prints the correct number of #s, but only when |
---|
| 52 | * num is a multiple of the increment. |
---|
| 53 | * rewind(num) --> prints backspaces to cover the entire bar. |
---|
| 54 | */ |
---|
| 55 | public: |
---|
[201] | 56 | ProgressBar(){length=20; loc=BEG;}; |
---|
| 57 | ProgressBar(int newlength){length=newlength; loc=BEG;}; |
---|
| 58 | enum POS {BEG=0,END}; |
---|
| 59 | |
---|
[187] | 60 | void init(int size){ |
---|
| 61 | std::cout << "|"; printSpace(length); |
---|
| 62 | std::cout << "|" << std::flush; |
---|
| 63 | fraction = size/length; |
---|
[201] | 64 | loc = END; |
---|
[187] | 65 | }; |
---|
| 66 | void update(int num){ |
---|
| 67 | if(num%fraction==0){ |
---|
| 68 | printBackSpace(length+2); std::cout << "|"; |
---|
| 69 | printHash(num/fraction); printSpace(length-num/fraction); |
---|
| 70 | std::cout << "|" << std::flush; |
---|
| 71 | } |
---|
[201] | 72 | loc=END; |
---|
[187] | 73 | }; |
---|
[201] | 74 | void rewind(){if(loc==END) printBackSpace(length+2); loc=BEG;}; |
---|
| 75 | void remove(){rewind();printSpace(length+2);loc=END; rewind();}; |
---|
| 76 | void fillSpace(std::string someString){ |
---|
| 77 | rewind(); |
---|
| 78 | std::cout << someString; |
---|
| 79 | printSpace(length+2-someString.size()); |
---|
| 80 | loc=END; |
---|
| 81 | } |
---|
[187] | 82 | private: |
---|
[201] | 83 | POS loc; |
---|
[187] | 84 | int fraction; |
---|
| 85 | int length; |
---|
| 86 | }; |
---|
[175] | 87 | |
---|
[103] | 88 | // The spectral type that we want the wcsprm structs to be in |
---|
[142] | 89 | const char duchampVelocityType[9] = "VELO-F2V"; |
---|
| 90 | const char duchampFrequencyType[9] = "FREQ"; |
---|
[103] | 91 | |
---|
[186] | 92 | enum TYPEDESC {FREQUENCY=0,VELOCITY,WAVELENGTH}; |
---|
| 93 | const std::string duchampSpectralDescription[3]= |
---|
| 94 | {"Frequency", "Velocity", "Wavelength"}; |
---|
| 95 | |
---|
[110] | 96 | // The following are the FITS Header Keywords corresponding to the |
---|
[71] | 97 | // parameters related to the atrous reconstruction. |
---|
| 98 | const std::string keyword_scaleMin = "DU_MINSC"; |
---|
| 99 | const std::string keyword_snrRecon = "DU_ATCUT"; |
---|
[103] | 100 | const std::string keyword_reconDim = "DU_ATDIM"; |
---|
[71] | 101 | const std::string keyword_filterCode = "DU_FILTR"; |
---|
[175] | 102 | const std::string keyword_ReconResid = "DU_RECON";//reconstruction or residual? |
---|
[105] | 103 | const std::string keyword_subsection = "DU_IMSUB"; |
---|
[142] | 104 | |
---|
[71] | 105 | // And these are the comments corresponding to the relevant keywords |
---|
| 106 | const std::string comment_scaleMin = "Duchamp parameter scaleMin"; |
---|
| 107 | const std::string comment_snrRecon = "Duchamp parameter snrRecon"; |
---|
[103] | 108 | const std::string comment_reconDim = "Duchamp parameter reconDim"; |
---|
[71] | 109 | const std::string comment_filterCode = "Duchamp parameter filterCode"; |
---|
| 110 | const std::string comment_ReconResid = "Is this the reconstruction or residual?"; |
---|
[105] | 111 | const std::string comment_subsection = "Subsection of the original image"; |
---|
[71] | 112 | // Descriptive Headers: |
---|
| 113 | const std::string header_history1 = "Reconstructed with a trous wavelet technique"; |
---|
| 114 | const std::string header_history2 = "Reconstruction by Duchamp v." + VERSION; |
---|
[105] | 115 | const std::string header_history_input = "Original (input) image used by Duchamp follows"; |
---|
| 116 | const std::string header_subsection_comment = "A subsection of the original was reconstructed by Duchamp"; |
---|
| 117 | const std::string header_atrous_comment = "The following are the Duchamp parameters used in reconstruction"; |
---|
| 118 | |
---|
| 119 | #endif |
---|
| 120 | |
---|