latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*---------------------------------------------------------------- 00025 * project ....: LTI Digital Image/Signal Processing Library 00026 * file .......: ltiExternViewer.h 00027 * authors ....: Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 21.07.99 00030 * revisions ..: $Id: ltiExternViewer.h,v 1.6 2006/02/08 12:55:52 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_EXTERNVIEWER_H_ 00034 #define _LTI_EXTERNVIEWER_H_ 00035 00036 #include "ltiImage.h" 00037 #include "ltiViewerBase.h" 00038 #include <string> 00039 #include <list> 00040 00041 namespace lti { 00042 /** 00043 * This object shows an image using an external application like 00044 * kview, xv, mspaint, etc. 00045 * 00046 * Use the externViewer::parameters to specify which application 00047 * should be used. 00048 * 00049 * A temporal image file will be created to transfer the image data 00050 * to the external application. If you need a faster viewer, use 00051 * the lti::viewer instead! 00052 * 00053 * The default viewer used in Linux is the kview and in Windows the 00054 * mspaint. Make sure that these programs are included in one of 00055 * the directories specified by the system variable PATH. 00056 */ 00057 class externViewer : public viewerBase { 00058 00059 public: 00060 00061 /** 00062 * parameters for the externViewer-object 00063 */ 00064 class parameters : public viewerBase::parameters { 00065 public: 00066 /** 00067 * default constructor 00068 */ 00069 parameters(); 00070 00071 /** 00072 * copy constructor 00073 */ 00074 parameters(const parameters& other); 00075 00076 /** 00077 * destructor 00078 */ 00079 virtual ~parameters(); 00080 00081 /** 00082 * copy member 00083 */ 00084 parameters& copy(const parameters& other); 00085 00086 /** 00087 * copy data of "other" parameters 00088 */ 00089 parameters& operator=(const parameters& other); 00090 00091 /** 00092 * returns a pointer to a clone of the parameters 00093 */ 00094 virtual functor::parameters* clone() const; 00095 00096 /** 00097 * returns name of this type 00098 */ 00099 const char* getTypeName() const; 00100 00101 /** 00102 * write the parameters in the given ioHandler 00103 * @param handler the ioHandler to be used 00104 * @param complete if true (the default) the enclosing begin/end will 00105 * be also written, otherwise only the data block will be written. 00106 * @return true if write was successful 00107 */ 00108 virtual bool write(ioHandler& handler, 00109 const bool complete=true) const; 00110 00111 /** 00112 * read the parameters from the given ioHandler 00113 * @param handler the ioHandler to be used 00114 * @param complete if true (the default) the enclosing begin/end will 00115 * be also written, otherwise only the data block will be written. 00116 * @return true if write was successful 00117 */ 00118 virtual bool read(ioHandler& handler,const bool complete=true); 00119 00120 # ifdef _LTI_MSC_6 00121 /** 00122 * this function is required by MSVC only, as a workaround for a 00123 * very awful bug, which exists since MSVC V.4.0, and still by 00124 * V.6.0 with all bugfixes (so called "service packs") remains 00125 * there... This method is public due to another bug!, so please 00126 * NEVER EVER call this method directly 00127 */ 00128 bool readMS(ioHandler& handler,const bool complete=true); 00129 00130 /** 00131 * this function is required by MSVC only, as a workaround for a 00132 * very awful bug, which exists since MSVC V.4.0, and still by 00133 * V.6.0 with all bugfixes (so called "service packs") remains 00134 * there... This method is public due to another bug!, so please 00135 * NEVER EVER call this method directly 00136 */ 00137 bool writeMS(ioHandler& handler,const bool complete=true) const; 00138 # endif 00139 00140 // ------------------------ 00141 // the parameters 00142 // ------------------------ 00143 00144 /** 00145 * directory name, which holds the temporary image files. 00146 * 00147 * Default directory: /tmp in Linux and C:\\TEMP in Windows 00148 */ 00149 std::string tmpDirectory; 00150 00151 /** 00152 * name of the external application. 00153 * 00154 * Default application: kview in Linux and MSPaint in Windows 00155 */ 00156 std::string externViewerApp; 00157 }; 00158 00159 // -------------------------------------------------- 00160 // externViewer 00161 // -------------------------------------------------- 00162 00163 /** 00164 * default constructor 00165 */ 00166 externViewer(); 00167 00168 /** 00169 * default constructor 00170 */ 00171 externViewer(const externViewer& other); 00172 00173 /** 00174 * default destructor 00175 */ 00176 ~externViewer(); 00177 00178 /** 00179 * returns the name of this type ("externViewer") 00180 */ 00181 virtual const char* getTypeName() const; 00182 00183 /** 00184 * shows an lti::image 00185 * @param data the object to be shown. 00186 * @return true if successful, false otherwise. 00187 */ 00188 bool show(const image& data); 00189 00190 /** 00191 * shows a 8-bit channel 00192 * @param data the object to be shown. 00193 * @return true if successful, false otherwise. 00194 */ 00195 virtual bool show(const channel8& data); 00196 00197 /** 00198 * shows a channel 00199 * @param data the object to be shown. 00200 * @return true if successful, false otherwise. 00201 */ 00202 virtual bool show(const channel& data); 00203 00204 /** 00205 * shows a channel or matrix of float 00206 * @param data the object to be shown. 00207 * @return true if successful, false otherwise. 00208 */ 00209 virtual bool show(const matrix<float>& data); 00210 00211 /** 00212 * shows a vector of double 00213 * @param data the object to be shown. 00214 * @return true if successful, false otherwise. 00215 */ 00216 virtual bool show(const vector<double>& data); 00217 00218 /** 00219 * shows a vector of double 00220 * @param data the object to be shown. 00221 * @return true if successful, false otherwise. 00222 */ 00223 virtual bool show(const vector<float>& data); 00224 00225 /** 00226 * shows a vector of double 00227 * @param data the object to be shown. 00228 * @return true if successful, false otherwise. 00229 */ 00230 virtual bool show(const vector<int>& data); 00231 00232 /** 00233 * shows a matrix of doubles as a channel 00234 * @param data the object to be shown. 00235 * @return true if successful, false otherwise. 00236 */ 00237 virtual bool show(const matrix<double>& data); 00238 00239 /** 00240 * shows a matrix of integers as a channel 00241 * @param data the object to be shown. 00242 * @return true if successful, false otherwise. 00243 */ 00244 virtual bool show(const matrix<int>& data); 00245 00246 /** 00247 * hides the display window 00248 * @return true if successful, false otherwise. 00249 */ 00250 virtual bool hide(); 00251 00252 /** 00253 * returns a pointer to a clone of the functor. 00254 */ 00255 virtual viewerBase* clone() const; 00256 00257 /** 00258 * copy data of "other" functor. 00259 */ 00260 externViewer& copy(const externViewer& other); 00261 00262 /** 00263 * copy data of "other" functor. 00264 */ 00265 externViewer& operator=(const externViewer& other); 00266 00267 /** 00268 * returns the give parameters 00269 */ 00270 const parameters& getParameters() const; 00271 00272 protected: 00273 /** 00274 * how many times has 'show' been used? 00275 */ 00276 static int numberShows; 00277 }; // class externViewer 00278 00279 00280 } // namespace lti 00281 00282 #endif // _LTI_EXTERNVIEWER_H