00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // Copyright (C) 2003-2010 by the IPLT authors 00006 // 00007 // This library is free software; you can redistribute it and/or modify it under 00008 // the terms of the GNU Lesser General Public License as published by the Free 00009 // Software Foundation; either version 3.0 of the License, or (at your option) 00010 // any later version. 00011 // This library is distributed in the hope that it will be useful, but WITHOUT 00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00014 // details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with this library; if not, write to the Free Software Foundation, Inc., 00018 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 //------------------------------------------------------------------------------ 00020 00021 /* 00022 ImageFormat 00023 00024 Author: Andreas Schenk 00025 */ 00026 00027 #ifndef IMG_IMAGE_FORMAT_H 00028 #define IMG_IMAGE_FORMAT_H 00029 00030 #include <ost/img/data_types.hh> 00031 #include <ost/base.hh> 00032 #include <ost/io/convert.hh> 00033 #include <ost/io/module_config.hh> 00034 00035 namespace ost { namespace io { 00036 00037 class DLLEXPORT_OST_IO ImageFormatBase 00038 { 00039 protected: 00040 00041 ImageFormatBase(): 00042 format_string_("") 00043 {}; 00044 00045 ImageFormatBase(const String& formatstring): 00046 format_string_(formatstring) 00047 {}; 00048 00049 public: 00050 00051 Real GetMaximum() const { return 1.0;} 00052 Real GetMinimum() const { return 0.0;} 00053 00054 00055 template <typename T> 00056 const T& As() const 00057 { 00058 return reinterpret_cast<const T&>(*this); 00059 } 00060 String GetFormatString() const {return format_string_;} 00061 00062 private: 00063 00064 String format_string_; 00065 00066 }; 00067 00068 enum Format 00069 { 00070 OST_BIT8_FORMAT,OST_BIT16_FORMAT,OST_BIT32_FORMAT,OST_FLOAT_FORMAT,OST_DOUBLE_FORMAT,OST_DEFAULT_FORMAT 00071 }; 00072 00073 enum Subformat { 00074 MRC_OLD_FORMAT,MRC_NEW_FORMAT,MRC_AUTO_FORMAT 00075 }; 00076 00077 00078 00079 class DLLEXPORT_OST_IO UndefinedImageFormat : public ImageFormatBase 00080 { 00081 public: 00082 UndefinedImageFormat(): 00083 ImageFormatBase(FORMAT_STRING) 00084 {} 00085 00086 static String FORMAT_STRING; 00087 00088 }; 00089 00090 00091 }} // namespaces 00092 00093 #endif