source: tags/release-1.6.1/src/param.hh @ 1441

Last change on this file since 1441 was 1393, checked in by MatthewWhiting, 10 years ago

A large changeset that moves all use of bool arrays (ie. bool *) to std::vector<bool>. This will be a bit safer, plus potentially cheaper in memory usage. Interfaces to all stats functions with masks have changed accordingly, as well as the Gaussian smoothing functions and some spectral utility functions.

File size: 33.4 KB
Line 
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
42namespace duchamp
43{
44
45  /// @brief Write out info on a parameter to e.g. the results file.
46  void recordParameters(std::ostream& theStream, Param &par, std::string paramName, std::string paramDesc, std::string paramValue);
47
48  /// @brief A macro to handle streamed output to recordParameters
49#define recordParam(outstream,par,string1,string2,instream) \
50  do{                                                       \
51    std::ostringstream oss;                                 \
52    oss<<instream;                                          \
53    recordParameters(outstream,par,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 Return the input name without a .fits or .fits.gz extension
105    std::string inputWithoutExtension();
106
107    /// @brief Determine filename in which to save the moment map.
108    std::string outputMomentMapFile();
109
110    /// @brief Determine filename in which to save the moment-0 mask.
111    std::string outputMomentMaskFile();
112
113    /// @brief Determine filename in which to save the baseline array.
114    std::string outputBaselineFile();
115
116    /// @brief Determine filename in which to save the mask array.
117    std::string outputMaskFile();
118
119    /// @brief Determine filename in which to save the smoothed array.
120    std::string outputSmoothFile();
121
122    /// @brief Determine filename in which to save the reconstructed array.
123    std::string outputReconFile();
124
125    /// @brief Determine filename in which to save the residual array from the atrous reconstruction.
126    std::string outputResidFile();
127
128    /// @brief Print the parameter set in a readable fashion.
129    friend std::ostream& operator<< ( std::ostream& theStream, Param& par);
130    friend class Image;
131
132    std::vector<VOParam> getVOParams();
133
134    void writeToBinaryFile(std::string &filename);
135    std::streampos readFromBinaryFile(std::string &filename, std::streampos loc=0);
136    void writeToBinaryFile(){writeToBinaryFile(binaryCatalogue);};
137    std::streampos readFromBinaryFile(std::streampos loc=0){return readFromBinaryFile(binaryCatalogue,loc);};
138
139    //------------------
140    // Functions in FitsIO/subsection.cc
141    //
142    /// @brief Make sure the subsection strings are OK, with FITS access.
143    OUTCOME verifySubsection();
144    /// @brief Parse the subsection strings with a dimension set
145    OUTCOME parseSubsections(std::vector<size_t> &dim);
146    OUTCOME parseSubsections(std::vector<long> &dim);
147    OUTCOME parseSubsections(std::vector<int> &dim);
148    OUTCOME parseSubsections(size_t *dim, int size);
149
150    /// @brief Set the correct offset values for each axis
151    void   setOffsets(struct wcsprm *wcs);
152
153    /// @brief Set the correct offset values for each axis
154    void   setOffsets(struct wcsprm &wcs);
155
156    //------------------
157    // These are in param.cc
158    /// @brief Is a pixel value a BLANK?
159    bool   isBlank(float &value);
160
161    /// @brief Has a given channel been flagged by the user?
162      bool isFlaggedChannel(int z);
163      std::vector<bool> getChannelFlags(int numChannels);
164
165    /// @brief Is a given pixel position OK for use with stats calculations?
166    bool   isStatOK(int x, int y, int z);
167
168    /// @brief Make a mask array -- an array saying whether each pixel is BLANK or not
169    std::vector<bool> makeBlankMask(float *array, size_t size);
170
171    /// @brief Make a mask array -- an array saying whether each pixel is able to be used for statistics calculations
172    std::vector<bool> makeStatMask(float *array, size_t *dim);
173
174    //--------------------
175    // Basic inline accessor functions
176    //
177    std::string getImageFile(){return imageFile;};
178    void   setImageFile(std::string fname){imageFile = fname;};
179    std::string getFullImageFile(){
180      if(flagSubsection) return imageFile+pixelSec.getSection();
181      else return imageFile;
182    };
183    bool   getFlagSubsection(){return flagSubsection;};
184    void   setFlagSubsection(bool flag){flagSubsection=flag;};
185    std::string getSubsection(){return pixelSec.getSection();};
186    void   setSubsection(std::string range){pixelSec.setSection(range);};
187    Section &section(){Section &rsection = pixelSec; return rsection;};
188    bool   getFlagReconExists(){return flagReconExists;};
189    void   setFlagReconExists(bool flag){flagReconExists=flag;};
190    std::string getReconFile(){return reconFile;};
191    void   setReconFile(std::string file){reconFile = file;};
192    bool   getFlagSmoothExists(){return flagSmoothExists;};
193    void   setFlagSmoothExists(bool flag){flagSmoothExists=flag;};
194    std::string getSmoothFile(){return smoothFile;};
195    void   setSmoothFile(std::string file){smoothFile = file;};
196    //
197    bool   getFlagUsePrevious(){return usePrevious;};
198    void   setFlagUsePrevious(bool flag){usePrevious=flag;};
199    std::string getObjectList(){return objectList;};
200    void   setObjectList(std::string s){objectList = s;};
201    std::vector<int> getObjectListVector(){return objectListVector;};
202    void   setObjectListVector(std::vector<int> v){objectListVector = v;};
203    std::vector<int> getObjectRequest();
204    std::vector<bool> getObjectChoices();
205    std::vector<bool> getObjectChoices(int numObjects);
206    //
207    bool   getFlagLog(){return flagLog;};
208    void   setFlagLog(bool flag){flagLog=flag;};
209    std::string getLogFile(){return logFile;};
210    void   setLogFile(std::string fname){logFile = fname;};
211    std::string getOutFile(){return outFile;};
212    void   setOutFile(std::string fname){outFile = fname;};
213    bool   getFlagSeparateHeader(){return flagSeparateHeader;};
214    void   setFlagSeparateHeader(bool b){flagSeparateHeader=b;};
215    std::string getHeaderFile(){return headerFile;};
216    void   setHeaderFile(std::string s){headerFile=s;};
217    bool   getFlagWriteBinaryCatalogue(){return flagWriteBinaryCatalogue;};
218    void   setFlagWriteBinaryCatalogue(bool b){flagWriteBinaryCatalogue=b;};
219    std::string getBinaryCatalogue(){return binaryCatalogue;};
220    void   setBinaryCatalogue(std::string s){binaryCatalogue=s;};
221    bool   getFlagPlotSpectra(){return flagPlotSpectra;};
222    void   setFlagPlotSpectra(bool b){flagPlotSpectra=b;};
223    std::string getSpectraFile(){return spectraFile;};
224    void   setSpectraFile(std::string fname){spectraFile = fname;};
225    bool   getFlagPlotIndividualSpectra(){return flagPlotIndividualSpectra;};
226    void   setFlagPlotIndividualSpectra(bool b){flagPlotIndividualSpectra=b;};
227    bool   getFlagTextSpectra(){return flagTextSpectra;};
228    void   setFlagTextSpectra(bool b){flagTextSpectra = b;};
229    std::string getSpectraTextFile(){return spectraTextFile;};
230    void   setSpectraTextFile(std::string fname){spectraTextFile = fname;};
231    bool   getFlagOutputBaseline(){return flagOutputBaseline;};
232    void   setFlagOutputBaseline(bool flag){flagOutputBaseline=flag;};
233    std::string getFileOutputBaseline(){return fileOutputBaseline;};
234    void   setFileOutputBaseline(std::string s){fileOutputBaseline=s;};
235    bool   getFlagOutputMomentMap(){return flagOutputMomentMap;};
236    void   setFlagOutputMomentMap(bool flag){flagOutputMomentMap=flag;};
237    std::string getFileOutputMomentMap(){return fileOutputMomentMap;};
238    void   setFileOutputMomentMap(std::string s){fileOutputMomentMap=s;};
239    bool   getFlagOutputMomentMask(){return flagOutputMomentMask;};
240    void   setFlagOutputMomentMask(bool flag){flagOutputMomentMask=flag;};
241    std::string getFileOutputMomentMask(){return fileOutputMomentMask;};
242    void   setFileOutputMomentMask(std::string s){fileOutputMomentMask=s;};
243    bool   getFlagOutputMask(){return flagOutputMask;};
244    void   setFlagOutputMask(bool flag){flagOutputMask=flag;};
245    std::string getFileOutputMask(){return fileOutputMask;};
246    void   setFileOutputMask(std::string s){fileOutputMask=s;};
247    bool   getFlagMaskWithObjectNum(){return flagMaskWithObjectNum;};
248    void   setFlagMaskWithObjectNum(bool flag){flagMaskWithObjectNum=flag;};
249    bool   getFlagOutputSmooth(){return flagOutputSmooth;};
250    void   setFlagOutputSmooth(bool flag){flagOutputSmooth=flag;};
251    std::string getFileOutputSmooth(){return fileOutputSmooth;};
252    void   setFileOutputSmooth(std::string s){fileOutputSmooth=s;};
253    bool   getFlagOutputRecon(){return flagOutputRecon;};
254    void   setFlagOutputRecon(bool flag){flagOutputRecon=flag;};
255    std::string getFileOutputRecon(){return fileOutputRecon;};
256    void   setFileOutputRecon(std::string s){fileOutputRecon=s;};
257    bool   getFlagOutputResid(){return flagOutputResid;};
258    void   setFlagOutputResid(bool flag){flagOutputResid=flag;};
259    std::string getFileOutputResid(){return fileOutputResid;};
260    void   setFileOutputResid(std::string s){fileOutputResid=s;};
261    bool   getFlagVOT(){return flagVOT;};
262    void   setFlagVOT(bool flag){flagVOT=flag;};
263    std::string getVOTFile(){return votFile;};
264    void   setVOTFile(std::string fname){votFile = fname;};
265    std::string getAnnotationType(){return annotationType;};
266    void   setAnnotationType(std::string s){annotationType=s;};
267    bool   getFlagKarma(){return flagKarma;};
268    void   setFlagKarma(bool flag){flagKarma=flag;};
269    std::string getKarmaFile(){return karmaFile;};
270    void   setKarmaFile(std::string fname){karmaFile = fname;};
271    bool   getFlagDS9(){return flagDS9;};
272    void   setFlagDS9(bool flag){flagDS9=flag;};
273    std::string getDS9File(){return ds9File;};
274    void   setDS9File(std::string fname){ds9File = fname;};
275    bool   getFlagCasa(){return flagCasa;};
276    void   setFlagCasa(bool flag){flagCasa=flag;};
277    std::string getCasaFile(){return casaFile;};
278    void   setCasaFile(std::string fname){casaFile = fname;};
279    bool   getFlagMaps(){return flagMaps;};
280    void   setFlagMaps(bool flag){flagMaps=flag;};
281    std::string getDetectionMap(){return detectionMap;};
282    void   setDetectionMap(std::string fname){detectionMap = fname;};
283    std::string getMomentMap(){return momentMap;};
284    void   setMomentMap(std::string fname){momentMap = fname;};
285    bool   getFlagXOutput(){return flagXOutput;};
286    void   setFlagXOutput(bool b){flagXOutput=b;};
287    int    getPrecFlux(){return precFlux;};
288    void   setPrecFlux(int i){precFlux=i;};
289    int    getPrecVel(){return precVel;};
290    void   setPrecVel(int i){precVel=i;};
291    int    getPrecSNR(){return precSNR;};
292    void   setPrecSNR(int i){precSNR=i;};
293    //
294    bool   getFlagNegative(){return flagNegative;};
295    void   setFlagNegative(bool flag){flagNegative=flag;};
296    bool   getFlagBlankPix(){return flagBlankPix;};
297    void   setFlagBlankPix(bool flag){flagBlankPix=flag;};
298    float  getBlankPixVal(){return blankPixValue;};
299    void   setBlankPixVal(float v){blankPixValue=v;};
300    int    getBlankKeyword(){return blankKeyword;};
301    void   setBlankKeyword(int v){blankKeyword=v;};
302    float  getBscaleKeyword(){return bscaleKeyword;};
303    void   setBscaleKeyword(float v){bscaleKeyword=v;};
304    float  getBzeroKeyword(){return bzeroKeyword;};
305    void   setBzeroKeyword(float v){bzeroKeyword=v;};
306    std::vector<int> getFlaggedChannels(){return flaggedChannels;};
307    void   setFlaggedChannels(std::vector<int> v){flaggedChannels=v;};
308    std::string getFlaggedChannelList(){return flaggedChannelList;};
309    void   setFlaggedChannelList(std::string s){flaggedChannelList=s;};
310    void   setBeamSize(float s){areaBeam = s;};
311    float  getBeamSize(){return areaBeam;};
312    void   setBeamFWHM(float s){fwhmBeam = s;};
313    float  getBeamFWHM(){return fwhmBeam;};
314    void   setBeamAsUsed(DuchampBeam &b){beamAsUsed = b;}; // just have the set function as we only want this for the operator<< function. Set from FitsHeader::itsBeam
315    std::string getNewFluxUnits(){return newFluxUnits;};
316    void   setNewFluxUnits(std::string s){newFluxUnits=s;};
317    std::string getSearchType(){return searchType;};
318    void   setSearchType(std::string s){searchType=s;};
319    //
320    bool   getFlagTrim(){return flagTrim;};
321    void   setFlagTrim(bool b){flagTrim=b;};
322    bool   getFlagCubeTrimmed(){return hasBeenTrimmed;};
323    void   setFlagCubeTrimmed(bool flag){hasBeenTrimmed = flag;};
324    size_t getBorderLeft(){return borderLeft;};
325    void   setBorderLeft(size_t b){borderLeft = b;};
326    size_t getBorderRight(){return borderRight;};
327    void   setBorderRight(size_t b){borderRight = b;};
328    size_t getBorderBottom(){return borderBottom;};
329    void   setBorderBottom(size_t b){borderBottom = b;};
330    size_t getBorderTop(){return borderTop;};
331    void   setBorderTop(size_t b){borderTop = b;};
332    //
333    long   getXOffset(){return xSubOffset;};
334    void   setXOffset(long o){xSubOffset = o;};
335    long   getYOffset(){return ySubOffset;};
336    void   setYOffset(long o){ySubOffset = o;};
337    long   getZOffset(){return zSubOffset;};
338    void   setZOffset(long o){zSubOffset = o;};
339    //
340    bool   getFlagGrowth(){return flagGrowth;};
341    void   setFlagGrowth(bool flag){flagGrowth=flag;};
342    float  getGrowthCut(){return growthCut;};
343    void   setGrowthCut(float c){growthCut=c;};
344    float  getGrowthThreshold(){return growthThreshold;};
345    void   setGrowthThreshold(float f){growthThreshold=f;};
346    bool   getFlagUserGrowthThreshold(){return flagUserGrowthThreshold;};
347    void   setFlagUserGrowthThreshold(bool b){flagUserGrowthThreshold=b;};
348    //   
349    bool   getFlagFDR(){return flagFDR;};
350    void   setFlagFDR(bool flag){flagFDR=flag;};
351    float  getAlpha(){return alphaFDR;};
352    void   setAlpha(float a){alphaFDR=a;};
353    int    getFDRnumCorChan(){return FDRnumCorChan;};
354    void   setFDRnumCorChan(int i){FDRnumCorChan=i;};
355    //
356    bool   getFlagBaseline(){return flagBaseline;};
357    void   setFlagBaseline(bool flag){flagBaseline = flag;};
358      std::string getBaselineType(){return baselineType;};
359      void setBaselineType(std::string s){baselineType = s;};
360      unsigned int getBaselineBoxWidth(){return baselineBoxWidth;};
361      void setBaselineBoxWidth(unsigned int i){baselineBoxWidth = i;};
362    //
363    bool   getFlagStatSec(){return flagStatSec;};
364    void   setFlagStatSec(bool flag){flagStatSec=flag;};
365    std::string getStatSec(){return statSec.getSection();};
366    void   setStatSec(std::string range){statSec.setSection(range);};
367    Section &statsec(){Section &rsection = statSec; return rsection;};
368    bool   getFlagRobustStats(){return flagRobustStats;};
369    void   setFlagRobustStats(bool flag){flagRobustStats=flag;};
370    float  getCut(){return snrCut;};
371    void   setCut(float c){snrCut=c;};
372    float  getThreshold(){return threshold;};
373    void   setThreshold(float f){threshold=f;};
374    bool   getFlagUserThreshold(){return flagUserThreshold;};
375    void   setFlagUserThreshold(bool b){flagUserThreshold=b;};
376    //   
377    bool   getFlagSmooth(){return flagSmooth;};
378    void   setFlagSmooth(bool b){flagSmooth=b;};
379    std::string getSmoothType(){return smoothType;};
380    void   setSmoothType(std::string s){smoothType=s;};
381    int    getHanningWidth(){return hanningWidth;};
382    void   setHanningWidth(int f){hanningWidth=f;};
383    void   setKernMaj(float f){kernMaj=f;};
384    float  getKernMaj(){return kernMaj;};
385    void   setKernMin(float f){kernMin=f;};
386    float  getKernMin(){return kernMin;};
387    void   setKernPA(float f){kernPA=f;};
388    float  getKernPA(){return kernPA;};
389    std::string getSmoothEdgeMethod(){return smoothEdgeMethod;};
390    void   setSmoothEdgeMethod(std::string s){smoothEdgeMethod=s;}; 
391    float getSpatialSmoothCutoff(){return spatialSmoothCutoff;};
392    void setSpatialSmoothCutoff(float f){spatialSmoothCutoff=f;}; 
393    //   
394    bool   getFlagATrous(){return flagATrous;};
395    void   setFlagATrous(bool flag){flagATrous=flag;};
396    int    getReconDim(){return reconDim;};
397    void   setReconDim(int i){reconDim=i;};
398    unsigned int getMinScale(){return scaleMin;};
399    void   setMinScale(unsigned int s){scaleMin=s;};
400    unsigned int getMaxScale(){return scaleMax;};
401    void   setMaxScale(unsigned int s){scaleMax=s;};
402    float  getAtrousCut(){return snrRecon;};
403    void   setAtrousCut(float c){snrRecon=c;};
404    float  getReconConvergence(){return reconConvergence;};
405    void   setReconConvergence(float f){reconConvergence = f;};
406    int    getFilterCode(){return filterCode;};
407    void   setFilterCode(int c){filterCode=c;};
408    std::string getFilterName(){return reconFilter->getName();};
409    Filter& filter(){ Filter &rfilter = *reconFilter; return rfilter; };
410    //   
411    bool   getFlagAdjacent(){return flagAdjacent;};
412    void   setFlagAdjacent(bool flag){flagAdjacent=flag;};
413    float  getThreshS(){return threshSpatial;};
414    void   setThreshS(float t){threshSpatial=t;};
415    float  getThreshV(){return threshVelocity;};
416    void   setThreshV(float t){threshVelocity=t;};
417    unsigned int   getMinPix(){return minPix;};
418    void   setMinPix(unsigned int m){minPix=m;};
419    unsigned int getMinChannels(){return minChannels;};
420    void   setMinChannels(unsigned int n){minChannels=n;};
421    unsigned int getMinVoxels(){return minVoxels;};
422    void   setMinVoxels(unsigned int n){minVoxels=n;};
423    int   getMaxPix(){return maxPix;};
424    void   setMaxPix(int m){maxPix=m;};
425    int getMaxChannels(){return maxChannels;};
426    void   setMaxChannels(int n){maxChannels=n;};
427    int getMaxVoxels(){return maxVoxels;};
428    void   setMaxVoxels(int n){maxVoxels=n;};
429    bool   getFlagRejectBeforeMerge(){return flagRejectBeforeMerge;};
430    void   setFlagRejectBeforeMerge(bool flag){flagRejectBeforeMerge=flag;};
431    bool   getFlagTwoStageMerging(){return flagTwoStageMerging;};
432    void   setFlagTwoStageMerging(bool flag){flagTwoStageMerging=flag;};
433    //
434    std::string getSpectralMethod(){return spectralMethod;};
435    void   setSpectralMethod(std::string s){spectralMethod=s;};
436    std::string getSpectralType(){return spectralType;};
437    void   setSpectralType(std::string s){spectralType=s;};
438    float  getRestFrequency(){return restFrequency;};
439    void   setRestFrequency(float f){restFrequency=f;};
440    bool    getFlagRestFrequencyUsed(){return restFrequencyUsed;};
441    void    setFlagRestFrequencyUsed(bool b){restFrequencyUsed=b;};
442    std::string getSpectralUnits(){return spectralUnits;};
443    void   setSpectralUnits(std::string s){spectralUnits=s;};
444    std::string getPixelCentre(){return pixelCentre;};
445    void   setPixelCentre(std::string s){pixelCentre=s;};
446    std::string getSortingParam(){return sortingParam;};
447    void   setSortingParam(std::string s){sortingParam=s;};
448    bool   drawBorders(){return borders;};
449    void   setDrawBorders(bool f){borders=f;};
450    bool   drawBlankEdge(){return blankEdge;};
451    void   setDrawBlankEdge(bool f){blankEdge=f;};
452
453    /// @brief Are we in verbose mode?
454    bool   isVerbose(){return verbose;};
455    void   setVerbosity(bool f){verbose=f;};
456 
457    /// @brief Set the comment characters
458    void setCommentString(std::string comment){commentStr = comment;};
459    std::string commentString(){return commentStr;};
460
461  private:
462    // Input files
463    std::string imageFile;       ///< The image to be analysed.
464    bool        flagSubsection;  ///< Whether we just want a subsection of the image
465    Section pixelSec;            ///< The Section object storing the pixel subsection information.
466    bool        flagReconExists; ///< The reconstructed array is in a FITS file on disk.
467    std::string reconFile;       ///< The FITS file containing the reconstructed array.
468    bool        flagSmoothExists;///< The smoothed array is in a FITS file.
469    std::string smoothFile;      ///< The FITS file containing the smoothed array.
470
471    bool       usePrevious;      ///< Whether to read the detections from a previously-created log file
472    std::string objectList;      ///< List of objects to re-plot
473    std::vector<int> objectListVector; ///<< Vector list of the objects requested
474
475    // Output files
476    bool        flagLog;         ///< Should we do the intermediate logging?
477    std::string logFile;         ///< Where the intermediate logging goes.
478    std::string outFile;         ///< Where the final results get put.
479    bool        flagSeparateHeader;///< Should the header information(parameters & statistics) be written to a separate file to the table ofresults?
480    std::string headerFile;      ///< Where the header information to go with the results table should be written.
481    bool        flagWriteBinaryCatalogue; ///< Whether to write the catalogue to a binary file
482    std::string binaryCatalogue; ///< The binary file holding the catalogue of detected pixels.
483    bool        flagPlotSpectra; ///< Should we plot the spectrum of each detection?
484    std::string spectraFile;     ///< Where the spectra are displayed
485    bool        flagPlotIndividualSpectra; ///< Should the sources be plotted with spectra in individual files?
486    bool        flagTextSpectra; ///< Should a text file with all spectra be written?
487    std::string spectraTextFile; ///< Where the text spectra are written.
488    bool        flagOutputBaseline;  ///< Should the cube of baseline values be written to a FITS file?
489    std::string fileOutputBaseline;  ///< The name of the baseline FITS file
490    bool        flagOutputMomentMap;  ///< Should the moment map image be written to a FITS file?
491    std::string fileOutputMomentMap;  ///< The name of the moment map FITS file
492    bool        flagOutputMomentMask;  ///< Should the moment-0 mask be written to a FITS file?
493    std::string fileOutputMomentMask;  ///< The name of the moment-0 mask FITS file
494    bool        flagOutputMask;  ///< Should the mask image be written?
495    std::string fileOutputMask;  ///< The name of the mask image.
496    bool        flagMaskWithObjectNum;///< Should the mask values be labeled with the object ID (or just 1)?
497    bool        flagOutputSmooth;///< Should the smoothed cube be written?
498    std::string fileOutputSmooth;///< The name of the smoothed cube file
499    bool        flagOutputRecon; ///< Should the reconstructed cube be written to a FITS file?
500    std::string fileOutputRecon; ///< The name of the reconstructed cube file
501    bool        flagOutputResid; ///< Should the residuals from the reconstruction be written to a FITS file?
502    std::string fileOutputResid; ///< The name of the residual cube file
503    bool        flagVOT;         ///< Should we save results in VOTable format?
504    std::string votFile;         ///< Where the VOTable goes.
505    bool        flagKarma;       ///< Should we save results in Karma annotation format?
506    std::string karmaFile;       ///< Where the Karma annotation file goes.
507    bool        flagCasa;        ///< Should we save results in CASA region format?
508    std::string casaFile;        ///< Where the CASA region file goes.
509    bool        flagDS9;         ///< Should we save results in DS9 annotation format?
510    std::string ds9File;         ///< Where the DS9 annotation file goes.
511    std::string annotationType;  ///< Should the annoations be circles or borders?
512    bool        flagMaps;        ///< Should we produce detection and moment maps in postscript form?
513    std::string detectionMap;    ///< The name of the detection map (postscript file).
514    std::string momentMap;       ///< The name of the 0th moment map (ps file).
515    bool        flagXOutput;     ///< Should there be an xwindows output of the detection map?
516    int         precFlux;        ///< The desired precision for flux values.
517    int         precVel;         ///< The desired precision for velocity/frequency values.
518    int         precSNR;         ///< The desired precision for the SNR values.
519
520    // Cube related parameters
521    bool        flagNegative;    ///< Are we going to search for negative features?
522    bool        flagBlankPix;    ///< A flag that indicates whether there are pixels defined as BLANK and whether we need to remove & ignore them in processing.
523    float       blankPixValue;   ///< Pixel value that is considered BLANK.
524    int         blankKeyword;    ///< The FITS header keyword BLANK.
525    float       bscaleKeyword;   ///< The FITS header keyword BSCALE.
526    float       bzeroKeyword;    ///< The FITS header keyword BZERO.
527    std::string newFluxUnits;    ///< The user-requested flux units, to replace BUNIT.
528
529    // Milky-Way parameters
530    std::string flaggedChannelList; ///< List of channels to be flagged (ignored).
531    std::vector <int> flaggedChannels; ///< The flagged channels listed individually
532    std::vector<bool> flaggedChannelMask; ///< Whether a given channel is flagged, up to the maximum listed flagged channel
533
534    // Trim-related
535    bool        flagTrim;        ///< Does the user want the cube trimmed?
536    bool        hasBeenTrimmed;  ///< Has the cube been trimmed of excess BLANKs around the edge?
537    size_t      borderLeft;      ///< The number of BLANK pixels trimmed from the left of the cube;
538    size_t      borderRight;     ///< The number trimmed from the Right of the cube;
539    size_t      borderBottom;    ///< The number trimmed from the Bottom of the cube;
540    size_t      borderTop;       ///< The number trimmed from the Top of the cube;
541
542    // Subsection offsets
543    long       *offsets;         ///< The array of offsets for each FITS axis.
544    long        sizeOffsets;     ///< The size of the offsets array.
545    long        xSubOffset;      ///< The subsection's x-axis offset
546    long        ySubOffset;      ///< The subsection's y-axis offset
547    long        zSubOffset;      ///< The subsection's z-axis offset
548
549    // Baseline related
550    bool        flagBaseline;    ///< Whether to do baseline subtraction before reconstruction and/or searching.
551      std::string baselineType;  ///< Which baselining method to use
552      unsigned int baselineBoxWidth; ///< For the median baselining method, the full width of the sliding box.
553
554    // Detection-related
555    float       areaBeam;        ///< Size (area) of the beam in pixels.
556    float       fwhmBeam;        ///< FWHM of the beam in pixels.
557    DuchampBeam beamAsUsed;      ///< A copy of the beam as used in FitsHeader - only used here for output
558    std::string searchType;      ///< How to do the search: by channel map or by spectrum
559
560    // Object growth
561    bool        flagGrowth;      ///< Are we growing objects once they are found?
562    float       growthCut;       ///< The SNR that we are growing objects down to.
563    bool        flagUserGrowthThreshold; ///< Whether the user has manually defined a growth threshold
564    float       growthThreshold; ///< The threshold for growing objects down to
565
566    // FDR analysis
567    bool        flagFDR;         ///< Should the FDR method be used?
568    float       alphaFDR;        ///< Alpha value for FDR detection algorithm
569    int         FDRnumCorChan;   ///< Number of correlated channels, used in the FDR algorithm
570
571    // Basic detection
572    bool        flagStatSec;     ///< Whether we just want to use a subsection of the image to calculate the statistics.
573    Section     statSec;         ///< The Section object storing the statistics subsection information.
574    bool        flagRobustStats; ///< Whether to use robust statistics.
575    float       snrCut;          ///< How many sigma above mean is a detection when sigma-clipping
576    float       threshold;       ///< What the threshold is (when sigma-clipping).
577    bool        flagUserThreshold;///< Whether the user has defined a threshold of their own.
578
579    // Smoothing of the cube
580    bool        flagSmooth;      ///< Should the cube be smoothed before searching?
581    std::string smoothType;      ///< The type of smoothing to be done.
582    int         hanningWidth;    ///< Width for hanning smoothing.
583    float       kernMaj;         ///< Semi-Major axis of gaussian smoothing kernel
584    float       kernMin;         ///< Semi-Minor axis of gaussian smoothing kernel
585    float       kernPA;          ///< Position angle of gaussian smoothing kernel, in degrees east of north (i.e. anticlockwise).
586    std::string smoothEdgeMethod; ///< Method for dealing with the edges when 2D smoothing: 'equal','truncate','scale'
587    float       spatialSmoothCutoff; ///< Cutoff value for determining kernel size
588
589    // A trous reconstruction parameters
590    bool   flagATrous;      ///< Are we using the a trous reconstruction?
591    int    reconDim;        ///< How many dimensions to use for the reconstruction?
592    unsigned int    scaleMin;        ///< Min scale used in a trous reconstruction
593    unsigned int    scaleMax;        ///< Max scale used in a trous reconstruction
594    float  snrRecon;        ///< SNR cutoff used in a trous reconstruction (only wavelet coefficients that survive this threshold are kept)
595    float  reconConvergence;///< Convergence criterion for reconstruction - maximum fractional change in residual standard deviation
596    Filter *reconFilter;     ///< The filter used for reconstructions.
597    int    filterCode;      ///< The code number for the filter to be used (saves having to parse names)
598
599    // Volume-merging parameters
600    bool   flagAdjacent;    ///< Whether to use the adjacent criterion for judging if objects are to be merged.
601    float  threshSpatial;   ///< Maximum spatial separation between objects
602    float  threshVelocity;  ///< Maximum channels separation between objects
603    unsigned int minPix;         ///< Minimum number of pixels for a detected object to be counted
604    unsigned int minChannels;     ///< Minimum no. of channels to make an object
605    unsigned int minVoxels;       ///< Minimum no. of voxels required in an object
606    int maxPix;
607    int maxChannels;
608    int maxVoxels;
609    bool   flagRejectBeforeMerge; ///< Whether to reject sources before merging
610    bool   flagTwoStageMerging;  ///< Whether to do a partial merge when the objects are found, via the mergeIntoList function.
611
612    // Input-Output related
613    std::string spectralMethod; ///< A string indicating choice of spectral plotting method: choices are "peak" (default) or "sum"
614    std::string spectralType;   ///< The requested CTYPE that the spectral axis be converted to
615    float  restFrequency;       ///< The rest frequency that should be used when converting - overrides that in the FITS file
616    bool   restFrequencyUsed;   ///< A flag indicating whether the spectral type has been converted from that in the FITS file
617    std::string spectralUnits;  ///< A string indicating what units the spectral axis should be quoted in.
618    std::string pixelCentre;    ///< A string indicating which type of centre to give the results in: "average", "centroid", or "peak"(flux).
619    std::string sortingParam;   ///< A string indicating the parameter to sort the detection list on.
620    bool   borders;             ///< Whether to draw a border around the individual pixels of a detection in the spectral display
621    bool   blankEdge;           ///< Whether to draw a border around the BLANK pixel region in the moment maps and cutout images
622    bool   verbose;             ///< Whether to use maximum verbosity -- use progress indicators in the reconstruction & merging steps.
623
624    std::string commentStr; ///< Any comment characters etc that need to be prepended to any output via the << operator.
625
626  };
627
628  //===========================================================================
629
630
631}
632#endif
Note: See TracBrowser for help on using the repository browser.