arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

nrroKernel.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     4-1-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 //nrroKernel.h
00019 
00020 #ifndef __NRRO_KERNEL_DOT_H
00021 #define __NRRO_KERNEL_DOT_H
00022 
00023 #include <gage.h>
00024 
00025 ///////////////////////////////////////////////////////////////////////////
00026 ///////////////////////////////////////////////////////////////////////////
00027 ///                      Kernels
00028 ///////////////////////////////////////////////////////////////////////////
00029 ///////////////////////////////////////////////////////////////////////////
00030 
00031 /////////////////////////////////////////////////////////////////////
00032 /// forward decl of kernel obj, defined below
00033 /////////////////////////////////////////////////////////////////////
00034 class NrroKernel;
00035 class Nrro;
00036 
00037 /////////////////////////////////////////////////////////////////////
00038 /// usefull predefined kernels
00039 /////////////////////////////////////////////////////////////////////
00040 
00041 extern const NrroKernel BoxKernel;
00042 extern const NrroKernel TentKernel;
00043 extern const NrroKernel CatmulRomKernel;
00044 extern const NrroKernel BSplineKernel;
00045 
00046 ///////////////////////////////////////////////////////////////////////////
00047 /// Kernel object
00048 ///////////////////////////////////////////////////////////////////////////
00049 
00050 class NrroKernel
00051 {
00052 public:
00053    enum PARAMETERS {
00054       MAX_PARMS = NRRD_KERNEL_PARMS_NUM
00055    };
00056 
00057    //////////////////////////////////////////////////////
00058    /// defaults to catmul-rom: value
00059    ///  params must be 0 or MAX_PARMS in size
00060    NrroKernel(int kind = Cubic, const double *params = 0);
00061    /// copy
00062    NrroKernel(const NrroKernel &nk);
00063    virtual ~NrroKernel();
00064 
00065    /// assignment
00066    void operator=(const NrroKernel &nk);
00067 
00068    /// comparisons
00069    bool operator==(const NrroKernel &nk) const;
00070    bool operator!=(const NrroKernel &nk) const 
00071    { return !((*this) == nk); }
00072 
00073    enum{ //kinds of kernels supported
00074       Kernel_Unknown,
00075 
00076       Box,       
00077       Tent,      
00078       Cubic,   
00079       Quartic,  
00080       Gaussian,
00081 
00082       Kernel_Last
00083    };
00084 
00085    enum{ //type of kernel used
00086       TYPE_UNKNOWN,
00087 
00088       VALUE,    //value
00089       DERIV,    //1st derivative
00090       DERIV2,   //2nd derivative
00091 
00092       TYPE_LAST
00093    };
00094 
00095    //////////////////////////////////////
00096    /// these are for interactions between
00097    /// NrroProbe and Nrrd stuff, users
00098    ///  need not worry about these
00099    int           getGageKernelType(int type = VALUE) const;
00100    NrrdKernel   *getNrrdKernel(int type = VALUE) const;
00101    const double *getParams(int type = VALUE) const;
00102 
00103 
00104    //////////////////////////////////////
00105    /// what kind of kernel is this?
00106    int  getKind() const      {return _kind;}
00107    //////////////////////////////////////
00108    /// want to make it something else?
00109    void setKind(int kind);
00110 
00111 
00112 protected:
00113 
00114    int    _kind;
00115    double _params[MAX_PARMS];
00116    double _spareParams[MAX_PARMS];
00117 };
00118 
00119 /////////////////////////////////////////////////////////////////////
00120 /// some implementation
00121 /////////////////////////////////////////////////////////////////////
00122 inline
00123 bool NrroKernel::operator==(const NrroKernel &nk) const
00124 {
00125    if(_kind != nk._kind) return false;
00126    for(int i=0; i<MAX_PARMS; ++i)
00127    {
00128       if(_params[i] != nk._params[i]) return false;
00129       if(_spareParams[i] != nk._spareParams[i]) return false;
00130    }
00131    return true;
00132 }
00133 
00134 
00135 
00136 #endif
00137 
00138 

Send questions, comments, and bug reports to:
jmk