[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 | |
---|
[1364] | 104 | /// @brief Return the input name without a .fits or .fits.gz extension |
---|
| 105 | std::string inputWithoutExtension(); |
---|
| 106 | |
---|
[1120] | 107 | /// @brief Determine filename in which to save the moment map. |
---|
[670] | 108 | std::string outputMomentMapFile(); |
---|
| 109 | |
---|
[1142] | 110 | /// @brief Determine filename in which to save the moment-0 mask. |
---|
| 111 | std::string outputMomentMaskFile(); |
---|
| 112 | |
---|
[1120] | 113 | /// @brief Determine filename in which to save the baseline array. |
---|
| 114 | std::string outputBaselineFile(); |
---|
| 115 | |
---|
[670] | 116 | /// @brief Determine filename in which to save the mask array. |
---|
[379] | 117 | std::string outputMaskFile(); |
---|
| 118 | |
---|
[528] | 119 | /// @brief Determine filename in which to save the smoothed array. |
---|
[378] | 120 | std::string outputSmoothFile(); |
---|
[221] | 121 | |
---|
[528] | 122 | /// @brief Determine filename in which to save the reconstructed array. |
---|
[378] | 123 | std::string outputReconFile(); |
---|
[272] | 124 | |
---|
[528] | 125 | /// @brief Determine filename in which to save the residual array from the atrous reconstruction. |
---|
[378] | 126 | std::string outputResidFile(); |
---|
[221] | 127 | |
---|
[528] | 128 | /// @brief Print the parameter set in a readable fashion. |
---|
[378] | 129 | friend std::ostream& operator<< ( std::ostream& theStream, Param& par); |
---|
| 130 | friend class Image; |
---|
[258] | 131 | |
---|
[916] | 132 | std::vector<VOParam> getVOParams(); |
---|
| 133 | |
---|
[1145] | 134 | void writeToBinaryFile(std::string &filename); |
---|
[1146] | 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);}; |
---|
[1145] | 138 | |
---|
[378] | 139 | //------------------ |
---|
| 140 | // Functions in FitsIO/subsection.cc |
---|
| 141 | // |
---|
[818] | 142 | /// @brief Make sure the subsection strings are OK, with FITS access. |
---|
[698] | 143 | OUTCOME verifySubsection(); |
---|
[818] | 144 | /// @brief Parse the subsection strings with a dimension set |
---|
[1263] | 145 | OUTCOME parseSubsections(std::vector<size_t> &dim); |
---|
[818] | 146 | OUTCOME parseSubsections(std::vector<long> &dim); |
---|
[822] | 147 | OUTCOME parseSubsections(std::vector<int> &dim); |
---|
[1263] | 148 | OUTCOME parseSubsections(size_t *dim, int size); |
---|
[309] | 149 | |
---|
[528] | 150 | /// @brief Set the correct offset values for each axis |
---|
[378] | 151 | void setOffsets(struct wcsprm *wcs); |
---|
[221] | 152 | |
---|
[528] | 153 | /// @brief Set the correct offset values for each axis |
---|
[378] | 154 | void setOffsets(struct wcsprm &wcs); |
---|
[221] | 155 | |
---|
[378] | 156 | //------------------ |
---|
| 157 | // These are in param.cc |
---|
[528] | 158 | /// @brief Is a pixel value a BLANK? |
---|
[378] | 159 | bool isBlank(float &value); |
---|
[258] | 160 | |
---|
[1242] | 161 | /// @brief Has a given channel been flagged by the user? |
---|
| 162 | bool isFlaggedChannel(int z); |
---|
| 163 | std::vector<bool> getChannelFlags(int numChannels); |
---|
[275] | 164 | |
---|
[528] | 165 | /// @brief Is a given pixel position OK for use with stats calculations? |
---|
[378] | 166 | bool isStatOK(int x, int y, int z); |
---|
[275] | 167 | |
---|
[528] | 168 | /// @brief Make a mask array -- an array saying whether each pixel is BLANK or not |
---|
[1393] | 169 | std::vector<bool> makeBlankMask(float *array, size_t size); |
---|
[221] | 170 | |
---|
[528] | 171 | /// @brief Make a mask array -- an array saying whether each pixel is able to be used for statistics calculations |
---|
[1393] | 172 | std::vector<bool> makeStatMask(float *array, size_t *dim); |
---|
[378] | 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 §ion(){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 | // |
---|
[475] | 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;}; |
---|
[1242] | 201 | std::vector<int> getObjectListVector(){return objectListVector;}; |
---|
| 202 | void setObjectListVector(std::vector<int> v){objectListVector = v;}; |
---|
[475] | 203 | std::vector<int> getObjectRequest(); |
---|
| 204 | std::vector<bool> getObjectChoices(); |
---|
| 205 | std::vector<bool> getObjectChoices(int numObjects); |
---|
| 206 | // |
---|
[378] | 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;}; |
---|
[1146] | 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;}; |
---|
[831] | 221 | bool getFlagPlotSpectra(){return flagPlotSpectra;}; |
---|
| 222 | void setFlagPlotSpectra(bool b){flagPlotSpectra=b;}; |
---|
[378] | 223 | std::string getSpectraFile(){return spectraFile;}; |
---|
| 224 | void setSpectraFile(std::string fname){spectraFile = fname;}; |
---|
[1148] | 225 | bool getFlagPlotIndividualSpectra(){return flagPlotIndividualSpectra;}; |
---|
| 226 | void setFlagPlotIndividualSpectra(bool b){flagPlotIndividualSpectra=b;}; |
---|
[424] | 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;}; |
---|
[1120] | 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;}; |
---|
[670] | 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;}; |
---|
[1142] | 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;}; |
---|
[379] | 243 | bool getFlagOutputMask(){return flagOutputMask;}; |
---|
| 244 | void setFlagOutputMask(bool flag){flagOutputMask=flag;}; |
---|
[525] | 245 | std::string getFileOutputMask(){return fileOutputMask;}; |
---|
| 246 | void setFileOutputMask(std::string s){fileOutputMask=s;}; |
---|
[521] | 247 | bool getFlagMaskWithObjectNum(){return flagMaskWithObjectNum;}; |
---|
| 248 | void setFlagMaskWithObjectNum(bool flag){flagMaskWithObjectNum=flag;}; |
---|
[378] | 249 | bool getFlagOutputSmooth(){return flagOutputSmooth;}; |
---|
| 250 | void setFlagOutputSmooth(bool flag){flagOutputSmooth=flag;}; |
---|
[525] | 251 | std::string getFileOutputSmooth(){return fileOutputSmooth;}; |
---|
| 252 | void setFileOutputSmooth(std::string s){fileOutputSmooth=s;}; |
---|
[378] | 253 | bool getFlagOutputRecon(){return flagOutputRecon;}; |
---|
| 254 | void setFlagOutputRecon(bool flag){flagOutputRecon=flag;}; |
---|
[525] | 255 | std::string getFileOutputRecon(){return fileOutputRecon;}; |
---|
| 256 | void setFileOutputRecon(std::string s){fileOutputRecon=s;}; |
---|
[378] | 257 | bool getFlagOutputResid(){return flagOutputResid;}; |
---|
| 258 | void setFlagOutputResid(bool flag){flagOutputResid=flag;}; |
---|
[525] | 259 | std::string getFileOutputResid(){return fileOutputResid;}; |
---|
| 260 | void setFileOutputResid(std::string s){fileOutputResid=s;}; |
---|
[378] | 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;}; |
---|
[1077] | 265 | std::string getAnnotationType(){return annotationType;}; |
---|
| 266 | void setAnnotationType(std::string s){annotationType=s;}; |
---|
[378] | 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;}; |
---|
[1077] | 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;}; |
---|
[1126] | 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;}; |
---|
[378] | 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;}; |
---|
[438] | 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;}; |
---|
[378] | 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;}; |
---|
[1242] | 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;}; |
---|
[662] | 310 | void setBeamSize(float s){areaBeam = s;}; |
---|
| 311 | float getBeamSize(){return areaBeam;}; |
---|
| 312 | void setBeamFWHM(float s){fwhmBeam = s;}; |
---|
| 313 | float getBeamFWHM(){return fwhmBeam;}; |
---|
[788] | 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 |
---|
[434] | 315 | std::string getNewFluxUnits(){return newFluxUnits;}; |
---|
[686] | 316 | void setNewFluxUnits(std::string s){newFluxUnits=s;}; |
---|
| 317 | std::string getSearchType(){return searchType;}; |
---|
| 318 | void setSearchType(std::string s){searchType=s;}; |
---|
[378] | 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;}; |
---|
[935] | 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;}; |
---|
[378] | 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;}; |
---|
[461] | 344 | float getGrowthThreshold(){return growthThreshold;}; |
---|
| 345 | void setGrowthThreshold(float f){growthThreshold=f;}; |
---|
| 346 | bool getFlagUserGrowthThreshold(){return flagUserGrowthThreshold;}; |
---|
| 347 | void setFlagUserGrowthThreshold(bool b){flagUserGrowthThreshold=b;}; |
---|
[378] | 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;}; |
---|
[543] | 353 | int getFDRnumCorChan(){return FDRnumCorChan;}; |
---|
| 354 | void setFDRnumCorChan(int i){FDRnumCorChan=i;}; |
---|
[378] | 355 | // |
---|
| 356 | bool getFlagBaseline(){return flagBaseline;}; |
---|
| 357 | void setFlagBaseline(bool flag){flagBaseline = flag;}; |
---|
[1259] | 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;}; |
---|
[378] | 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);}; |
---|
[815] | 367 | Section &statsec(){Section &rsection = statSec; return rsection;}; |
---|
[385] | 368 | bool getFlagRobustStats(){return flagRobustStats;}; |
---|
| 369 | void setFlagRobustStats(bool flag){flagRobustStats=flag;}; |
---|
[378] | 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;}; |
---|
[1279] | 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;}; |
---|
[378] | 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;}; |
---|
[1026] | 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;}; |
---|
[378] | 402 | float getAtrousCut(){return snrRecon;}; |
---|
| 403 | void setAtrousCut(float c){snrRecon=c;}; |
---|
[1026] | 404 | float getReconConvergence(){return reconConvergence;}; |
---|
| 405 | void setReconConvergence(float f){reconConvergence = f;}; |
---|
[378] | 406 | int getFilterCode(){return filterCode;}; |
---|
| 407 | void setFilterCode(int c){filterCode=c;}; |
---|
[1339] | 408 | std::string getFilterName(){return reconFilter->getName();}; |
---|
| 409 | Filter& filter(){ Filter &rfilter = *reconFilter; return rfilter; }; |
---|
[378] | 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;}; |
---|
[1261] | 417 | unsigned int getMinPix(){return minPix;}; |
---|
| 418 | void setMinPix(unsigned int m){minPix=m;}; |
---|
[943] | 419 | unsigned int getMinChannels(){return minChannels;}; |
---|
| 420 | void setMinChannels(unsigned int n){minChannels=n;}; |
---|
[721] | 421 | unsigned int getMinVoxels(){return minVoxels;}; |
---|
| 422 | void setMinVoxels(unsigned int n){minVoxels=n;}; |
---|
[1261] | 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;}; |
---|
[672] | 429 | bool getFlagRejectBeforeMerge(){return flagRejectBeforeMerge;}; |
---|
| 430 | void setFlagRejectBeforeMerge(bool flag){flagRejectBeforeMerge=flag;}; |
---|
[691] | 431 | bool getFlagTwoStageMerging(){return flagTwoStageMerging;}; |
---|
| 432 | void setFlagTwoStageMerging(bool flag){flagTwoStageMerging=flag;}; |
---|
[378] | 433 | // |
---|
| 434 | std::string getSpectralMethod(){return spectralMethod;}; |
---|
| 435 | void setSpectralMethod(std::string s){spectralMethod=s;}; |
---|
[948] | 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;}; |
---|
[378] | 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;}; |
---|
[571] | 446 | std::string getSortingParam(){return sortingParam;}; |
---|
| 447 | void setSortingParam(std::string s){sortingParam=s;}; |
---|
[378] | 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 | |
---|
[528] | 453 | /// @brief Are we in verbose mode? |
---|
[378] | 454 | bool isVerbose(){return verbose;}; |
---|
| 455 | void setVerbosity(bool f){verbose=f;}; |
---|
[3] | 456 | |
---|
[1137] | 457 | /// @brief Set the comment characters |
---|
| 458 | void setCommentString(std::string comment){commentStr = comment;}; |
---|
| 459 | std::string commentString(){return commentStr;}; |
---|
| 460 | |
---|
[378] | 461 | private: |
---|
| 462 | // Input files |
---|
[528] | 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. |
---|
[71] | 470 | |
---|
[528] | 471 | bool usePrevious; ///< Whether to read the detections from a previously-created log file |
---|
| 472 | std::string objectList; ///< List of objects to re-plot |
---|
[1242] | 473 | std::vector<int> objectListVector; ///<< Vector list of the objects requested |
---|
[475] | 474 | |
---|
[378] | 475 | // Output files |
---|
[528] | 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. |
---|
[1146] | 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. |
---|
[831] | 483 | bool flagPlotSpectra; ///< Should we plot the spectrum of each detection? |
---|
[528] | 484 | std::string spectraFile; ///< Where the spectra are displayed |
---|
[1148] | 485 | bool flagPlotIndividualSpectra; ///< Should the sources be plotted with spectra in individual files? |
---|
[528] | 486 | bool flagTextSpectra; ///< Should a text file with all spectra be written? |
---|
| 487 | std::string spectraTextFile; ///< Where the text spectra are written. |
---|
[1120] | 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 |
---|
[670] | 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 |
---|
[1142] | 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 |
---|
[528] | 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? |
---|
[525] | 500 | std::string fileOutputRecon; ///< The name of the reconstructed cube file |
---|
[528] | 501 | bool flagOutputResid; ///< Should the residuals from the reconstruction be written to a FITS file? |
---|
[525] | 502 | std::string fileOutputResid; ///< The name of the residual cube file |
---|
[528] | 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. |
---|
[1126] | 507 | bool flagCasa; ///< Should we save results in CASA region format? |
---|
| 508 | std::string casaFile; ///< Where the CASA region file goes. |
---|
[1077] | 509 | bool flagDS9; ///< Should we save results in DS9 annotation format? |
---|
| 510 | std::string ds9File; ///< Where the DS9 annotation file goes. |
---|
[528] | 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. |
---|
[3] | 519 | |
---|
[378] | 520 | // Cube related parameters |
---|
[528] | 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. |
---|
[475] | 528 | |
---|
[385] | 529 | // Milky-Way parameters |
---|
[1240] | 530 | std::string flaggedChannelList; ///< List of channels to be flagged (ignored). |
---|
| 531 | std::vector <int> flaggedChannels; ///< The flagged channels listed individually |
---|
[1242] | 532 | std::vector<bool> flaggedChannelMask; ///< Whether a given channel is flagged, up to the maximum listed flagged channel |
---|
[475] | 533 | |
---|
[378] | 534 | // Trim-related |
---|
[528] | 535 | bool flagTrim; ///< Does the user want the cube trimmed? |
---|
| 536 | bool hasBeenTrimmed; ///< Has the cube been trimmed of excess BLANKs around the edge? |
---|
[935] | 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; |
---|
[475] | 541 | |
---|
[378] | 542 | // Subsection offsets |
---|
[528] | 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 |
---|
[475] | 548 | |
---|
[378] | 549 | // Baseline related |
---|
[528] | 550 | bool flagBaseline; ///< Whether to do baseline subtraction before reconstruction and/or searching. |
---|
[1259] | 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. |
---|
[475] | 553 | |
---|
[378] | 554 | // Detection-related |
---|
[662] | 555 | float areaBeam; ///< Size (area) of the beam in pixels. |
---|
| 556 | float fwhmBeam; ///< FWHM of the beam in pixels. |
---|
[788] | 557 | DuchampBeam beamAsUsed; ///< A copy of the beam as used in FitsHeader - only used here for output |
---|
[686] | 558 | std::string searchType; ///< How to do the search: by channel map or by spectrum |
---|
[475] | 559 | |
---|
[378] | 560 | // Object growth |
---|
[528] | 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 |
---|
[475] | 565 | |
---|
[378] | 566 | // FDR analysis |
---|
[528] | 567 | bool flagFDR; ///< Should the FDR method be used? |
---|
| 568 | float alphaFDR; ///< Alpha value for FDR detection algorithm |
---|
[543] | 569 | int FDRnumCorChan; ///< Number of correlated channels, used in the FDR algorithm |
---|
[475] | 570 | |
---|
[378] | 571 | // Basic detection |
---|
[528] | 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. |
---|
[475] | 578 | |
---|
[378] | 579 | // Smoothing of the cube |
---|
[528] | 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). |
---|
[1279] | 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 |
---|
[475] | 588 | |
---|
[378] | 589 | // A trous reconstruction parameters |
---|
| 590 | bool flagATrous; ///< Are we using the a trous reconstruction? |
---|
[475] | 591 | int reconDim; ///< How many dimensions to use for the reconstruction? |
---|
[846] | 592 | unsigned int scaleMin; ///< Min scale used in a trous reconstruction |
---|
[1026] | 593 | unsigned int scaleMax; ///< Max scale used in a trous reconstruction |
---|
[475] | 594 | float snrRecon; ///< SNR cutoff used in a trous reconstruction (only wavelet coefficients that survive this threshold are kept) |
---|
[1026] | 595 | float reconConvergence;///< Convergence criterion for reconstruction - maximum fractional change in residual standard deviation |
---|
[1339] | 596 | Filter *reconFilter; ///< The filter used for reconstructions. |
---|
[475] | 597 | int filterCode; ///< The code number for the filter to be used (saves having to parse names) |
---|
[3] | 598 | |
---|
[378] | 599 | // Volume-merging parameters |
---|
[475] | 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 |
---|
[1261] | 603 | unsigned int minPix; ///< Minimum number of pixels for a detected object to be counted |
---|
[943] | 604 | unsigned int minChannels; ///< Minimum no. of channels to make an object |
---|
| 605 | unsigned int minVoxels; ///< Minimum no. of voxels required in an object |
---|
[1261] | 606 | int maxPix; |
---|
| 607 | int maxChannels; |
---|
| 608 | int maxVoxels; |
---|
[672] | 609 | bool flagRejectBeforeMerge; ///< Whether to reject sources before merging |
---|
[691] | 610 | bool flagTwoStageMerging; ///< Whether to do a partial merge when the objects are found, via the mergeIntoList function. |
---|
[385] | 611 | |
---|
[378] | 612 | // Input-Output related |
---|
[475] | 613 | std::string spectralMethod; ///< A string indicating choice of spectral plotting method: choices are "peak" (default) or "sum" |
---|
[948] | 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. |
---|
[3] | 623 | |
---|
[1137] | 624 | std::string commentStr; ///< Any comment characters etc that need to be prepended to any output via the << operator. |
---|
| 625 | |
---|
[378] | 626 | }; |
---|
[3] | 627 | |
---|
[378] | 628 | //=========================================================================== |
---|
[221] | 629 | |
---|
[3] | 630 | |
---|
[378] | 631 | } |
---|
[3] | 632 | #endif |
---|