Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

nearestneighbor.cpp

Go to the documentation of this file.
00001 // $Id: nearestneighbor.cpp,v 1.3 2003/01/16 18:36:52 sarang Exp $
00002 //
00003 // OpenVL - A Library for working with volumetric datasets.
00004 //          http://openvl.sf.net
00005 //
00006 // Copyright (C) 2000-2003  Sarang Lakare <sarang#users.sf.net>
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems to openvl-devel@lists.sf.net or
00024 // at the OpenVL website.
00025 //
00026 
00027 #include <iostream>
00028 #include "vlinterpolator.h"
00029 #include "vlipolator_nneighbor.h"
00030 #include "vlgenericfactory.h"
00031 #include "nearestneighbor.h"
00032 
00033 typedef vlGenericFactory<vlInterpolatorNNPlugin> vlInterpolatorNNPluginFactory;
00034 VL_EXPORT_COMPONENT_FACTORY( nearestneighbor, vlInterpolatorNNPluginFactory );
00035 
00036 
00040 vlInterpolatorNNPlugin::vlInterpolatorNNPlugin()
00041   : m_interpolationType(vlInterpolation::NearestNeighbor)
00042 {
00043   infoRef().setVersion(0, 0, 1);
00044   infoRef().setName("NearestNeighbor");
00045   infoRef().setService("NearestNeighbor", "Nearest neighbor interpolation");
00046   infoRef().addAuthor("Sarang Lakare");
00047   infoRef().setCopyrightText("2000-2003 Sarang Lakare");
00048 
00049   m_supportedLayouts = vlLayout::supported();
00050   
00051 }
00052 
00053 
00057 vlInterpolatorNNPlugin::~vlInterpolatorNNPlugin()
00058 {
00059 
00060 }
00061 
00062 
00064 vlInterpolationType vlInterpolatorNNPlugin::interpolationType() const
00065 {
00066   return (m_interpolationType);
00067 }
00068 
00070 std::vector<vlLayoutType> vlInterpolatorNNPlugin::getSupportedLayouts() const
00071 {
00072   return (m_supportedLayouts);
00073 }
00074 
00075 vlInterpolatorSuperBase * vlInterpolatorNNPlugin::getNativeInterpolator(const vlDataType & datatype, const vlLayoutType type)
00076 {
00077   vlInterpolatorSuperBase * ret;
00078   callFunctionOnDataType(datatype, ret, getNativeInterpolatorT, type);
00079   return (ret);
00080 }
00081 
00082 template <typename DataType>
00083 vlInterpolatorSuperBase * vlInterpolatorNNPlugin::getNativeInterpolatorT(DataType & dummy, const vlLayoutType type)
00084 {
00085   vlInterpolatorSuperBase * ret;                               
00086   callFunctionOnLayoutWithDataTypeNoArgs(type, DataType, ret, getNativeInterpolatorTT);
00087   return (ret);
00088 }
00089 
00091 template <typename DataType, vlLayoutType Layout>
00092 vlInterpolatorSuperBase * vlInterpolatorNNPlugin::getNativeInterpolatorTT()
00093 {
00094   vlInterpolatorSuperBase * ptr = new vlInterpolatorNearestNeighbor<DataType, Layout>();
00095   return (ptr);
00096 }
00097 
00098 
00099 vlInterpolatorSuperBase * vlInterpolatorNNPlugin::getVirtualInterpolator(const vlDataType & datatype)
00100 {
00101   vlInterpolatorSuperBase * ret;
00102   callFunctionOnDataTypeNoArgs(datatype, ret, getVirtualInterpolatorT);
00103   return (ret);
00104 }
00105 
00107 template <typename DataType>
00108 vlInterpolatorSuperBase * vlInterpolatorNNPlugin::getVirtualInterpolatorT(DataType & dummy)
00109 {
00110   vlInterpolatorSuperBase * ptr = new vlInterpolatorNearestNeighbor<DataType, vlLayout::VirtualCall>();
00111   return (ptr);
00112 }
00113 
00114 
00115 

Generated on Fri Mar 18 11:33:13 2005 for OpenVL by doxygen 1.3.3