[528] | 1 | // ----------------------------------------------------------------------- |
---|
| 2 | // ChanMap.hh: Definition of ChanMap, a class to combine a two-dimensional |
---|
| 3 | // object with a channel number. |
---|
| 4 | // ----------------------------------------------------------------------- |
---|
| 5 | // Copyright (C) 2006, Matthew Whiting, ATNF |
---|
| 6 | // |
---|
| 7 | // This program is free software; you can redistribute it and/or modify it |
---|
| 8 | // under the terms of the GNU General Public License as published by the |
---|
| 9 | // Free Software Foundation; either version 2 of the License, or (at your |
---|
| 10 | // option) any later version. |
---|
| 11 | // |
---|
| 12 | // Duchamp is distributed in the hope that it will be useful, but WITHOUT |
---|
| 13 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
| 15 | // for more details. |
---|
| 16 | // |
---|
| 17 | // You should have received a copy of the GNU General Public License |
---|
| 18 | // along with Duchamp; if not, write to the Free Software Foundation, |
---|
| 19 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
---|
| 20 | // |
---|
| 21 | // Correspondence concerning Duchamp may be directed to: |
---|
| 22 | // Internet email: Matthew.Whiting [at] atnf.csiro.au |
---|
| 23 | // Postal address: Dr. Matthew Whiting |
---|
| 24 | // Australia Telescope National Facility, CSIRO |
---|
| 25 | // PO Box 76 |
---|
| 26 | // Epping NSW 1710 |
---|
| 27 | // AUSTRALIA |
---|
| 28 | // ----------------------------------------------------------------------- |
---|
| 29 | #ifndef CHANMAP_H |
---|
| 30 | #define CHANMAP_H |
---|
| 31 | |
---|
| 32 | #include <duchamp/PixelMap/Voxel.hh> |
---|
| 33 | #include <duchamp/PixelMap/Scan.hh> |
---|
| 34 | #include <duchamp/PixelMap/Object2D.hh> |
---|
| 35 | #include <vector> |
---|
| 36 | #include <algorithm> |
---|
| 37 | #include <iostream> |
---|
| 38 | |
---|
| 39 | namespace PixelInfo |
---|
| 40 | { |
---|
| 41 | |
---|
| 42 | /// @brief A class to store a channel+Object2D map. |
---|
| 43 | /// @details This represents a 2-dimensional set of pixels that has an |
---|
| 44 | /// associated channel number. Sets of these will form a three |
---|
| 45 | /// dimensional object. |
---|
| 46 | |
---|
| 47 | class ChanMap |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | ChanMap(); |
---|
| 51 | ChanMap(long z){itsZ=z;}; |
---|
| 52 | ChanMap(long z, Object2D obj){itsZ=z; itsObject=obj;}; |
---|
| 53 | ChanMap(const ChanMap& m); |
---|
| 54 | ChanMap& operator= (const ChanMap& m); |
---|
| 55 | virtual ~ChanMap(){}; |
---|
| 56 | |
---|
| 57 | /// @brief Define the ChanMap using a channel number and Object2D. |
---|
| 58 | void define(long z, Object2D obj){itsZ=z; itsObject=obj;}; |
---|
| 59 | |
---|
| 60 | /// @brief Return the value of the channel number. |
---|
| 61 | long getZ(){return itsZ;}; |
---|
| 62 | |
---|
| 63 | /// @brief Set the value of the channel number. |
---|
| 64 | void setZ(long l){itsZ=l;}; |
---|
| 65 | |
---|
| 66 | /// @brief Return the Object2D set of scans. |
---|
| 67 | Object2D getObject(){return itsObject;}; |
---|
| 68 | |
---|
| 69 | /// @brief Return the i-th scan of the Object2D . |
---|
| 70 | Scan getScan(int i){return itsObject.scanlist[i];}; |
---|
| 71 | |
---|
| 72 | /// @brief The number of scans in the Object2D set. |
---|
| 73 | long getNumScan(){return itsObject.scanlist.size();}; |
---|
| 74 | |
---|
| 75 | /// @brief Add constant offsets to each of the coordinates. |
---|
| 76 | void addOffsets(long xoff, long yoff, long zoff); |
---|
| 77 | |
---|
| 78 | /// @brief The less-than operator |
---|
| 79 | friend bool operator< (ChanMap lhs, ChanMap rhs); |
---|
| 80 | |
---|
| 81 | /// @brief Add two ChanMaps together. |
---|
| 82 | friend ChanMap operator+ (ChanMap lhs, ChanMap rhs); |
---|
| 83 | |
---|
| 84 | friend class Object3D; |
---|
| 85 | |
---|
| 86 | private: |
---|
| 87 | long itsZ; ///< The channel number. |
---|
| 88 | Object2D itsObject; ///< The set of scans of object pixels. |
---|
| 89 | |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | #endif // define CHANMAP_H |
---|