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

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

Large amount of changes, but really just making a "duchamp" namespace to encompass duchamp-specific stuff. Not the PixelMap? stuff though.

File size: 25.5 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 Hanning-smoothed array to disk.*/
359    void        saveSmoothedCube();       // in Cubes/saveImage.cc
360
361    /** Save Reconstructed array to disk. */
362    void        saveReconstructedCube();  // in Cubes/saveImage.cc
363
364    /** Read in reconstructed array from FITS file. */
365    int         readReconCube();  // in Cubes/readRecon.cc
366 
367    /** Read in Hanning-smoothed array from FITS file. */
368    int         readSmoothCube();     // in Cubes/readSmooth.cc 
369
370    //-------------------------------------
371    // Functions that act on the cube
372    //
373
374    /** Remove excess BLANK pixels from spatial edge of cube. */
375    void        trimCube();         // in Cubes/trimImage.cc
376
377    /** Replace BLANK pixels to spatial edge of cube. */
378    void        unTrimCube();       // in Cubes/trimImage.cc
379
380    /** Removes the baselines from the spectra, and stores in Cube::baseline */
381    void        removeBaseline();   // in Cubes/baseline.cc
382
383    /** Replace the baselines stored in Cube::baseline */
384    void        replaceBaseline();  // in Cubes/baseline.cc
385
386    /** Multiply all pixel values by -1. */
387    void        invert();           // in Cubes/invertCube.cc
388
389    /** Undo the inversion, and invert fluxes of all detected objects. */
390    void        reInvert();         // in Cubes/invertCube.cc
391
392    //-------------------------------------
393    // Reconstruction, Searching and Merging functions
394    //
395    // in ATrous/ReconSearch.cc
396    /** Front-end to reconstruction & searching functions.*/
397    void        ReconSearch();
398    /** Switcher to reconstruction functions */
399    void        ReconCube();
400    /** Performs 1-dimensional a trous reconstruction on the Cube. */
401    void        ReconCube1D();
402    /** Performs 2-dimensional a trous reconstruction on the Cube. */
403    void        ReconCube2D();
404    /** Performs 3-dimensional a trous reconstruction on the Cube. */
405    void        ReconCube3D();
406
407    // in Cubes/CubicSearch.cc
408    /** Front-end to the cubic searching routine. */
409    void        CubicSearch();
410
411    // in Cubes/smoothCube.cc
412    /** Smooth the cube with the requested method.*/
413    void        SmoothCube();
414    /** Front-end to the smoothing and searching functions. */
415    void        SmoothSearch();
416    /** A function to spatially smooth the cube and search the result. */
417    void        SpatialSmoothNSearch();
418    /** A function to Hanning-smooth the cube. */
419    void        SpectralSmooth();
420    /** A function to spatially-smooth the cube. */
421    void        SpatialSmooth();
422
423    void        Simple3DSearch(){
424      /**
425       * Basic front-end to the simple 3d searching function -- does
426       * nothing more.
427       *
428       * This function just runs the search3DArraySimple function,
429       * storing the results in the Cube::objectList vector. No stats
430       * are calculated beforehand, and no logging or detection map
431       * updating is done.
432       */
433      *objectList = search3DArraySimple(axisDim,array,par,Stats);
434    };
435
436    void        Simple3DSearchRecon(){
437      /**
438       * Basic front-end to the 3d searching function used in the
439       * reconstruction case -- does nothing more.
440       *
441       * This function just runs the searchReconArraySimple function,
442       * storing the results in the Cube::objectList vector. No stats
443       * are calculated beforehand, and no logging or detection map
444       * updating is done. The recon array is assumed to have been
445       * defined already.
446       */
447      *objectList = searchReconArraySimple(axisDim,array,recon,par,Stats);
448    };
449
450    void        Simple3DSearchSmooth(){
451      /**
452       * Basic front-end to the simple 3d searching function run on the
453       * smoothed array -- does nothing more.
454       *
455       * This function just runs the search3DArraySimple function on the
456       * recon array (which contains the smoothed array), storing the
457       * results in the Cube::objectList vector. No stats are calculated
458       * beforehand, and no logging or detection map updating is
459       * done. The recon array is assumed to have been defined already.
460       */
461      *objectList = search3DArraySimple(axisDim,recon,par,Stats);
462    };
463
464    // in Cubes/Merger.cc
465    /** Merge all objects in the detection list so that only distinct
466        ones are left. */
467    void        ObjectMerger();
468 
469    //-------------------------------------
470    // Text outputting of detected objects.
471    //   in Cubes/detectionIO.cc
472    //
473    /** Set up the output file with parameters and stats. */
474    void        prepareOutputFile();
475
476    /** Write the statistical information to the output file. */
477    void        outputStats();
478
479    /** Output detections to the output file and standard output. */
480    void        outputDetectionList();
481
482    /** Output detections to the log file. */
483    void        logDetectionList();
484
485    /** Output a single detection to the log file. */
486    void        logDetection(Detection obj, int counter);
487
488    /** Output detections to a Karma annotation file. */
489    void        outputDetectionsKarma(std::ostream &stream);
490
491    /** Output detections to a VOTable. */
492    void        outputDetectionsVOTable(std::ostream &stream);
493
494    // ----------------------------------
495    // Graphical plotting of the cube and the detections.
496    //
497    //  in Cubes/plotting.cc
498    /** Plot a spatial map of detections based on number of detected
499        channels. */
500    void        plotDetectionMap(std::string pgDestination);
501
502    /** Plot a spatial map of detections based on 0th moment map of each
503        object. */
504    void        plotMomentMap(std::string pgDestination);
505
506    /** Plot a spatial map of detections based on 0th moment map of each
507        object to a number of PGPLOT devices. */
508    void        plotMomentMap(std::vector<std::string> pgDestination);
509
510    /** Draw WCS axes over a PGPLOT map. */
511    void        plotWCSaxes();
512
513    //  in Cubes/outputSpectra.cc
514    /** Print spectra of each detected object. */
515    void        outputSpectra();
516
517    /** Print spectrum of a single object */
518    void        plotSpectrum(Detection obj,Plot::SpectralPlot &plot);
519    /** Plot the image cutout for a single object */
520    void        plotSource(Detection obj, Plot::CutoutPlot &plot);
521
522    //  in Cubes/drawMomentCutout.cc
523    /** Draw the 0th moment map for a single object. */
524    void        drawMomentCutout(Detection &object);
525
526    /** Draw a scale bar indicating angular size of the cutout. */
527    void        drawScale(float xstart,float ystart,float channel);
528
529    /** Draw a yellow line around the edge of the spatial extent of
530        pixels. */
531    void        drawFieldEdge();
532
533  private:
534    float      *recon;            ///< reconstructed array - used when
535    ///   doing a trous reconstruction.
536    bool        reconExists;      ///< flag saying whether there is a
537    ///   reconstruction
538    short      *detectMap;        ///< "moment map" - x,y locations of
539    ///   detected pixels
540    float      *baseline;         ///< array of spectral baseline
541    ///   values.
542                             
543    bool        reconAllocated;   ///< have we allocated memory for the
544    ///   recon array?
545    bool        baselineAllocated;///< have we allocated memory for the
546    ///   baseline array?
547    FitsHeader  head;             ///< the WCS and other header
548    ///   information.
549    std::vector<Column::Col> fullCols;    ///< the list of all columns as
550    ///   printed in the results file
551    std::vector<Column::Col> logCols;     ///< the list of columns as printed in
552    ///   the log file
553
554  };
555
556  ////////////
557  //// Cube inline function definitions
558  ////////////
559
560  inline int Cube::wcsToPix(const double *world, double *pix)
561  {
562    /**
563     *  Use the WCS in the FitsHeader to convert from WCS to pixel coords for
564     *   a single point.
565     *  \param world The world coordinates.
566     *  \param pix The returned pixel coordinates.
567     */
568    return this->head.wcsToPix(world,pix);
569  }
570  inline int Cube::wcsToPix(const double *world, double *pix, const int npts)
571  {
572    /**
573     *  Use the WCS in the FitsHeader to convert from WCS to pixel coords for
574     *   a set of points.
575     *  \param world The world coordinates.
576     *  \param pix The returned pixel coordinates.
577     *  \param npts The number of points being converted.
578     */
579    return this->head.wcsToPix(world,pix,npts);
580  }
581  inline int Cube::pixToWCS(const double *pix, double *world)
582  {
583    /**
584     *  Use the WCS in the FitsHeader to convert from pixel to WCS coords for
585     *   a single point.
586     *  \param pix The pixel coordinates.
587     *  \param world The returned world coordinates.
588     */
589    return this->head.pixToWCS(pix,world);
590  }
591  inline int Cube::pixToWCS(const double *pix, double *world, const int npts)
592  {
593    /**
594     *  Use the WCS in the FitsHeader to convert from pixel to WCS coords for
595     *   a set of points.
596     *  \param pix The pixel coordinates.
597     *  \param world The returned world coordinates.
598     *  \param npts The number of points being converted.
599     */
600    return this->head.pixToWCS(pix,world,npts);
601  }
602
603
604  //============================================================================
605
606  /**
607   *  A DataArray object limited to two dimensions, and with some additional
608   *   special functions.
609   *
610   *  It is used primarily for searching a 1- or 2-D array with
611   *   lutz_detect() and spectrumDetect().
612   */
613
614  class Image : public DataArray
615  {
616  public:
617    Image(){numPixels=0; numDim=2;};
618    Image(long nPix);
619    Image(long *dimensions);
620    virtual ~Image(){};
621
622    //--------------------
623    // Defining the array
624    //
625    /** Save an external array to the Cube's pixel array */
626    void      saveArray(float *input, long size);
627
628    /** Extract a spectrum from an array and save to the local pixel array. */
629    void      extractSpectrum(float *Array, long *dim, long pixel);
630
631    /** Extract an image from an array and save to the local pixel array. */
632    void      extractImage(float *Array, long *dim, long channel);
633
634    /** Extract a spectrum from a cube and save to the local pixel array. */
635    void      extractSpectrum(Cube &cube, long pixel);
636
637    /** Extract an image from a cube and save to the local pixel array. */
638    void      extractImage(Cube &cube, long channel);
639
640    //--------------------
641    // Accessing the data.
642    //
643    float     getPixValue(long pos){ return array[pos]; };
644    float     getPixValue(long x, long y){return array[y*axisDim[0] + x];};
645    // the next few should have checks against array overflow...
646    void      setPixValue(long pos, float f){array[pos] = f;};;
647    void      setPixValue(long x, long y, float f){array[y*axisDim[0] + x] = f;};
648    bool      isBlank(int vox){return par.isBlank(array[vox]);};
649    bool      isBlank(long x,long y){return par.isBlank(array[y*axisDim[0]+x]);};
650
651    //-----------------------
652    // Detection-related
653    //
654    // in Detection/lutz_detect.cc:
655    /** Detect objects in a 2-D image */
656    std::vector<PixelInfo::Object2D> lutz_detect();
657
658    // in Detection/spectrumDetect.cc:
659    /** Detect objects in a 1-D spectrum */
660    std::vector<PixelInfo::Scan> spectrumDetect();
661
662    int       getMinSize(){return minSize;};
663    void      setMinSize(int i){minSize=i;};
664
665    /**  A detection test for a pixel location.  */
666    bool      isDetection(long x, long y){
667      /**
668       * Test whether a pixel (x,y) is a statistically significant detection,
669       * according to the set of statistics in the local StatsContainer object.
670       */
671      long voxel = y*axisDim[0] + x;
672      if(isBlank(x,y)) return false;
673      else return Stats.isDetection(array[voxel]);
674    }; 
675
676    /** Blank out a set of channels marked as being Milky Way channels */
677    void      removeMW();
678
679  private:
680    int       minSize;    ///< the minimum number of pixels for a
681    ///   detection to be accepted.
682  };
683
684
685  /****************************************************************/
686  //////////////////////////////////////////////////////
687  // Prototypes for functions that use above classes
688  //////////////////////////////////////////////////////
689
690  /** Grow an object to a lower threshold */
691  void growObject(Detection &object, Cube &cube);
692
693  /** Draw the edge of the BLANK region on a map.*/
694  void drawBlankEdges(float *dataArray, int xdim, int ydim, Param &par);
695
696}
697
698#endif
Note: See TracBrowser for help on using the repository browser.