contrib/gel/gevd/gevd_xpixel.h
Go to the documentation of this file.
00001 // <begin copyright notice>
00002 // ---------------------------------------------------------------------------
00003 //
00004 //                   Copyright (c) 1997 TargetJr Consortium
00005 //               GE Corporate Research and Development (GE CRD)
00006 //                             1 Research Circle
00007 //                            Niskayuna, NY 12309
00008 //                            All Rights Reserved
00009 //              Reproduction rights limited as described below.
00010 //
00011 //      Permission to use, copy, modify, distribute, and sell this software
00012 //      and its documentation for any purpose is hereby granted without fee,
00013 //      provided that (i) the above copyright notice and this permission
00014 //      notice appear in all copies of the software and related documentation,
00015 //      (ii) the name TargetJr Consortium (represented by GE CRD), may not be
00016 //      used in any advertising or publicity relating to the software without
00017 //      the specific, prior written permission of GE CRD, and (iii) any
00018 //      modifications are clearly marked and summarized in a change history
00019 //      log.
00020 //
00021 //      THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
00022 //      EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
00023 //      WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00024 //      IN NO EVENT SHALL THE TARGETJR CONSORTIUM BE LIABLE FOR ANY SPECIAL,
00025 //      INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND OR ANY
00026 //      DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00027 //      WHETHER OR NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR ON
00028 //      ANY THEORY OF LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE
00029 //      USE OR PERFORMANCE OF THIS SOFTWARE.
00030 //
00031 // ---------------------------------------------------------------------------
00032 // <end copyright notice>
00033 #ifndef xpixel_h_
00034 #define xpixel_h_
00035 
00036 //:
00037 // \file
00038 
00039 #include <vnl/vnl_vector.h>
00040 #include "gevd_bufferxy.h"
00041 
00042 //: Get reference to pixel as a pointer to a vnl_vector<float>, at indexes (x, y).
00043 
00044 inline vnl_vector<float>*&
00045 fvectorPixel(gevd_bufferxy& buf, int x, int y)
00046 {
00047   return (*((vnl_vector<float>**) buf.GetElementAddr(x,y)));
00048 }
00049 
00050 inline vnl_vector<float>*
00051 fvectorPixel(const gevd_bufferxy& buf, int x, int y)
00052 {
00053   return (*((vnl_vector<float>*const *) buf.GetElementAddr(x,y)));
00054 }
00055 
00056 inline void freeFVectors(gevd_bufferxy& buf)
00057 {
00058   for (int x = 0; x < buf.GetSizeX(); x++)
00059     for (int y = 0; y < buf.GetSizeY(); y++)
00060       delete fvectorPixel(buf, x, y);
00061 }
00062 
00063 #endif // xpixel_h_