CSPadPixCoords/include/Image2D.h

Go to the documentation of this file.
00001 #ifndef CSPADPIXCOORDS_IMAGE2D_H
00002 #define CSPADPIXCOORDS_IMAGE2D_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: Image2D.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class Image2D.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 #include <string>
00017 //----------------------
00018 // Base Class Headers --
00019 //----------------------
00020 
00021 //-------------------------------
00022 // Collaborating Class Headers --
00023 //-------------------------------
00024 
00025 //------------------------------------
00026 // Collaborating Class Declarations --
00027 //------------------------------------
00028 
00029 //              ---------------------
00030 //              -- Class Interface --
00031 //              ---------------------
00032 
00033 namespace CSPadPixCoords {
00034 
00035 /// @addtogroup CSPadPixCoords
00036 
00037 /**
00038  *  @ingroup CSPadPixCoords
00039  *
00040  *  @brief Image2D class provides access to the 2D image data.
00041  *
00042  *  This software was developed for the LCLS project.  If you use all or 
00043  *  part of it, please give an appropriate acknowledgment.
00044  *
00045  *  @see CSPadImageProducer, PixCoordsTest
00046  *
00047  *  @version $Id: Image2D.h 8040 2014-04-19 01:00:36Z dubrovin@SLAC.STANFORD.EDU $
00048  *
00049  *  @author Mikhail S. Dubrovin
00050  */
00051 
00052 template <typename T>
00053 class Image2D  {
00054 public:
00055 
00056   // Default constructor
00057   Image2D () ;
00058 
00059   // Regular constructor
00060   /**
00061    *  @brief Stores the pointer to the 2D array containing image data and its sizes.
00062    *
00063    *  @param[in] data    Pointer to the 2D array of type T with image data.
00064    *  @param[in] nrows   Number of rows (1st index) in the 2D array.
00065    *  @param[in] ncols   Number of columns (2nd index) in the 2D array.   
00066    */
00067   Image2D (const T* data, size_t nrows, size_t ncols) ;
00068 
00069   // Destructor
00070   virtual ~Image2D () ;
00071 
00072   /**
00073    *  Methods of this class provide access to the 2D array and its 
00074    *  transformed versions after up-down, left-right flips, transpose, and
00075    *  rotations by n*90 degree.
00076    */
00077   T    getValue  (int row, int col);
00078   T    flipud    (int row, int col);
00079   T    fliplr    (int row, int col);
00080   T    transpose (int row, int col);
00081   T    rot000    (int row, int col);
00082   T    rot090    (int row, int col);
00083   T    rot180    (int row, int col);
00084   T    rot270    (int row, int col);
00085   T    rotN90    (int row, int col, int Nx90=0);
00086 
00087   /**
00088    *  @brief Returns the number of columns after rotations by n*90 degree.
00089    */
00090   size_t getNCols       (int Nx90=0);
00091 
00092   /**
00093    *  @brief Returns the number of rows after rotations by n*90 degree.
00094    */
00095   size_t getNRows       (int Nx90=0);
00096 
00097   /**
00098    *  @brief Returns pointer to data array
00099    */
00100   const T* data() { return m_data; }
00101 
00102   void printImage       (int Nx90=0);
00103   void printEntireImage (int Nx90=0);
00104   void saveImageInFile  (const std::string &fname, int Nx90=0);
00105 
00106 
00107 private:
00108 
00109   // Copy constructor and assignment are disabled by default
00110   Image2D ( const Image2D& ) ;
00111   Image2D operator = ( const Image2D& ) ;
00112 
00113 //------------------
00114 // Static Members --
00115 //------------------
00116 
00117   // Data members
00118   const T* m_data;
00119   size_t   m_nrows;
00120   size_t   m_ncols;
00121   size_t   m_nrows_transposed;
00122   size_t   m_ncols_transposed;
00123 };
00124 
00125 } // namespace CSPadPixCoords
00126 
00127 #endif // CSPADPIXCOORDS_IMAGE2D_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7