1 | #ifndef PARAM_H |
---|
2 | #define PARAM_H |
---|
3 | |
---|
4 | #include <iostream> |
---|
5 | #include <string> |
---|
6 | #include <vector> |
---|
7 | |
---|
8 | using std::string; |
---|
9 | using std::vector; |
---|
10 | |
---|
11 | /** |
---|
12 | * Param class. |
---|
13 | * Used for storing parameters used by all functions. |
---|
14 | */ |
---|
15 | class Param |
---|
16 | { |
---|
17 | public: |
---|
18 | Param(); |
---|
19 | virtual ~Param(){}; |
---|
20 | void parseSubsection(); // in param.cc |
---|
21 | void readParams(string ¶mfile); // in param.cc |
---|
22 | bool isBlank(float &value); // in param.cc |
---|
23 | friend std::ostream& operator<< ( std::ostream& theStream, Param& par); |
---|
24 | friend class Image; |
---|
25 | |
---|
26 | // |
---|
27 | string getImageFile(){return imageFile;}; |
---|
28 | void setImageFile(string fname){imageFile = fname;}; |
---|
29 | bool getFlagSubsection(){return flagSubsection;}; |
---|
30 | void setFlagSubsection(bool flag){flagSubsection=flag;}; |
---|
31 | string getSubsection(){return subsection;}; |
---|
32 | void setSubsection(string range){subsection = range;}; |
---|
33 | bool getFlagLog(){return flagLog;}; |
---|
34 | void setFlagLog(bool flag){flagLog=flag;}; |
---|
35 | string getLogFile(){return logFile;}; |
---|
36 | void setLogFile(string fname){logFile = fname;}; |
---|
37 | string getOutFile(){return outFile;}; |
---|
38 | void setOutFile(string fname){outFile = fname;}; |
---|
39 | string getSpectraFile(){return spectraFile;}; |
---|
40 | void setSpectraFile(string fname){spectraFile = fname;}; |
---|
41 | bool getFlagOutputRecon(){return flagOutputRecon;}; |
---|
42 | void setFlagOutputRecon(bool flag){flagOutputRecon=flag;}; |
---|
43 | bool getFlagOutputResid(){return flagOutputResid;}; |
---|
44 | void setFlagOutputResid(bool flag){flagOutputResid=flag;}; |
---|
45 | bool getFlagVOT(){return flagVOT;}; |
---|
46 | void setFlagVOT(bool flag){flagVOT=flag;}; |
---|
47 | string getVOTFile(){return votFile;}; |
---|
48 | void setVOTFile(string fname){votFile = fname;}; |
---|
49 | bool getFlagKarma(){return flagKarma;}; |
---|
50 | void setFlagKarma(bool flag){flagKarma=flag;}; |
---|
51 | string getKarmaFile(){return karmaFile;}; |
---|
52 | void setKarmaFile(string fname){karmaFile = fname;}; |
---|
53 | bool getFlagMaps(){return flagMaps;}; |
---|
54 | void setFlagMaps(bool flag){flagMaps=flag;}; |
---|
55 | string getDetectionMap(){return detectionMap;}; |
---|
56 | void setDetectionMap(string fname){detectionMap = fname;}; |
---|
57 | string getMomentMap(){return momentMap;}; |
---|
58 | void setMomentMap(string fname){momentMap = fname;}; |
---|
59 | // |
---|
60 | bool getFlagBlankPix(){return flagBlankPix;}; |
---|
61 | void setFlagBlankPix(bool flag){flagBlankPix=flag;}; |
---|
62 | bool getNanFlag(){return nanAsBlank;}; |
---|
63 | void setNanFlag(bool flag){nanAsBlank = flag;}; |
---|
64 | float getBlankPixVal(){return blankPixValue;}; |
---|
65 | void setBlankPixVal(float v){blankPixValue=v;}; |
---|
66 | int getBlankKeyword(){return blankKeyword;}; |
---|
67 | void setBlankKeyword(int v){blankKeyword=v;}; |
---|
68 | float getBscaleKeyword(){return bscaleKeyword;}; |
---|
69 | void setBscaleKeyword(float v){bscaleKeyword=v;}; |
---|
70 | float getBzeroKeyword(){return bzeroKeyword;}; |
---|
71 | void setBzeroKeyword(float v){bzeroKeyword=v;}; |
---|
72 | bool getFlagMW(){return flagMW;}; |
---|
73 | bool setFlagMW(bool flag){flagMW=flag;}; |
---|
74 | int getMaxMW(){return maxMW;}; |
---|
75 | void setMaxMW(int m){maxMW=m;}; |
---|
76 | int getMinMW(){return minMW;}; |
---|
77 | void setMinMW(int m){minMW=m;}; |
---|
78 | void setBeamSize(float s){numPixBeam = s;}; |
---|
79 | float getBeamSize(){return numPixBeam;}; |
---|
80 | // |
---|
81 | bool getFlagCubeTrimmed(){return flagTrimmed;}; |
---|
82 | void setFlagCubeTrimmed(bool flag){flagTrimmed = flag;}; |
---|
83 | long getBorderLeft(){return borderLeft;}; |
---|
84 | void setBorderLeft(long b){borderLeft = b;}; |
---|
85 | long getBorderRight(){return borderRight;}; |
---|
86 | void setBorderRight(long b){borderRight = b;}; |
---|
87 | long getBorderBottom(){return borderBottom;}; |
---|
88 | void setBorderBottom(long b){borderBottom = b;}; |
---|
89 | long getBorderTop(){return borderTop;}; |
---|
90 | void setBorderTop(long b){borderTop = b;}; |
---|
91 | // |
---|
92 | long getXOffset(){return xSubOffset;}; |
---|
93 | void setXOffset(long o){xSubOffset = o;}; |
---|
94 | long getYOffset(){return ySubOffset;}; |
---|
95 | void setYOffset(long o){ySubOffset = o;}; |
---|
96 | long getZOffset(){return zSubOffset;}; |
---|
97 | void setZOffset(long o){zSubOffset = o;}; |
---|
98 | // |
---|
99 | int getMinPix(){return minPix;}; |
---|
100 | void setMinPix(int m){minPix=m;}; |
---|
101 | // |
---|
102 | bool getFlagGrowth(){return flagGrowth;}; |
---|
103 | void setFlagGrowth(bool flag){flagGrowth=flag;}; |
---|
104 | float getGrowthCut(){return growthCut;}; |
---|
105 | void setGrowthCut(float c){growthCut=c;}; |
---|
106 | // |
---|
107 | bool getFlagFDR(){return flagFDR;}; |
---|
108 | void setFlagFDR(bool flag){flagFDR=flag;}; |
---|
109 | float getAlpha(){return alphaFDR;}; |
---|
110 | void setAlpha(float a){alphaFDR=a;}; |
---|
111 | // |
---|
112 | bool getFlagBaseline(){return flagBaseline;}; |
---|
113 | void setFlagBaseline(bool flag){flagBaseline = flag;}; |
---|
114 | // |
---|
115 | float getCut(){return snrCut;}; |
---|
116 | void setCut(float c){snrCut=c;}; |
---|
117 | // |
---|
118 | bool getFlagATrous(){return flagATrous;}; |
---|
119 | void setFlagATrous(bool flag){flagATrous=flag;}; |
---|
120 | int getMinScale(){return scaleMin;}; |
---|
121 | void setMinScale(int s){scaleMin=s;}; |
---|
122 | float getAtrousCut(){return snrRecon;}; |
---|
123 | void setAtrousCut(float c){snrRecon=c;}; |
---|
124 | int getFilterCode(){return filterCode;}; |
---|
125 | void setFilterCode(int c){filterCode=c;}; |
---|
126 | string getFilterName(){return filterName;}; |
---|
127 | void setFilterName(string s){filterName=s;}; |
---|
128 | // |
---|
129 | bool getFlagAdjacent(){return flagAdjacent;}; |
---|
130 | void setFlagAdjacent(bool flag){flagAdjacent=flag;}; |
---|
131 | float getThreshS(){return threshSpatial;}; |
---|
132 | void setThreshS(float t){threshSpatial=t;}; |
---|
133 | float getThreshV(){return threshVelocity;}; |
---|
134 | void setThreshV(float t){threshVelocity=t;}; |
---|
135 | int getMinChannels(){return minChannels;}; |
---|
136 | void setMinChannels(int n){minChannels=n;}; |
---|
137 | // |
---|
138 | bool drawBorders(){return borders;}; |
---|
139 | void setDrawBorders(bool f){borders=f;}; |
---|
140 | bool isVerbose(){return verbose;}; |
---|
141 | void setVerbosity(bool f){verbose=f;}; |
---|
142 | |
---|
143 | private: |
---|
144 | // Input files |
---|
145 | string imageFile; // The image to be analysed. |
---|
146 | bool flagSubsection; // Whether we just want a subsection of the image |
---|
147 | string subsection; // The subsection requested, of the form [x1:x2,y1:y2,z1:z2] |
---|
148 | // If you want the full range of one index, use * |
---|
149 | // Output files |
---|
150 | bool flagLog; // Should we do the intermediate logging? |
---|
151 | string logFile; // Where the intermediate logging goes. |
---|
152 | string outFile; // Where the final results get put. |
---|
153 | string spectraFile; // Where the spectra are displayed |
---|
154 | bool flagOutputRecon; // Should the reconstructed cube be written? |
---|
155 | bool flagOutputResid; // Should the reconstructed cube be written? |
---|
156 | bool flagVOT; // Should we save results in VOTable format? |
---|
157 | string votFile; // Where the VOTable goes. |
---|
158 | bool flagKarma; // Should we save results in Karma annotation format? |
---|
159 | string karmaFile; // Where the Karma annotation file goes. |
---|
160 | bool flagMaps; // Should we produce detection and moment maps in postscript form? |
---|
161 | string detectionMap; // The name of the detection map (ps file). |
---|
162 | string momentMap; // The name of the 0th moment map (ps file). |
---|
163 | |
---|
164 | // Cube related parameters |
---|
165 | bool flagBlankPix; // A flag that indicates whether there are pixels defined as BLANK, |
---|
166 | // with the value given by the next parameter. |
---|
167 | float blankPixValue; // Pixel value that is considered BLANK. |
---|
168 | int blankKeyword; // The FITS header keyword BLANK. |
---|
169 | float bscaleKeyword; // The FITS header keyword BSCALE. |
---|
170 | float bzeroKeyword; // The FITS header keyword BZERO. |
---|
171 | bool nanAsBlank; // Are the BLANK pixels defined by NaNs? |
---|
172 | bool flagMW; // A flag that indicates whether to excise the Milky Way. |
---|
173 | int maxMW; // Last Galactic velocity plane for HIPASS cubes |
---|
174 | int minMW; // First Galactic velocity plane for HIPASS cubes |
---|
175 | float numPixBeam; // Size (area) of the beam in pixels. |
---|
176 | // Trim-related |
---|
177 | bool flagTrimmed; // Has the cube been trimmed of excess BLANKs around the edge? |
---|
178 | long borderLeft; // The number of BLANK pixels trimmed from the Left of the cube; |
---|
179 | long borderRight; // The number of BLANK pixels trimmed from the Right of the cube; |
---|
180 | long borderBottom; // The number of BLANK pixels trimmed from the Bottom of the cube; |
---|
181 | long borderTop; // The number of BLANK pixels trimmed from the Top of the cube; |
---|
182 | // Subsection offsets |
---|
183 | long xSubOffset; // The offset in the x-direction from the subsection |
---|
184 | long ySubOffset; // The offset in the y-direction from the subsection |
---|
185 | long zSubOffset; // The offset in the z-direction from the subsection |
---|
186 | // Baseline related; |
---|
187 | bool flagBaseline; // Whether to do baseline subtraction before reconstruction and/or searching. |
---|
188 | // Detection-related |
---|
189 | int minPix; // Minimum number of pixels for a detected object to be counted |
---|
190 | // Object growth |
---|
191 | bool flagGrowth; // Are we growing objects once they are found? |
---|
192 | float growthCut; // The SNR that we are growing objects down to. |
---|
193 | // FDR analysis |
---|
194 | bool flagFDR; // Should the FDR method be used? |
---|
195 | float alphaFDR; // Alpha value for FDR detection algorithm |
---|
196 | // Other detection |
---|
197 | float snrCut; // How many sigma above mean is a detection when sigma-clipping |
---|
198 | // A trous reconstruction parameters |
---|
199 | bool flagATrous; // Are we using the a trous reconstruction? |
---|
200 | int scaleMin; // Min scale used in a trous reconstruction |
---|
201 | float snrRecon; // SNR cutoff used in a trous reconstruction |
---|
202 | // (only wavelet coefficients that survive |
---|
203 | // this threshold are kept) |
---|
204 | int filterCode; // The code number for the filter to be used (saves having to parse names) |
---|
205 | string filterName; // The code number converted into a name, for outputting purposes. |
---|
206 | |
---|
207 | // Volume-merging parameters |
---|
208 | bool flagAdjacent; // Whether to use the adjacent criterion for |
---|
209 | // judging if objects are to be merged. |
---|
210 | float threshSpatial; // Maximum spatial separation between objects |
---|
211 | float threshVelocity; // Maximum channels separation between objects |
---|
212 | int minChannels; // Minimum no. of channels to make an object |
---|
213 | // Input-Output related |
---|
214 | bool borders; // Whether to draw a border around the individual |
---|
215 | // pixels of a detection in the spectral display |
---|
216 | bool verbose; // Whether to use maximum verbosity -- progress indicators in the |
---|
217 | // reconstruction & merging functions. |
---|
218 | |
---|
219 | }; |
---|
220 | |
---|
221 | |
---|
222 | #endif |
---|