Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxIndxMatrix.h

00001 /*
00002  *  Copyright (c) 2000, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Jan-Mark Geusebroek (mark@wins.uva.nl)
00007  *
00008  */
00009 
00010 /*
00011  *  JV, 23May03: added at function for random access to matrix.
00012  */
00013 
00014 #ifndef HxIndxMatrix_H
00015 #define HxIndxMatrix_H
00016 
00017 #include "HxIndxArray.h"
00018 #include "HxMatrix.h"
00019 
00020 
00021 class IndxMatrixHeaderT {
00022     public:
00023         friend STD_OSTREAM& operator<<(STD_OSTREAM& os,
00024             const IndxMatrixHeaderT& l)
00025                 {return os << l.cols <<
00026                     ((l.cols == 1) ? HxString(" column, ") :
00027                         HxString(" columns, ")) << l.rows <<
00028                     ((l.rows == 1) ?  HxString(" row") :
00029                         HxString(" rows"));}
00030     int     cols;
00031     int     rows;
00032 };
00033 
00034 class indexedMatrix : public indexedArray<float, IndxMatrixHeaderT>  {
00035 public:
00036     void        add(HxString& key, HxMatrix& v); 
00037     void        search(HxMatrix& target, int n = 10);
00038 
00039     int         nElems() const;
00040     int         nCol() const;
00041     int         nRow() const;
00042 
00043                 /* Returns data for the ndx-th element. */
00044     HxMatrix    at(int ndx) const;
00045 
00046     friend STD_OSTREAM& operator<<(STD_OSTREAM& os,
00047         const indexedMatrix& l)
00048             {return l.put(os);}
00049 
00050     int         arraySize(const IndxMatrixHeaderT& header) const
00051                     {return header.rows*header.cols;}
00052 
00053     virtual double      compare(float *e1, float *e2,
00054                     const IndxMatrixHeaderT& header) const;
00055 
00056 private:
00057                 /* Converts the data to a matrix. */
00058     HxMatrix    makeMatrix(float* arr) const;
00059 };
00060 
00061 
00062 #endif

Generated on Tue Feb 3 14:18:38 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001