source: branches/pixelmap-refactor-branch/src/PixelMap/Voxel.hh @ 1441

Last change on this file since 1441 was 528, checked in by MatthewWhiting, 15 years ago

Changing the documentation comments to match the askapsoft style. Also have split ChanMap? and Object3D into separate files.

File size: 3.9 KB
Line 
1// -----------------------------------------------------------------------
2// Voxel.hh: Definition of the Voxel class, storing a single 3D voxel
3//           plus an associated flux.
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 VOXEL_H
30#define VOXEL_H
31
32#include <iostream>
33
34namespace PixelInfo
35{
36  //==========================================================================
37
38  /// Voxel class.
39  ///  A 3-dimensional pixel, with x,y,z position + flux
40
41  class Voxel
42  {
43  public:
44    /// @brief Default constructor.
45    Voxel(){};
46    /// @brief Specific constructor, defining an (x,y,z) location and flux f.
47    Voxel(long x, long y, long z, float f);
48    /// @brief Copy constructor.
49    Voxel(const Voxel& v);
50    /// @brief Assignment operator.
51    Voxel& operator= (const Voxel& v);
52    virtual ~Voxel(){};
53
54    // accessor functions
55    void   setX(long x){itsX = x;};
56    void   setY(long y){itsY = y;};
57    void   setZ(long z){itsZ = z;};
58    void   setF(float f){itsF = f;};
59    /// @brief Define an (x,y) coordinate
60    void   setXY(long x, long y){itsX = x; itsY = y;};
61    /// @brief Define an (x,y,z) coordinate
62    void   setXYZ(long x, long y, long z){itsX = x; itsY = y; itsZ = z;};
63    /// @brief Define an (x,y) coordinate with a flux f
64    void   setXYF(long x, long y, float f){itsX = x; itsY = y; itsF = f;};
65    /// @brief Define an (x,y,z) coordinate with a flux f
66    void   setXYZF(long x, long y, long z, float f){itsX = x; itsY = y; itsZ = z; itsF = f;};
67    long   getX(){return itsX;};
68    long   getY(){return itsY;};
69    long   getZ(){return itsZ;};
70    float  getF(){return itsF;};
71   
72    /// @brief Return an index value for an array
73    long   arrayIndex(long *dim);
74
75    /// @brief Operator to print information of voxel.
76    friend std::ostream& operator<< ( std::ostream& theStream, Voxel& vox);
77
78    /// @brief Operator to test for equality.
79    friend bool operator== (Voxel lhs, Voxel rhs);
80   
81    /// @brief Function to test for equality of positions only.
82    bool match(Voxel other);
83   
84
85  protected:
86    long  itsX;         ///< x-position of pixel
87    long  itsY;         ///< y-position of pixel
88    long  itsZ;         ///< z-position of pixel
89    float itsF;         ///< flux of pixel
90  };
91
92  //==========================================================================
93
94  /// Pixel class.
95  ///  A 2-dimensional type of voxel, with just x & y position + flux
96
97  class Pixel : public Voxel
98  {
99  public:
100    Pixel(){itsZ=0;};
101    Pixel(long x, long y, float f);
102    Pixel(const Pixel& p);
103    Pixel& operator= (const Pixel& p);
104    virtual ~Pixel(){};
105    // accessor functions
106    void  setXY(long x, long y){itsX = x; itsY = y;};
107    void  setXYF(long x, long y, float f){itsX = x; itsY = y; itsF = f;};
108
109  };
110
111
112}
113
114#endif // VOXEL_H
Note: See TracBrowser for help on using the repository browser.