|
degate 0.1.1
|
00001 /* -*-c++-*- 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 any later version. 00011 00012 Degate is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #ifndef __IPNORMALIZE_H__ 00023 #define __IPNORMALIZE_H__ 00024 00025 #include <string> 00026 #include <ImageProcessorBase.h> 00027 #include <FilterKernel.h> 00028 00029 namespace degate { 00030 00031 /** 00032 * Processor: Normalize a single channel image. 00033 */ 00034 00035 template<typename ImageTypeIn, typename ImageTypeOut> 00036 class IPNormalize : public ImageProcessorBase { 00037 00038 private: 00039 double lower_bound; 00040 double upper_bound; 00041 00042 public: 00043 00044 /** 00045 * The constructor. 00046 */ 00047 00048 IPNormalize(double _lower_bound = 0, double _upper_bound = 1) : 00049 ImageProcessorBase("IPNormalize", 00050 "Normalize an image.", 00051 false, 00052 typeid(typename ImageTypeIn::pixel_type), 00053 typeid(typename ImageTypeOut::pixel_type)), 00054 lower_bound(_lower_bound), 00055 upper_bound(_upper_bound) { } 00056 00057 /** 00058 * The destructor. 00059 */ 00060 00061 virtual ~IPNormalize() {} 00062 00063 00064 virtual ImageBase_shptr run(ImageBase_shptr _in) { 00065 00066 assert(_in != NULL); 00067 00068 std::tr1::shared_ptr<ImageTypeIn> img_in = 00069 std::tr1::dynamic_pointer_cast<ImageTypeIn>(_in); 00070 00071 std::tr1::shared_ptr<ImageTypeOut> 00072 img_out(new ImageTypeOut(_in->get_width(), _in->get_height())); 00073 00074 assert(img_in != NULL); 00075 assert(img_out != NULL); 00076 00077 normalize<ImageTypeOut, ImageTypeIn>(img_out, img_in, lower_bound, upper_bound); 00078 00079 return img_out; 00080 } 00081 00082 00083 }; 00084 00085 } 00086 00087 #endif 00088
1.7.4