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