[1069] | 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 | // ----------------------------------------------------------------------- |
---|
[742] | 28 | #ifndef OBJECT_GROWER_H |
---|
| 29 | #define OBJECT_GROWER_H |
---|
| 30 | |
---|
| 31 | #include <iostream> |
---|
| 32 | #include <duchamp/duchamp.hh> |
---|
[1052] | 33 | #include <duchamp/Detection/detection.hh> |
---|
| 34 | #include <duchamp/Cubes/cubes.hh> |
---|
[742] | 35 | #include <duchamp/Utils/Statistics.hh> |
---|
| 36 | |
---|
| 37 | namespace duchamp { |
---|
| 38 | |
---|
[759] | 39 | /// @brief Flags defining the state of each pixel |
---|
[742] | 40 | enum STATE {AVAILABLE, DETECTED, BLANK, MW}; |
---|
| 41 | |
---|
[759] | 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. |
---|
[742] | 51 | class ObjectGrower |
---|
| 52 | { |
---|
| 53 | public: |
---|
[759] | 54 | /// @brief Default constructor |
---|
[742] | 55 | ObjectGrower(); |
---|
[759] | 56 | /// @brief Destrctor |
---|
[742] | 57 | virtual ~ObjectGrower(){}; |
---|
[759] | 58 | /// @brief Copy constructor |
---|
[742] | 59 | ObjectGrower(ObjectGrower &o); |
---|
[759] | 60 | /// @brief Copy operator |
---|
[742] | 61 | ObjectGrower& operator=(const ObjectGrower &o); |
---|
| 62 | |
---|
[759] | 63 | /// @brief Set up the class with parameters & pointers from the cube |
---|
[742] | 64 | void define(Cube *theCube); |
---|
[984] | 65 | /// @brief Update a Cube's detectMap based on the flag array |
---|
| 66 | void updateDetectMap(short *map); |
---|
[759] | 67 | /// @brief Grow an object |
---|
[1051] | 68 | virtual void grow(Detection *theObject); |
---|
[868] | 69 | /// @brief Grow out from a single voxel, returning the list of new voxels. |
---|
[906] | 70 | std::vector<Voxel> growFromPixel(Voxel &vox); |
---|
[742] | 71 | |
---|
| 72 | protected: |
---|
[759] | 73 | std::vector<STATE> itsFlagArray; ///< The array of pixel flags |
---|
[984] | 74 | std::vector<size_t> itsArrayDim; ///< The dimensions of the array |
---|
[759] | 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 |
---|
[742] | 79 | }; |
---|
| 80 | |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | #endif |
---|