1 | // ----------------------------------------------------------------------- |
---|
2 | // param.hh: Definition of the parameter set. |
---|
3 | // ----------------------------------------------------------------------- |
---|
4 | // Copyright (C) 2006, Matthew Whiting, ATNF |
---|
5 | // |
---|
6 | // This program is free software; you can redistribute it and/or modify it |
---|
7 | // under the terms of the GNU General Public License as published by the |
---|
8 | // Free Software Foundation; either version 2 of the License, or (at your |
---|
9 | // option) any later version. |
---|
10 | // |
---|
11 | // Duchamp is distributed in the hope that it will be useful, but WITHOUT |
---|
12 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
13 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
14 | // for more details. |
---|
15 | // |
---|
16 | // You should have received a copy of the GNU General Public License |
---|
17 | // along with Duchamp; if not, write to the Free Software Foundation, |
---|
18 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
---|
19 | // |
---|
20 | // Correspondence concerning Duchamp may be directed to: |
---|
21 | // Internet email: Matthew.Whiting [at] atnf.csiro.au |
---|
22 | // Postal address: Dr. Matthew Whiting |
---|
23 | // Australia Telescope National Facility, CSIRO |
---|
24 | // PO Box 76 |
---|
25 | // Epping NSW 1710 |
---|
26 | // AUSTRALIA |
---|
27 | // ----------------------------------------------------------------------- |
---|
28 | #ifndef PARAM_H |
---|
29 | #define PARAM_H |
---|
30 | |
---|
31 | #include <iostream> |
---|
32 | #include <string> |
---|
33 | #include <vector> |
---|
34 | #include <math.h> |
---|
35 | #include <wcslib/wcs.h> |
---|
36 | #include <wcslib/wcshdr.h> |
---|
37 | #include <duchamp/Utils/Section.hh> |
---|
38 | #include <duchamp/Utils/VOParam.hh> |
---|
39 | #include <duchamp/ATrous/filter.hh> |
---|
40 | #include <duchamp/FitsIO/DuchampBeam.hh> |
---|
41 | |
---|
42 | namespace duchamp |
---|
43 | { |
---|
44 | |
---|
45 | /// @brief Write out info on a parameter to e.g. the results file. |
---|
46 | void recordParameters(std::ostream& theStream, std::string paramName, std::string paramDesc, std::string paramValue); |
---|
47 | |
---|
48 | /// @brief A macro to handle streamed output to recordParameters |
---|
49 | #define recordParam(outstream,string1,string2,instream) \ |
---|
50 | do{ \ |
---|
51 | std::ostringstream oss; \ |
---|
52 | oss<<instream; \ |
---|
53 | recordParameters(outstream,string1,string2,oss.str()); \ |
---|
54 | }while(0) |
---|
55 | |
---|
56 | class FitsHeader; // foreshadow this so that Param knows it exists |
---|
57 | |
---|
58 | const int numSortingParamOptions = 10; |
---|
59 | const std::string sortingParamOptions[numSortingParamOptions]={"xvalue","yvalue","zvalue","ra","dec","vel","w50","iflux","pflux","snr"}; |
---|
60 | |
---|
61 | |
---|
62 | /// @brief Class to store general parameters. |
---|
63 | /// |
---|
64 | /// @details This is a general repository for parameters that are used by all |
---|
65 | /// functions. This is how the user interacts with the program, as |
---|
66 | /// parameters are read in from disk files through functions in this |
---|
67 | /// class. |
---|
68 | |
---|
69 | class Param |
---|
70 | { |
---|
71 | public: |
---|
72 | /// @brief Default constructor. |
---|
73 | Param(); |
---|
74 | |
---|
75 | /// @brief Copy constructor for Param. |
---|
76 | Param(const Param& p); |
---|
77 | |
---|
78 | /// @brief Assignment operator for Param. |
---|
79 | Param& operator= (const Param& p); |
---|
80 | |
---|
81 | /// @brief Destructor function. |
---|
82 | virtual ~Param(); |
---|
83 | |
---|
84 | /// @brief Define the default values of each parameter. |
---|
85 | void defaultValues(); |
---|
86 | |
---|
87 | //----------------- |
---|
88 | // Functions in param.cc |
---|
89 | // |
---|
90 | /// @brief Parse the command line parameters correctly. |
---|
91 | OUTCOME getopts(int argc, char ** argv, std::string progname="Duchamp"); |
---|
92 | |
---|
93 | /// @brief Read in parameters from a disk file. |
---|
94 | OUTCOME readParams(std::string paramfile); |
---|
95 | |
---|
96 | /// @brief Check the parameter list for inconsistencies |
---|
97 | void checkPars(); |
---|
98 | |
---|
99 | OUTCOME checkImageExists(); |
---|
100 | |
---|
101 | /// @brief Copy certain necessary FITS header parameters from a FitsHeader object |
---|
102 | void copyHeaderInfo(FitsHeader &head); |
---|
103 | |
---|
104 | /// @brief Determine filename in which to save the mask array. |
---|
105 | std::string outputMomentMapFile(); |
---|
106 | |
---|
107 | /// @brief Determine filename in which to save the mask array. |
---|
108 | std::string outputMaskFile(); |
---|
109 | |
---|
110 | /// @brief Determine filename in which to save the smoothed array. |
---|
111 | std::string outputSmoothFile(); |
---|
112 | |
---|
113 | /// @brief Determine filename in which to save the reconstructed array. |
---|
114 | std::string outputReconFile(); |
---|
115 | |
---|
116 | /// @brief Determine filename in which to save the residual array from the atrous reconstruction. |
---|
117 | std::string outputResidFile(); |
---|
118 | |
---|
119 | /// @brief Print the parameter set in a readable fashion. |
---|
120 | friend std::ostream& operator<< ( std::ostream& theStream, Param& par); |
---|
121 | friend class Image; |
---|
122 | |
---|
123 | std::vector<VOParam> getVOParams(); |
---|
124 | |
---|
125 | //------------------ |
---|
126 | // Functions in FitsIO/subsection.cc |
---|
127 | // |
---|
128 | /// @brief Make sure the subsection strings are OK, with FITS access. |
---|
129 | OUTCOME verifySubsection(); |
---|
130 | /// @brief Parse the subsection strings with a dimension set |
---|
131 | OUTCOME parseSubsections(std::vector<long> &dim); |
---|
132 | OUTCOME parseSubsections(std::vector<int> &dim); |
---|
133 | OUTCOME parseSubsections(long *dim, int size); |
---|
134 | |
---|
135 | /// @brief Set the correct offset values for each axis |
---|
136 | void setOffsets(struct wcsprm *wcs); |
---|
137 | |
---|
138 | /// @brief Set the correct offset values for each axis |
---|
139 | void setOffsets(struct wcsprm &wcs); |
---|
140 | |
---|
141 | //------------------ |
---|
142 | // These are in param.cc |
---|
143 | /// @brief Is a pixel value a BLANK? |
---|
144 | bool isBlank(float &value); |
---|
145 | |
---|
146 | /// @brief Is a given channel flagged as being in the Milky Way? |
---|
147 | bool isInMW(int z); |
---|
148 | |
---|
149 | /// @brief Is a given pixel position OK for use with stats calculations? |
---|
150 | bool isStatOK(int x, int y, int z); |
---|
151 | |
---|
152 | /// @brief Make a mask array -- an array saying whether each pixel is BLANK or not |
---|
153 | bool *makeBlankMask(float *array, size_t size); |
---|
154 | |
---|
155 | /// @brief Make a mask array -- an array saying whether each pixel is able to be used for statistics calculations |
---|
156 | bool *makeStatMask(float *array, size_t *dim); |
---|
157 | |
---|
158 | //-------------------- |
---|
159 | // Basic inline accessor functions |
---|
160 | // |
---|
161 | std::string getImageFile(){return imageFile;}; |
---|
162 | void setImageFile(std::string fname){imageFile = fname;}; |
---|
163 | std::string getFullImageFile(){ |
---|
164 | if(flagSubsection) return imageFile+pixelSec.getSection(); |
---|
165 | else return imageFile; |
---|
166 | }; |
---|
167 | bool getFlagSubsection(){return flagSubsection;}; |
---|
168 | void setFlagSubsection(bool flag){flagSubsection=flag;}; |
---|
169 | std::string getSubsection(){return pixelSec.getSection();}; |
---|
170 | void setSubsection(std::string range){pixelSec.setSection(range);}; |
---|
171 | Section §ion(){Section &rsection = pixelSec; return rsection;}; |
---|
172 | bool getFlagReconExists(){return flagReconExists;}; |
---|
173 | void setFlagReconExists(bool flag){flagReconExists=flag;}; |
---|
174 | std::string getReconFile(){return reconFile;}; |
---|
175 | void setReconFile(std::string file){reconFile = file;}; |
---|
176 | bool getFlagSmoothExists(){return flagSmoothExists;}; |
---|
177 | void setFlagSmoothExists(bool flag){flagSmoothExists=flag;}; |
---|
178 | std::string getSmoothFile(){return smoothFile;}; |
---|
179 | void setSmoothFile(std::string file){smoothFile = file;}; |
---|
180 | // |
---|
181 | bool getFlagUsePrevious(){return usePrevious;}; |
---|
182 | void setFlagUsePrevious(bool flag){usePrevious=flag;}; |
---|
183 | std::string getObjectList(){return objectList;}; |
---|
184 | void setObjectList(std::string s){objectList = s;}; |
---|
185 | std::vector<int> getObjectRequest(); |
---|
186 | std::vector<bool> getObjectChoices(); |
---|
187 | std::vector<bool> getObjectChoices(int numObjects); |
---|
188 | // |
---|
189 | bool getFlagLog(){return flagLog;}; |
---|
190 | void setFlagLog(bool flag){flagLog=flag;}; |
---|
191 | std::string getLogFile(){return logFile;}; |
---|
192 | void setLogFile(std::string fname){logFile = fname;}; |
---|
193 | std::string getOutFile(){return outFile;}; |
---|
194 | void setOutFile(std::string fname){outFile = fname;}; |
---|
195 | bool getFlagSeparateHeader(){return flagSeparateHeader;}; |
---|
196 | void setFlagSeparateHeader(bool b){flagSeparateHeader=b;}; |
---|
197 | std::string getHeaderFile(){return headerFile;}; |
---|
198 | void setHeaderFile(std::string s){headerFile=s;}; |
---|
199 | bool getFlagPlotSpectra(){return flagPlotSpectra;}; |
---|
200 | void setFlagPlotSpectra(bool b){flagPlotSpectra=b;}; |
---|
201 | std::string getSpectraFile(){return spectraFile;}; |
---|
202 | void setSpectraFile(std::string fname){spectraFile = fname;}; |
---|
203 | bool getFlagTextSpectra(){return flagTextSpectra;}; |
---|
204 | void setFlagTextSpectra(bool b){flagTextSpectra = b;}; |
---|
205 | std::string getSpectraTextFile(){return spectraTextFile;}; |
---|
206 | void setSpectraTextFile(std::string fname){spectraTextFile = fname;}; |
---|
207 | bool getFlagOutputMomentMap(){return flagOutputMomentMap;}; |
---|
208 | void setFlagOutputMomentMap(bool flag){flagOutputMomentMap=flag;}; |
---|
209 | std::string getFileOutputMomentMap(){return fileOutputMomentMap;}; |
---|
210 | void setFileOutputMomentMap(std::string s){fileOutputMomentMap=s;}; |
---|
211 | bool getFlagOutputMask(){return flagOutputMask;}; |
---|
212 | void setFlagOutputMask(bool flag){flagOutputMask=flag;}; |
---|
213 | std::string getFileOutputMask(){return fileOutputMask;}; |
---|
214 | void setFileOutputMask(std::string s){fileOutputMask=s;}; |
---|
215 | bool getFlagMaskWithObjectNum(){return flagMaskWithObjectNum;}; |
---|
216 | void setFlagMaskWithObjectNum(bool flag){flagMaskWithObjectNum=flag;}; |
---|
217 | bool getFlagOutputSmooth(){return flagOutputSmooth;}; |
---|
218 | void setFlagOutputSmooth(bool flag){flagOutputSmooth=flag;}; |
---|
219 | std::string getFileOutputSmooth(){return fileOutputSmooth;}; |
---|
220 | void setFileOutputSmooth(std::string s){fileOutputSmooth=s;}; |
---|
221 | bool getFlagOutputRecon(){return flagOutputRecon;}; |
---|
222 | void setFlagOutputRecon(bool flag){flagOutputRecon=flag;}; |
---|
223 | std::string getFileOutputRecon(){return fileOutputRecon;}; |
---|
224 | void setFileOutputRecon(std::string s){fileOutputRecon=s;}; |
---|
225 | bool getFlagOutputResid(){return flagOutputResid;}; |
---|
226 | void setFlagOutputResid(bool flag){flagOutputResid=flag;}; |
---|
227 | std::string getFileOutputResid(){return fileOutputResid;}; |
---|
228 | void setFileOutputResid(std::string s){fileOutputResid=s;}; |
---|
229 | bool getFlagVOT(){return flagVOT;}; |
---|
230 | void setFlagVOT(bool flag){flagVOT=flag;}; |
---|
231 | std::string getVOTFile(){return votFile;}; |
---|
232 | void setVOTFile(std::string fname){votFile = fname;}; |
---|
233 | bool getFlagKarma(){return flagKarma;}; |
---|
234 | void setFlagKarma(bool flag){flagKarma=flag;}; |
---|
235 | std::string getAnnotationType(){return annotationType;}; |
---|
236 | void setAnnotationType(std::string s){annotationType=s;}; |
---|
237 | std::string getKarmaFile(){return karmaFile;}; |
---|
238 | void setKarmaFile(std::string fname){karmaFile = fname;}; |
---|
239 | bool getFlagMaps(){return flagMaps;}; |
---|
240 | void setFlagMaps(bool flag){flagMaps=flag;}; |
---|
241 | std::string getDetectionMap(){return detectionMap;}; |
---|
242 | void setDetectionMap(std::string fname){detectionMap = fname;}; |
---|
243 | std::string getMomentMap(){return momentMap;}; |
---|
244 | void setMomentMap(std::string fname){momentMap = fname;}; |
---|
245 | bool getFlagXOutput(){return flagXOutput;}; |
---|
246 | void setFlagXOutput(bool b){flagXOutput=b;}; |
---|
247 | int getPrecFlux(){return precFlux;}; |
---|
248 | void setPrecFlux(int i){precFlux=i;}; |
---|
249 | int getPrecVel(){return precVel;}; |
---|
250 | void setPrecVel(int i){precVel=i;}; |
---|
251 | int getPrecSNR(){return precSNR;}; |
---|
252 | void setPrecSNR(int i){precSNR=i;}; |
---|
253 | // |
---|
254 | bool getFlagNegative(){return flagNegative;}; |
---|
255 | void setFlagNegative(bool flag){flagNegative=flag;}; |
---|
256 | bool getFlagBlankPix(){return flagBlankPix;}; |
---|
257 | void setFlagBlankPix(bool flag){flagBlankPix=flag;}; |
---|
258 | float getBlankPixVal(){return blankPixValue;}; |
---|
259 | void setBlankPixVal(float v){blankPixValue=v;}; |
---|
260 | int getBlankKeyword(){return blankKeyword;}; |
---|
261 | void setBlankKeyword(int v){blankKeyword=v;}; |
---|
262 | float getBscaleKeyword(){return bscaleKeyword;}; |
---|
263 | void setBscaleKeyword(float v){bscaleKeyword=v;}; |
---|
264 | float getBzeroKeyword(){return bzeroKeyword;}; |
---|
265 | void setBzeroKeyword(float v){bzeroKeyword=v;}; |
---|
266 | bool getFlagMW(){return flagMW;}; |
---|
267 | void setFlagMW(bool flag){flagMW=flag;}; |
---|
268 | int getMaxMW(){return maxMW - zSubOffset;}; |
---|
269 | void setMaxMW(int m){maxMW=m;}; |
---|
270 | int getMinMW(){return minMW - zSubOffset;}; |
---|
271 | void setMinMW(int m){minMW=m;}; |
---|
272 | void setBeamSize(float s){areaBeam = s;}; |
---|
273 | float getBeamSize(){return areaBeam;}; |
---|
274 | void setBeamFWHM(float s){fwhmBeam = s;}; |
---|
275 | float getBeamFWHM(){return fwhmBeam;}; |
---|
276 | void setBeamAsUsed(DuchampBeam &b){beamAsUsed = b;}; // just have the set function as we only want this for the operator<< function. Set from FitsHeader::itsBeam |
---|
277 | std::string getNewFluxUnits(){return newFluxUnits;}; |
---|
278 | void setNewFluxUnits(std::string s){newFluxUnits=s;}; |
---|
279 | std::string getSearchType(){return searchType;}; |
---|
280 | void setSearchType(std::string s){searchType=s;}; |
---|
281 | // |
---|
282 | bool getFlagTrim(){return flagTrim;}; |
---|
283 | void setFlagTrim(bool b){flagTrim=b;}; |
---|
284 | bool getFlagCubeTrimmed(){return hasBeenTrimmed;}; |
---|
285 | void setFlagCubeTrimmed(bool flag){hasBeenTrimmed = flag;}; |
---|
286 | size_t getBorderLeft(){return borderLeft;}; |
---|
287 | void setBorderLeft(size_t b){borderLeft = b;}; |
---|
288 | size_t getBorderRight(){return borderRight;}; |
---|
289 | void setBorderRight(size_t b){borderRight = b;}; |
---|
290 | size_t getBorderBottom(){return borderBottom;}; |
---|
291 | void setBorderBottom(size_t b){borderBottom = b;}; |
---|
292 | size_t getBorderTop(){return borderTop;}; |
---|
293 | void setBorderTop(size_t b){borderTop = b;}; |
---|
294 | // |
---|
295 | long getXOffset(){return xSubOffset;}; |
---|
296 | void setXOffset(long o){xSubOffset = o;}; |
---|
297 | long getYOffset(){return ySubOffset;}; |
---|
298 | void setYOffset(long o){ySubOffset = o;}; |
---|
299 | long getZOffset(){return zSubOffset;}; |
---|
300 | void setZOffset(long o){zSubOffset = o;}; |
---|
301 | // |
---|
302 | unsigned int getMinPix(){return minPix;}; |
---|
303 | void setMinPix(unsigned int m){minPix=m;}; |
---|
304 | // |
---|
305 | bool getFlagGrowth(){return flagGrowth;}; |
---|
306 | void setFlagGrowth(bool flag){flagGrowth=flag;}; |
---|
307 | float getGrowthCut(){return growthCut;}; |
---|
308 | void setGrowthCut(float c){growthCut=c;}; |
---|
309 | float getGrowthThreshold(){return growthThreshold;}; |
---|
310 | void setGrowthThreshold(float f){growthThreshold=f;}; |
---|
311 | bool getFlagUserGrowthThreshold(){return flagUserGrowthThreshold;}; |
---|
312 | void setFlagUserGrowthThreshold(bool b){flagUserGrowthThreshold=b;}; |
---|
313 | // |
---|
314 | bool getFlagFDR(){return flagFDR;}; |
---|
315 | void setFlagFDR(bool flag){flagFDR=flag;}; |
---|
316 | float getAlpha(){return alphaFDR;}; |
---|
317 | void setAlpha(float a){alphaFDR=a;}; |
---|
318 | int getFDRnumCorChan(){return FDRnumCorChan;}; |
---|
319 | void setFDRnumCorChan(int i){FDRnumCorChan=i;}; |
---|
320 | // |
---|
321 | bool getFlagBaseline(){return flagBaseline;}; |
---|
322 | void setFlagBaseline(bool flag){flagBaseline = flag;}; |
---|
323 | // |
---|
324 | bool getFlagStatSec(){return flagStatSec;}; |
---|
325 | void setFlagStatSec(bool flag){flagStatSec=flag;}; |
---|
326 | std::string getStatSec(){return statSec.getSection();}; |
---|
327 | void setStatSec(std::string range){statSec.setSection(range);}; |
---|
328 | Section &statsec(){Section &rsection = statSec; return rsection;}; |
---|
329 | bool getFlagRobustStats(){return flagRobustStats;}; |
---|
330 | void setFlagRobustStats(bool flag){flagRobustStats=flag;}; |
---|
331 | float getCut(){return snrCut;}; |
---|
332 | void setCut(float c){snrCut=c;}; |
---|
333 | float getThreshold(){return threshold;}; |
---|
334 | void setThreshold(float f){threshold=f;}; |
---|
335 | bool getFlagUserThreshold(){return flagUserThreshold;}; |
---|
336 | void setFlagUserThreshold(bool b){flagUserThreshold=b;}; |
---|
337 | // |
---|
338 | bool getFlagSmooth(){return flagSmooth;}; |
---|
339 | void setFlagSmooth(bool b){flagSmooth=b;}; |
---|
340 | std::string getSmoothType(){return smoothType;}; |
---|
341 | void setSmoothType(std::string s){smoothType=s;}; |
---|
342 | int getHanningWidth(){return hanningWidth;}; |
---|
343 | void setHanningWidth(int f){hanningWidth=f;}; |
---|
344 | void setKernMaj(float f){kernMaj=f;}; |
---|
345 | float getKernMaj(){return kernMaj;}; |
---|
346 | void setKernMin(float f){kernMin=f;}; |
---|
347 | float getKernMin(){return kernMin;}; |
---|
348 | void setKernPA(float f){kernPA=f;}; |
---|
349 | float getKernPA(){return kernPA;}; |
---|
350 | // |
---|
351 | bool getFlagATrous(){return flagATrous;}; |
---|
352 | void setFlagATrous(bool flag){flagATrous=flag;}; |
---|
353 | int getReconDim(){return reconDim;}; |
---|
354 | void setReconDim(int i){reconDim=i;}; |
---|
355 | unsigned int getMinScale(){return scaleMin;}; |
---|
356 | void setMinScale(unsigned int s){scaleMin=s;}; |
---|
357 | unsigned int getMaxScale(){return scaleMax;}; |
---|
358 | void setMaxScale(unsigned int s){scaleMax=s;}; |
---|
359 | float getAtrousCut(){return snrRecon;}; |
---|
360 | void setAtrousCut(float c){snrRecon=c;}; |
---|
361 | float getReconConvergence(){return reconConvergence;}; |
---|
362 | void setReconConvergence(float f){reconConvergence = f;}; |
---|
363 | int getFilterCode(){return filterCode;}; |
---|
364 | void setFilterCode(int c){filterCode=c;}; |
---|
365 | std::string getFilterName(){return reconFilter.getName();}; |
---|
366 | Filter& filter(){ Filter &rfilter = reconFilter; return rfilter; }; |
---|
367 | // |
---|
368 | bool getFlagAdjacent(){return flagAdjacent;}; |
---|
369 | void setFlagAdjacent(bool flag){flagAdjacent=flag;}; |
---|
370 | float getThreshS(){return threshSpatial;}; |
---|
371 | void setThreshS(float t){threshSpatial=t;}; |
---|
372 | float getThreshV(){return threshVelocity;}; |
---|
373 | void setThreshV(float t){threshVelocity=t;}; |
---|
374 | unsigned int getMinChannels(){return minChannels;}; |
---|
375 | void setMinChannels(unsigned int n){minChannels=n;}; |
---|
376 | unsigned int getMinVoxels(){return minVoxels;}; |
---|
377 | void setMinVoxels(unsigned int n){minVoxels=n;}; |
---|
378 | bool getFlagRejectBeforeMerge(){return flagRejectBeforeMerge;}; |
---|
379 | void setFlagRejectBeforeMerge(bool flag){flagRejectBeforeMerge=flag;}; |
---|
380 | bool getFlagTwoStageMerging(){return flagTwoStageMerging;}; |
---|
381 | void setFlagTwoStageMerging(bool flag){flagTwoStageMerging=flag;}; |
---|
382 | // |
---|
383 | std::string getSpectralMethod(){return spectralMethod;}; |
---|
384 | void setSpectralMethod(std::string s){spectralMethod=s;}; |
---|
385 | std::string getSpectralType(){return spectralType;}; |
---|
386 | void setSpectralType(std::string s){spectralType=s;}; |
---|
387 | float getRestFrequency(){return restFrequency;}; |
---|
388 | void setRestFrequency(float f){restFrequency=f;}; |
---|
389 | bool getFlagRestFrequencyUsed(){return restFrequencyUsed;}; |
---|
390 | void setFlagRestFrequencyUsed(bool b){restFrequencyUsed=b;}; |
---|
391 | std::string getSpectralUnits(){return spectralUnits;}; |
---|
392 | void setSpectralUnits(std::string s){spectralUnits=s;}; |
---|
393 | std::string getPixelCentre(){return pixelCentre;}; |
---|
394 | void setPixelCentre(std::string s){pixelCentre=s;}; |
---|
395 | std::string getSortingParam(){return sortingParam;}; |
---|
396 | void setSortingParam(std::string s){sortingParam=s;}; |
---|
397 | bool drawBorders(){return borders;}; |
---|
398 | void setDrawBorders(bool f){borders=f;}; |
---|
399 | bool drawBlankEdge(){return blankEdge;}; |
---|
400 | void setDrawBlankEdge(bool f){blankEdge=f;}; |
---|
401 | |
---|
402 | /// @brief Are we in verbose mode? |
---|
403 | bool isVerbose(){return verbose;}; |
---|
404 | void setVerbosity(bool f){verbose=f;}; |
---|
405 | |
---|
406 | private: |
---|
407 | // Input files |
---|
408 | std::string imageFile; ///< The image to be analysed. |
---|
409 | bool flagSubsection; ///< Whether we just want a subsection of the image |
---|
410 | Section pixelSec; ///< The Section object storing the pixel subsection information. |
---|
411 | bool flagReconExists; ///< The reconstructed array is in a FITS file on disk. |
---|
412 | std::string reconFile; ///< The FITS file containing the reconstructed array. |
---|
413 | bool flagSmoothExists;///< The smoothed array is in a FITS file. |
---|
414 | std::string smoothFile; ///< The FITS file containing the smoothed array. |
---|
415 | |
---|
416 | bool usePrevious; ///< Whether to read the detections from a previously-created log file |
---|
417 | std::string objectList; ///< List of objects to re-plot |
---|
418 | |
---|
419 | // Output files |
---|
420 | bool flagLog; ///< Should we do the intermediate logging? |
---|
421 | std::string logFile; ///< Where the intermediate logging goes. |
---|
422 | std::string outFile; ///< Where the final results get put. |
---|
423 | bool flagSeparateHeader;///< Should the header information(parameters & statistics) be written to a separate file to the table ofresults? |
---|
424 | std::string headerFile; ///< Where the header information to go with the results table should be written. |
---|
425 | bool flagPlotSpectra; ///< Should we plot the spectrum of each detection? |
---|
426 | std::string spectraFile; ///< Where the spectra are displayed |
---|
427 | bool flagTextSpectra; ///< Should a text file with all spectra be written? |
---|
428 | std::string spectraTextFile; ///< Where the text spectra are written. |
---|
429 | bool flagOutputMomentMap; ///< Should the moment map image be written to a FITS file? |
---|
430 | std::string fileOutputMomentMap; ///< The name of the moment map FITS file |
---|
431 | bool flagOutputMask; ///< Should the mask image be written? |
---|
432 | std::string fileOutputMask; ///< The name of the mask image. |
---|
433 | bool flagMaskWithObjectNum;///< Should the mask values be labeled with the object ID (or just 1)? |
---|
434 | bool flagOutputSmooth;///< Should the smoothed cube be written? |
---|
435 | std::string fileOutputSmooth;///< The name of the smoothed cube file |
---|
436 | bool flagOutputRecon; ///< Should the reconstructed cube be written to a FITS file? |
---|
437 | std::string fileOutputRecon; ///< The name of the reconstructed cube file |
---|
438 | bool flagOutputResid; ///< Should the residuals from the reconstruction be written to a FITS file? |
---|
439 | std::string fileOutputResid; ///< The name of the residual cube file |
---|
440 | bool flagVOT; ///< Should we save results in VOTable format? |
---|
441 | std::string votFile; ///< Where the VOTable goes. |
---|
442 | bool flagKarma; ///< Should we save results in Karma annotation format? |
---|
443 | std::string karmaFile; ///< Where the Karma annotation file goes. |
---|
444 | std::string annotationType; ///< Should the annoations be circles or borders? |
---|
445 | bool flagMaps; ///< Should we produce detection and moment maps in postscript form? |
---|
446 | std::string detectionMap; ///< The name of the detection map (postscript file). |
---|
447 | std::string momentMap; ///< The name of the 0th moment map (ps file). |
---|
448 | bool flagXOutput; ///< Should there be an xwindows output of the detection map? |
---|
449 | int precFlux; ///< The desired precision for flux values. |
---|
450 | int precVel; ///< The desired precision for velocity/frequency values. |
---|
451 | int precSNR; ///< The desired precision for the SNR values. |
---|
452 | |
---|
453 | // Cube related parameters |
---|
454 | bool flagNegative; ///< Are we going to search for negative features? |
---|
455 | bool flagBlankPix; ///< A flag that indicates whether there are pixels defined as BLANK and whether we need to remove & ignore them in processing. |
---|
456 | float blankPixValue; ///< Pixel value that is considered BLANK. |
---|
457 | int blankKeyword; ///< The FITS header keyword BLANK. |
---|
458 | float bscaleKeyword; ///< The FITS header keyword BSCALE. |
---|
459 | float bzeroKeyword; ///< The FITS header keyword BZERO. |
---|
460 | std::string newFluxUnits; ///< The user-requested flux units, to replace BUNIT. |
---|
461 | |
---|
462 | // Milky-Way parameters |
---|
463 | bool flagMW; ///< A flag that indicates whether to ignore the Milky Way channels. |
---|
464 | int maxMW; ///< Last Milky Way channel |
---|
465 | int minMW; ///< First Milky Way channel |
---|
466 | |
---|
467 | // Trim-related |
---|
468 | bool flagTrim; ///< Does the user want the cube trimmed? |
---|
469 | bool hasBeenTrimmed; ///< Has the cube been trimmed of excess BLANKs around the edge? |
---|
470 | size_t borderLeft; ///< The number of BLANK pixels trimmed from the left of the cube; |
---|
471 | size_t borderRight; ///< The number trimmed from the Right of the cube; |
---|
472 | size_t borderBottom; ///< The number trimmed from the Bottom of the cube; |
---|
473 | size_t borderTop; ///< The number trimmed from the Top of the cube; |
---|
474 | |
---|
475 | // Subsection offsets |
---|
476 | long *offsets; ///< The array of offsets for each FITS axis. |
---|
477 | long sizeOffsets; ///< The size of the offsets array. |
---|
478 | long xSubOffset; ///< The subsection's x-axis offset |
---|
479 | long ySubOffset; ///< The subsection's y-axis offset |
---|
480 | long zSubOffset; ///< The subsection's z-axis offset |
---|
481 | |
---|
482 | // Baseline related |
---|
483 | bool flagBaseline; ///< Whether to do baseline subtraction before reconstruction and/or searching. |
---|
484 | |
---|
485 | // Detection-related |
---|
486 | unsigned int minPix; ///< Minimum number of pixels for a detected object to be counted |
---|
487 | float areaBeam; ///< Size (area) of the beam in pixels. |
---|
488 | float fwhmBeam; ///< FWHM of the beam in pixels. |
---|
489 | DuchampBeam beamAsUsed; ///< A copy of the beam as used in FitsHeader - only used here for output |
---|
490 | std::string searchType; ///< How to do the search: by channel map or by spectrum |
---|
491 | |
---|
492 | // Object growth |
---|
493 | bool flagGrowth; ///< Are we growing objects once they are found? |
---|
494 | float growthCut; ///< The SNR that we are growing objects down to. |
---|
495 | bool flagUserGrowthThreshold; ///< Whether the user has manually defined a growth threshold |
---|
496 | float growthThreshold; ///< The threshold for growing objects down to |
---|
497 | |
---|
498 | // FDR analysis |
---|
499 | bool flagFDR; ///< Should the FDR method be used? |
---|
500 | float alphaFDR; ///< Alpha value for FDR detection algorithm |
---|
501 | int FDRnumCorChan; ///< Number of correlated channels, used in the FDR algorithm |
---|
502 | |
---|
503 | // Basic detection |
---|
504 | bool flagStatSec; ///< Whether we just want to use a subsection of the image to calculate the statistics. |
---|
505 | Section statSec; ///< The Section object storing the statistics subsection information. |
---|
506 | bool flagRobustStats; ///< Whether to use robust statistics. |
---|
507 | float snrCut; ///< How many sigma above mean is a detection when sigma-clipping |
---|
508 | float threshold; ///< What the threshold is (when sigma-clipping). |
---|
509 | bool flagUserThreshold;///< Whether the user has defined a threshold of their own. |
---|
510 | |
---|
511 | // Smoothing of the cube |
---|
512 | bool flagSmooth; ///< Should the cube be smoothed before searching? |
---|
513 | std::string smoothType; ///< The type of smoothing to be done. |
---|
514 | int hanningWidth; ///< Width for hanning smoothing. |
---|
515 | float kernMaj; ///< Semi-Major axis of gaussian smoothing kernel |
---|
516 | float kernMin; ///< Semi-Minor axis of gaussian smoothing kernel |
---|
517 | float kernPA; ///< Position angle of gaussian smoothing kernel, in degrees east of north (i.e. anticlockwise). |
---|
518 | |
---|
519 | // A trous reconstruction parameters |
---|
520 | bool flagATrous; ///< Are we using the a trous reconstruction? |
---|
521 | int reconDim; ///< How many dimensions to use for the reconstruction? |
---|
522 | unsigned int scaleMin; ///< Min scale used in a trous reconstruction |
---|
523 | unsigned int scaleMax; ///< Max scale used in a trous reconstruction |
---|
524 | float snrRecon; ///< SNR cutoff used in a trous reconstruction (only wavelet coefficients that survive this threshold are kept) |
---|
525 | float reconConvergence;///< Convergence criterion for reconstruction - maximum fractional change in residual standard deviation |
---|
526 | Filter reconFilter; ///< The filter used for reconstructions. |
---|
527 | int filterCode; ///< The code number for the filter to be used (saves having to parse names) |
---|
528 | |
---|
529 | // Volume-merging parameters |
---|
530 | bool flagAdjacent; ///< Whether to use the adjacent criterion for judging if objects are to be merged. |
---|
531 | float threshSpatial; ///< Maximum spatial separation between objects |
---|
532 | float threshVelocity; ///< Maximum channels separation between objects |
---|
533 | unsigned int minChannels; ///< Minimum no. of channels to make an object |
---|
534 | unsigned int minVoxels; ///< Minimum no. of voxels required in an object |
---|
535 | bool flagRejectBeforeMerge; ///< Whether to reject sources before merging |
---|
536 | bool flagTwoStageMerging; ///< Whether to do a partial merge when the objects are found, via the mergeIntoList function. |
---|
537 | |
---|
538 | // Input-Output related |
---|
539 | std::string spectralMethod; ///< A string indicating choice of spectral plotting method: choices are "peak" (default) or "sum" |
---|
540 | std::string spectralType; ///< The requested CTYPE that the spectral axis be converted to |
---|
541 | float restFrequency; ///< The rest frequency that should be used when converting - overrides that in the FITS file |
---|
542 | bool restFrequencyUsed; ///< A flag indicating whether the spectral type has been converted from that in the FITS file |
---|
543 | std::string spectralUnits; ///< A string indicating what units the spectral axis should be quoted in. |
---|
544 | std::string pixelCentre; ///< A string indicating which type of centre to give the results in: "average", "centroid", or "peak"(flux). |
---|
545 | std::string sortingParam; ///< A string indicating the parameter to sort the detection list on. |
---|
546 | bool borders; ///< Whether to draw a border around the individual pixels of a detection in the spectral display |
---|
547 | bool blankEdge; ///< Whether to draw a border around the BLANK pixel region in the moment maps and cutout images |
---|
548 | bool verbose; ///< Whether to use maximum verbosity -- use progress indicators in the reconstruction & merging steps. |
---|
549 | |
---|
550 | }; |
---|
551 | |
---|
552 | //=========================================================================== |
---|
553 | |
---|
554 | |
---|
555 | } |
---|
556 | #endif |
---|