source: tags/release-1.2.2/src/Detection/ObjectGrower.hh

Last change on this file was 1069, checked in by MatthewWhiting, 12 years ago

Adding the licensing text to files that didn't have it.

File size: 3.4 KB
Line 
1// -----------------------------------------------------------------------
2// ObjectGrower.hh: Implementation of the object growing functions
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 OBJECT_GROWER_H
29#define OBJECT_GROWER_H
30
31#include <iostream>
32#include <duchamp/duchamp.hh>
33#include <duchamp/Detection/detection.hh>
34#include <duchamp/Cubes/cubes.hh>
35#include <duchamp/Utils/Statistics.hh>
36
37namespace duchamp {
38
39  /// @brief Flags defining the state of each pixel
40  enum STATE {AVAILABLE, DETECTED, BLANK, MW};
41
42  /// @brief A class to manage the growing of objects to a secondary
43  /// threshold
44  /// @details This class provides a mechanism for handling the
45  /// growing of objects. By keeping track of the state of each pixel,
46  /// through an array of flags indicating whether a pixel is
47  /// available or in an object, it is able to efficiently grow the
48  /// objects from pixels on the edge, rather than spending time
49  /// examining pixels that are completely surrounded by other object
50  /// pixels.
51  class ObjectGrower
52  {
53  public:
54    /// @brief Default constructor
55    ObjectGrower();
56    /// @brief Destrctor
57    virtual ~ObjectGrower(){};
58    /// @brief Copy constructor
59    ObjectGrower(ObjectGrower &o);
60    /// @brief Copy operator
61    ObjectGrower& operator=(const ObjectGrower &o);
62
63    /// @brief Set up the class with parameters & pointers from the cube
64    void define(Cube *theCube);
65    /// @brief Update a Cube's detectMap based on the flag array
66    void updateDetectMap(short *map);
67    /// @brief Grow an object
68    virtual void grow(Detection *theObject);
69    /// @brief Grow out from a single voxel, returning the list of new voxels.
70    std::vector<Voxel> growFromPixel(Voxel &vox);
71
72  protected:
73    std::vector<STATE> itsFlagArray;                   ///< The array of pixel flags
74    std::vector<size_t> itsArrayDim;                     ///< The dimensions of the array
75    Statistics::StatsContainer<float> itsGrowthStats;  ///< The statistics used to determine membership of an object
76    int itsSpatialThresh;                              ///< The spatial threshold for merging
77    int itsVelocityThresh;                             ///< The spectral threshold for merging
78    float* itsFluxArray;                               ///< The location of the pixel values
79  };
80
81}
82
83
84#endif
Note: See TracBrowser for help on using the repository browser.