source: trunk/src/Cubes/cubes.hh @ 379

Last change on this file since 379 was 379, checked in by MatthewWhiting, 17 years ago

Added in functionality to output a mask cube FITS file. Cube has values 1 where there is a detected object, and 0 elsewhere. Works in similar way to the reconCube or smoothCube.

File size: 25.6 KB
Line 
1// -----------------------------------------------------------------------
2// cubes.hh: Definitions of the DataArray, Cube and Image classes.
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 CUBES_H
29#define CUBES_H
30
31#include <iostream>
32#include <string>
33#include <vector>
34
35#include <param.hh>
36#include <fitsHeader.hh>
37#include <Detection/detection.hh>
38#include <Detection/columns.hh>
39#include <Cubes/plots.hh>
40#include <Utils/Statistics.hh>
41#include <PixelMap/Scan.hh>
42#include <PixelMap/Object2D.hh>
43
44
45namespace duchamp
46{
47
48
49  /** Search a reconstructed array for significant detections. */
50  std::vector <Detection>
51  searchReconArray(long *dim, float *originalArray, float *reconArray,
52                   Param &par, Statistics::StatsContainer<float> &stats);
53  std::vector <Detection>
54  searchReconArraySimple(long *dim, float *originalArray, float *reconArray,
55                         Param &par, Statistics::StatsContainer<float> &stats);
56
57  /** Search a 3-dimensional array for significant detections. */
58  std::vector <Detection>
59  search3DArray(long *dim, float *Array, Param &par,
60                Statistics::StatsContainer<float> &stats);
61  std::vector <Detection>
62  search3DArraySimple(long *dim, float *Array, Param &par,
63                      Statistics::StatsContainer<float> &stats);
64
65  /**
66   * Base class for the image container.
67   *
68   * Definition of an n-dimensional data array:
69   *     array of pixel values, size & dimensions
70   *     array of Detection objects
71   */
72
73  class DataArray
74  {
75  public:
76    DataArray();  ///< Basic DataArray constructor
77    DataArray(short int nDim); ///< Basic nDim-dimensional DataArray constructor
78    DataArray(short int nDim, long size);///< Basic nDim-dimensional DataArray constructor, specifying size.
79    DataArray(short int nDim, long *dimensions); ///< Basic nDim-dimensional DataArray constructor, specifying size of dimensions.
80    virtual ~DataArray(); ///< Basic DataArray constructor
81
82    //-----------------------------------------
83    // Obvious inline accessor functions.
84    //
85    long               getDimX(){if(numDim>0) return axisDim[0];else return 0;};
86    long               getDimY(){if(numDim>1) return axisDim[1];else return 1;};
87    long               getDimZ(){if(numDim>2) return axisDim[2];else return 1;};
88    long               getSize(){ return numPixels; };
89    short int          getNumDim(){ return numDim; };
90    virtual float      getPixValue(long pos){ return array[pos]; };
91    virtual void       setPixValue(long pos, float f){array[pos] = f;};
92    Detection          getObject(long number){ return objectList->at(number); };
93    std::vector <Detection> getObjectList(){ return *objectList; };
94    long               getNumObj(){ return objectList->size(); };
95
96    /** Delete all objects from the list of detections. */
97    void               clearDetectionList(){
98      //objectList->clear();
99      delete objectList;
100      objectList = new std::vector<Detection>;
101    };
102
103    /** Read a parameter set from file. */
104    int                readParam(std::string paramfile){
105      /**
106       *  Uses Param::readParams() to read parameters from a file.
107       *  \param paramfile The file to be read.
108       */
109      return par.readParams(paramfile);
110    };
111
112    //-----------------------------------------
113    // Related to the various arrays
114    //
115    /**  Return first three dimensional axes. */
116    void               getDim(long &x, long &y, long &z);
117    /** Return array of dimensional sizes.*/
118    void               getDimArray(long *output);
119    long *             getDimArray(){return axisDim;};
120
121    /** Return pixel value array. */
122    void               getArray(float *output);
123    float *            getArray(){return array;};
124
125    /** Save pixel value array. */
126    virtual void       saveArray(float *input, long size);
127
128    //-----------------------------------------
129    // Related to the object lists
130    //
131    /** Adds a single detection to the object list.*/
132    void               addObject(Detection object);
133
134    /** Adds all objects in a detection list to the object list. */
135    void               addObjectList(std::vector <Detection> newlist);   
136
137    /** Add pixel offsets to object coordinates. */
138    void               addObjectOffsets();
139
140    //-----------------------------------------
141    // Parameter list related.
142    //
143    /** Output the Param set.*/
144    void               showParam(std::ostream &stream){ stream << par; };
145    /** Return the Param set.*/
146    Param              getParam(){ return par; };
147    /** Save a Param set to the Cube.*/
148    void               saveParam(Param &newpar){par = newpar;};
149    /** Provides a reference to the Param set.*/
150    Param&             pars(){ Param &rpar = par; return rpar; };
151    /** Is the voxel number given by vox a BLANK value?*/
152    bool               isBlank(int vox);
153
154    // --------------------------------------------
155    // Statistics
156    //
157    /**  Returns the StatsContainer. */
158    Statistics::StatsContainer<float> getStats(){ return Stats; };
159
160    /** Provides a reference to the StatsContainer. */
161    Statistics::StatsContainer<float>& stats(){
162      Statistics::StatsContainer<float> &rstats = Stats;  return rstats;
163    };
164 
165    /** Save a StatsContainer to the Cube. */
166    void saveStats(Statistics::StatsContainer<float> newStats){ Stats = newStats;};
167
168    /** A detection test for value. */
169    bool isDetection(float value);
170
171    /**  A detection test for pixel.  */
172    bool isDetection(long voxel);
173
174
175    /** Output operator for DataArray.*/
176    friend std::ostream& operator<< (std::ostream& theStream, DataArray &array);
177 
178
179  protected:
180    short int                numDim;     ///< Number of dimensions.
181    long                    *axisDim;    ///< Array of dimensions of cube
182    ///   (ie. how large in each
183    ///   direction).
184    long                     numPixels;  ///< Total number of pixels in cube.
185    float                   *array;      ///< Array of data.
186    std::vector <Detection> *objectList; ///< The list of detected objects.
187    Param                    par;        ///< A parameter list.
188    Statistics::StatsContainer<float> Stats; ///< The statistics for the DataArray.
189  };
190
191
192
193  //=========================================================================
194
195  /**
196   * Definition of an data-cube object (3D):
197   *     a DataArray object limited to dim=3
198   */
199
200  class Cube : public DataArray
201  {
202  public:
203    Cube();                 ///< Basic Cube constructor.
204    Cube(long nPix);        ///< Alternative Cube constructor.
205    Cube(long *dimensions); ///< Alternative Cube constructor.
206    virtual ~Cube();        ///< Basic Cube destructor.
207
208    // INLINE functions -- definitions included after class declaration.
209    /** Is the voxel number given by vox a BLANK value? */
210    bool        isBlank(int vox){ return par.isBlank(array[vox]); };
211
212    /** Is the voxel at (x,y,z) a BLANK value? */
213    bool        isBlank(long x, long y, long z){
214      return par.isBlank(array[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x]); };
215
216    /** Does the Cube::recon array exist? */
217    bool        isRecon(){ return reconExists; };
218
219    float       getPixValue(long pos){ return array[pos]; };
220    float       getPixValue(long x, long y, long z){
221      return array[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x]; };
222    short       getDetectMapValue(long pos){ return detectMap[pos]; };
223    short       getDetectMapValue(long x, long y){ return detectMap[y*axisDim[0]+x]; };
224    float       getReconValue(long pos){ return recon[pos]; };
225    float       getReconValue(long x, long y, long z){
226      return recon[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x];};
227    float       getBaselineValue(long pos){ return baseline[pos]; };
228    float       getBaselineValue(long x, long y, long z){
229      return baseline[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x]; };
230    void        setPixValue(long pos, float f){array[pos] = f;};;
231    void        setPixValue(long x, long y, long z, float f){
232      array[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x] = f;};
233    void        setDetectMapValue(long pos, short f){ detectMap[pos] = f;};
234    void        setDetectMapValue(long x, long y, short f){ detectMap[y*axisDim[0] + x] = f;};
235    void        setReconValue(long pos, float f){recon[pos] = f;};
236    void        setReconValue(long x, long y, long z, float f){
237      recon[z*axisDim[0]*axisDim[1] + y*axisDim[0] + x] = f; };
238    void        setReconFlag(bool f){reconExists = f;};
239
240    std::vector<Column::Col> getLogCols(){return logCols;};
241    void        setLogCols(std::vector<Column::Col> C){logCols=C;};
242    std::vector<Column::Col> getFullCols(){return fullCols;};
243    void        setFullCols(std::vector<Column::Col> C){fullCols=C;};
244
245    // additional functions -- in Cubes/cubes.cc
246    /** Allocate memory correctly, with WCS defining the correct axes. */
247    void        initialiseCube(long *dimensions);
248
249    /** Read in a FITS file, with subsection correction. */
250    int         getCube();
251
252    /** Read in command-line options. */
253    //   int         getopts(int argc, char ** argv);
254    int         getopts(int argc, char ** argv){return par.getopts(argc,argv);};
255
256    /** Read in reconstructed & smoothed arrays from FITS files on disk. */
257    void        readSavedArrays();
258
259    /** Save an external array to the Cube's pixel array */
260    void        saveArray(float *input, long size);
261
262    /** Save an external array to the Cube's reconstructed array. */
263    void        saveRecon(float *input, long size);
264
265    /** Save reconstructed array to an external array. */
266    void        getRecon(float *output);
267
268    /** Set Milky Way channels to zero. */
269    void        removeMW();
270
271    //------------------------
272    // Statistics for cube
273    //
274
275    /** Calculate the statistics for the Cube (older version). */
276    void        setCubeStatsOld();
277
278    /** Calculate the statistics for the Cube. */
279    void        setCubeStats();
280
281    /** Set up thresholds for the False Discovery Rate routine. */
282    void        setupFDR();
283    /** Set up thresholds for the False Discovery Rate routine using a
284        particular array. */
285    void        setupFDR(float *input);
286
287    /** A detection test for a given voxel. */
288    bool        isDetection(long x, long y, long z);
289
290    //-----------------------------
291    // Dealing with the detections
292    //
293
294    /** Calculate the WCS parameters for each Cube Detection. */
295    void        calcObjectWCSparams();
296
297    /** Sort the list of detections. */
298    void        sortDetections();
299
300    /** Update the map of detected pixels. */
301    void        updateDetectMap();
302
303    /** Update the map of detected pixels for a given Detection. */
304    void        updateDetectMap(Detection obj);
305
306    /** Clear the map of detected pixels. */
307    void        clearDetectMap(){
308      for(int i=0;i<axisDim[0]*axisDim[1];i++) detectMap[i]=0;
309    };
310
311    /** Find the flux enclosed by a Detection. */
312    float       enclosedFlux(Detection obj);
313
314    /** Set up the output column definitions for the Cube and its
315        Detection list. */
316    void        setupColumns();
317
318    /** Is the object at the edge of the image? */
319    bool        objAtSpatialEdge(Detection obj);
320
321    /** Is the object at an end of the spectrum? */
322    bool        objAtSpectralEdge(Detection obj);
323
324    /** Set warning flags for the detections. */
325    void        setObjectFlags();
326
327    // ----------------------------
328    // Dealing with the WCS
329    //
330    /** Return the FitsHeader object. */
331    FitsHeader  getHead(){ return head; };
332    /** Define the FitsHeader object. */
333    void        setHead(FitsHeader F){head = F;};
334    /** Provide a reference to the FitsHeader object.*/
335    FitsHeader& header(){ FitsHeader &h = head; return h; };
336
337    /** Convert a point from WCS to Pixel coords. */
338    int         wcsToPix(const double *world, double *pix);
339
340    /** Convert a set of points from WCS to Pixel coords. */
341    int         wcsToPix(const double *world, double *pix, const int npts);
342
343    /** Convert a point from Pixel to WCS coords. */
344    int         pixToWCS(const double *pix, double *world);
345
346    /** Convert a set of points from Pixel to WCS coords. */
347    int         pixToWCS(const double *pix, double *world, const int npts);
348
349    //-------------------------------------------
350    // FITS-I/O related functions -- not in cubes.cc
351    //
352    /** Function to read in FITS file.*/
353    int         getCube(std::string fname);  // in Cubes/getImage.cc
354
355    /** Function to retrieve FITS data array */
356    int         getFITSdata(std::string fname);   // in FitsIO/dataIO.cc
357
358    /** Save a mask array to disk.*/
359    void        saveMaskCube();       // in Cubes/saveImage.cc
360
361    /** Save Smoothed array to disk.*/
362    void        saveSmoothedCube();       // in Cubes/saveImage.cc
363
364    /** Save Reconstructed array to disk. */
365    void        saveReconstructedCube();  // in Cubes/saveImage.cc
366
367    /** Read in reconstructed array from FITS file. */
368    int         readReconCube();  // in Cubes/readRecon.cc
369 
370    /** Read in Hanning-smoothed array from FITS file. */
371    int         readSmoothCube();     // in Cubes/readSmooth.cc 
372
373    //-------------------------------------
374    // Functions that act on the cube
375    //
376
377    /** Remove excess BLANK pixels from spatial edge of cube. */
378    void        trimCube();         // in Cubes/trimImage.cc
379
380    /** Replace BLANK pixels to spatial edge of cube. */
381    void        unTrimCube();       // in Cubes/trimImage.cc
382
383    /** Removes the baselines from the spectra, and stores in Cube::baseline */
384    void        removeBaseline();   // in Cubes/baseline.cc
385
386    /** Replace the baselines stored in Cube::baseline */
387    void        replaceBaseline();  // in Cubes/baseline.cc
388
389    /** Multiply all pixel values by -1. */
390    void        invert();           // in Cubes/invertCube.cc
391
392    /** Undo the inversion, and invert fluxes of all detected objects. */
393    void        reInvert();         // in Cubes/invertCube.cc
394
395    //-------------------------------------
396    // Reconstruction, Searching and Merging functions
397    //
398    // in ATrous/ReconSearch.cc
399    /** Front-end to reconstruction & searching functions.*/
400    void        ReconSearch();
401    /** Switcher to reconstruction functions */
402    void        ReconCube();
403    /** Performs 1-dimensional a trous reconstruction on the Cube. */
404    void        ReconCube1D();
405    /** Performs 2-dimensional a trous reconstruction on the Cube. */
406    void        ReconCube2D();
407    /** Performs 3-dimensional a trous reconstruction on the Cube. */
408    void        ReconCube3D();
409
410    // in Cubes/CubicSearch.cc
411    /** Front-end to the cubic searching routine. */
412    void        CubicSearch();
413
414    // in Cubes/smoothCube.cc
415    /** Smooth the cube with the requested method.*/
416    void        SmoothCube();
417    /** Front-end to the smoothing and searching functions. */
418    void        SmoothSearch();
419    /** A function to spatially smooth the cube and search the result. */
420    void        SpatialSmoothNSearch();
421    /** A function to Hanning-smooth the cube. */
422    void        SpectralSmooth();
423    /** A function to spatially-smooth the cube. */
424    void        SpatialSmooth();
425
426    void        Simple3DSearch(){
427      /**
428       * Basic front-end to the simple 3d searching function -- does
429       * nothing more.
430       *
431       * This function just runs the search3DArraySimple function,
432       * storing the results in the Cube::objectList vector. No stats
433       * are calculated beforehand, and no logging or detection map
434       * updating is done.
435       */
436      *objectList = search3DArraySimple(axisDim,array,par,Stats);
437    };
438
439    void        Simple3DSearchRecon(){
440      /**
441       * Basic front-end to the 3d searching function used in the
442       * reconstruction case -- does nothing more.
443       *
444       * This function just runs the searchReconArraySimple function,
445       * storing the results in the Cube::objectList vector. No stats
446       * are calculated beforehand, and no logging or detection map
447       * updating is done. The recon array is assumed to have been
448       * defined already.
449       */
450      *objectList = searchReconArraySimple(axisDim,array,recon,par,Stats);
451    };
452
453    void        Simple3DSearchSmooth(){
454      /**
455       * Basic front-end to the simple 3d searching function run on the
456       * smoothed array -- does nothing more.
457       *
458       * This function just runs the search3DArraySimple function on the
459       * recon array (which contains the smoothed array), storing the
460       * results in the Cube::objectList vector. No stats are calculated
461       * beforehand, and no logging or detection map updating is
462       * done. The recon array is assumed to have been defined already.
463       */
464      *objectList = search3DArraySimple(axisDim,recon,par,Stats);
465    };
466
467    // in Cubes/Merger.cc
468    /** Merge all objects in the detection list so that only distinct
469        ones are left. */
470    void        ObjectMerger();
471 
472    //-------------------------------------
473    // Text outputting of detected objects.
474    //   in Cubes/detectionIO.cc
475    //
476    /** Set up the output file with parameters and stats. */
477    void        prepareOutputFile();
478
479    /** Write the statistical information to the output file. */
480    void        outputStats();
481
482    /** Output detections to the output file and standard output. */
483    void        outputDetectionList();
484
485    /** Output detections to the log file. */
486    void        logDetectionList();
487
488    /** Output a single detection to the log file. */
489    void        logDetection(Detection obj, int counter);
490
491    /** Output detections to a Karma annotation file. */
492    void        outputDetectionsKarma(std::ostream &stream);
493
494    /** Output detections to a VOTable. */
495    void        outputDetectionsVOTable(std::ostream &stream);
496
497    // ----------------------------------
498    // Graphical plotting of the cube and the detections.
499    //
500    //  in Cubes/plotting.cc
501    /** Plot a spatial map of detections based on number of detected
502        channels. */
503    void        plotDetectionMap(std::string pgDestination);
504
505    /** Plot a spatial map of detections based on 0th moment map of each
506        object. */
507    void        plotMomentMap(std::string pgDestination);
508
509    /** Plot a spatial map of detections based on 0th moment map of each
510        object to a number of PGPLOT devices. */
511    void        plotMomentMap(std::vector<std::string> pgDestination);
512
513    /** Draw WCS axes over a PGPLOT map. */
514    void        plotWCSaxes();
515
516    //  in Cubes/outputSpectra.cc
517    /** Print spectra of each detected object. */
518    void        outputSpectra();
519
520    /** Print spectrum of a single object */
521    void        plotSpectrum(Detection obj,Plot::SpectralPlot &plot);
522    /** Plot the image cutout for a single object */
523    void        plotSource(Detection obj, Plot::CutoutPlot &plot);
524
525    //  in Cubes/drawMomentCutout.cc
526    /** Draw the 0th moment map for a single object. */
527    void        drawMomentCutout(Detection &object);
528
529    /** Draw a scale bar indicating angular size of the cutout. */
530    void        drawScale(float xstart,float ystart,float channel);
531
532    /** Draw a yellow line around the edge of the spatial extent of
533        pixels. */
534    void        drawFieldEdge();
535
536  private:
537    float      *recon;            ///< reconstructed array - used when
538    ///   doing a trous reconstruction.
539    bool        reconExists;      ///< flag saying whether there is a
540    ///   reconstruction
541    short      *detectMap;        ///< "moment map" - x,y locations of
542    ///   detected pixels
543    float      *baseline;         ///< array of spectral baseline
544    ///   values.
545                             
546    bool        reconAllocated;   ///< have we allocated memory for the
547    ///   recon array?
548    bool        baselineAllocated;///< have we allocated memory for the
549    ///   baseline array?
550    FitsHeader  head;             ///< the WCS and other header
551    ///   information.
552    std::vector<Column::Col> fullCols;    ///< the list of all columns as
553    ///   printed in the results file
554    std::vector<Column::Col> logCols;     ///< the list of columns as printed in
555    ///   the log file
556
557  };
558
559  ////////////
560  //// Cube inline function definitions
561  ////////////
562
563  inline int Cube::wcsToPix(const double *world, double *pix)
564  {
565    /**
566     *  Use the WCS in the FitsHeader to convert from WCS to pixel coords for
567     *   a single point.
568     *  \param world The world coordinates.
569     *  \param pix The returned pixel coordinates.
570     */
571    return this->head.wcsToPix(world,pix);
572  }
573  inline int Cube::wcsToPix(const double *world, double *pix, const int npts)
574  {
575    /**
576     *  Use the WCS in the FitsHeader to convert from WCS to pixel coords for
577     *   a set of points.
578     *  \param world The world coordinates.
579     *  \param pix The returned pixel coordinates.
580     *  \param npts The number of points being converted.
581     */
582    return this->head.wcsToPix(world,pix,npts);
583  }
584  inline int Cube::pixToWCS(const double *pix, double *world)
585  {
586    /**
587     *  Use the WCS in the FitsHeader to convert from pixel to WCS coords for
588     *   a single point.
589     *  \param pix The pixel coordinates.
590     *  \param world The returned world coordinates.
591     */
592    return this->head.pixToWCS(pix,world);
593  }
594  inline int Cube::pixToWCS(const double *pix, double *world, const int npts)
595  {
596    /**
597     *  Use the WCS in the FitsHeader to convert from pixel to WCS coords for
598     *   a set of points.
599     *  \param pix The pixel coordinates.
600     *  \param world The returned world coordinates.
601     *  \param npts The number of points being converted.
602     */
603    return this->head.pixToWCS(pix,world,npts);
604  }
605
606
607  //============================================================================
608
609  /**
610   *  A DataArray object limited to two dimensions, and with some additional
611   *   special functions.
612   *
613   *  It is used primarily for searching a 1- or 2-D array with
614   *   lutz_detect() and spectrumDetect().
615   */
616
617  class Image : public DataArray
618  {
619  public:
620    Image(){numPixels=0; numDim=2;};
621    Image(long nPix);
622    Image(long *dimensions);
623    virtual ~Image(){};
624
625    //--------------------
626    // Defining the array
627    //
628    /** Save an external array to the Cube's pixel array */
629    void      saveArray(float *input, long size);
630
631    /** Extract a spectrum from an array and save to the local pixel array. */
632    void      extractSpectrum(float *Array, long *dim, long pixel);
633
634    /** Extract an image from an array and save to the local pixel array. */
635    void      extractImage(float *Array, long *dim, long channel);
636
637    /** Extract a spectrum from a cube and save to the local pixel array. */
638    void      extractSpectrum(Cube &cube, long pixel);
639
640    /** Extract an image from a cube and save to the local pixel array. */
641    void      extractImage(Cube &cube, long channel);
642
643    //--------------------
644    // Accessing the data.
645    //
646    float     getPixValue(long pos){ return array[pos]; };
647    float     getPixValue(long x, long y){return array[y*axisDim[0] + x];};
648    // the next few should have checks against array overflow...
649    void      setPixValue(long pos, float f){array[pos] = f;};;
650    void      setPixValue(long x, long y, float f){array[y*axisDim[0] + x] = f;};
651    bool      isBlank(int vox){return par.isBlank(array[vox]);};
652    bool      isBlank(long x,long y){return par.isBlank(array[y*axisDim[0]+x]);};
653
654    //-----------------------
655    // Detection-related
656    //
657    // in Detection/lutz_detect.cc:
658    /** Detect objects in a 2-D image */
659    std::vector<PixelInfo::Object2D> lutz_detect();
660
661    // in Detection/spectrumDetect.cc:
662    /** Detect objects in a 1-D spectrum */
663    std::vector<PixelInfo::Scan> spectrumDetect();
664
665    int       getMinSize(){return minSize;};
666    void      setMinSize(int i){minSize=i;};
667
668    /**  A detection test for a pixel location.  */
669    bool      isDetection(long x, long y){
670      /**
671       * Test whether a pixel (x,y) is a statistically significant detection,
672       * according to the set of statistics in the local StatsContainer object.
673       */
674      long voxel = y*axisDim[0] + x;
675      if(isBlank(x,y)) return false;
676      else return Stats.isDetection(array[voxel]);
677    }; 
678
679    /** Blank out a set of channels marked as being Milky Way channels */
680    void      removeMW();
681
682  private:
683    int       minSize;    ///< the minimum number of pixels for a
684    ///   detection to be accepted.
685  };
686
687
688  /****************************************************************/
689  //////////////////////////////////////////////////////
690  // Prototypes for functions that use above classes
691  //////////////////////////////////////////////////////
692
693  /** Grow an object to a lower threshold */
694  void growObject(Detection &object, Cube &cube);
695
696  /** Draw the edge of the BLANK region on a map.*/
697  void drawBlankEdges(float *dataArray, int xdim, int ydim, Param &par);
698
699}
700
701#endif
Note: See TracBrowser for help on using the repository browser.