00001 /*!@file Raster/RasterFileFormat.C file formats supported by Raster */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Raster/RasterFileFormat.C $ 00035 // $Id: RasterFileFormat.C 9203 2008-02-01 18:17:14Z rjpeters $ 00036 // 00037 00038 #include "Raster/RasterFileFormat.H" 00039 00040 #include "Util/StringConversions.H" 00041 #include "Util/log.H" 00042 00043 // ###################################################################### 00044 // converters for RasterFileFormat 00045 // ###################################################################### 00046 00047 std::string convertToString(const RasterFileFormat val) 00048 { 00049 switch (val) 00050 { 00051 case RASFMT_PNM: return "PNM"; 00052 case RASFMT_PNG: return "PNG"; 00053 case RASFMT_PFM: return "PFM"; 00054 case RASFMT_PFZ: return "PFZ"; 00055 case RASFMT_RAW_VIDEO: return "RAWVIDEO"; 00056 case RASFMT_RAW_IMAGE: return "RAWIMAGE"; 00057 case RASFMT_JPEG: return "JPEG"; 00058 case RASFMT_TXT: return "TXT"; 00059 case RASFMT_CCODE: return "CCODE"; 00060 case RASFMT_DPX: return "DPX"; 00061 case RASFMT_AUTO: return "Auto"; 00062 } 00063 LFATAL("invalid RasterFileFormat value (%d)", int(val)); 00064 /* can't happen */ return std::string(); 00065 } 00066 00067 void convertFromString(const std::string& str, RasterFileFormat& val) 00068 { 00069 if (str.compare("PNM") == 0) { val = RASFMT_PNM; } 00070 else if (str.compare("PNG") == 0) { val = RASFMT_PNG; } 00071 else if (str.compare("PFM") == 0) { val = RASFMT_PFM; } 00072 else if (str.compare("PFZ") == 0) { val = RASFMT_PFZ; } 00073 else if (str.compare("RAWVIDEO") == 0) { val = RASFMT_RAW_VIDEO; } 00074 else if (str.compare("RAWIMAGE") == 0) { val = RASFMT_RAW_IMAGE; } 00075 else if (str.compare("JPEG") == 0) { val = RASFMT_JPEG; } 00076 else if (str.compare("TXT") == 0) { val = RASFMT_TXT; } 00077 else if (str.compare("CCODE") == 0) { val = RASFMT_CCODE; } 00078 else if (str.compare("DPX") == 0) { val = RASFMT_DPX; } 00079 else if (str.compare("Auto") == 0) { val = RASFMT_AUTO; } 00080 else 00081 conversion_error::raise<RasterFileFormat>(str); 00082 }