00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DX_IO_tiff_IO_PLUGIN_OST_HH
00021 #define DX_IO_tiff_IO_PLUGIN_OST_HH
00022
00023
00024
00025
00026
00027 #include <boost/logic/tribool.hpp>
00028
00029 #include "map_io_handler.hh"
00030
00031
00032
00033 struct tiff;
00034
00035 namespace ost { namespace io {
00036
00037 class DLLEXPORT_OST_IO TIF: public ImageFormatBase
00038 {
00039
00040 public:
00041
00042 TIF(boost::logic::tribool normalize_on_save = boost::logic::indeterminate, Format bit_depth = OST_DEFAULT_FORMAT, bool sign = false, bool phasecolor = false, int subimage = -1);
00043
00044 Format GetBitDepth() const;
00045 void SetBitDepth ( Format bitdepth);
00046
00047 bool GetSigned () const;
00048 void SetSigned (bool sign);
00049
00050 bool GetPhasecolor () const;
00051 void SetPhasecolor (bool phasecolor);
00052
00053 Format GetFormat () const;
00054 void SetFormat (Format bit_depth);
00055
00056 boost::logic::tribool GetNormalizeOnSave() const;
00057 void SetNormalizeOnSave(boost::logic::tribool normalize_on_save);
00058
00059 int GetSubimage() const;
00060 void SetSubimage(int subimage);
00061
00062
00063 Real GetMaximum() const;
00064 Real GetMinimum() const;
00065
00066 static String FORMAT_STRING;
00067
00068
00069 protected:
00070
00071 TIF(String format_string, boost::logic::tribool normalize_on_save = boost::logic::indeterminate, Format bit_depth = OST_DEFAULT_FORMAT, bool sign = false, bool phasecolor = false, int subimage = -1);
00072 void do_export(const img::MapHandle& image,tiff* tfile,const TIF& formattif) const;
00073
00074 private:
00075
00076 boost::logic::tribool normalize_on_save_;
00077 Format bit_depth_;
00078 bool signed_;
00079 bool phasecolor_;
00080 int subimage_;
00081
00082 };
00083
00084
00085 class DLLEXPORT_OST_IO MapIOTiffHandler: public MapIOHandler
00086 {
00087 public:
00091 virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,
00092 const ImageFormatBase& formatstruct);
00093 virtual void Import(img::MapHandle& sh, std::istream& loc,
00094 const ImageFormatBase& formatstruct);
00095 virtual void Export(const img::MapHandle& sh,
00096 const boost::filesystem::path& loc,
00097 const ImageFormatBase& formatstruct) const;
00098 virtual void Export(const img::MapHandle& sh, std::ostream& loc,
00099 const ImageFormatBase& formatstruct) const;
00100 static bool MatchContent(unsigned char* header);
00101 static bool MatchType(const ImageFormatBase& type);
00102 static bool MatchSuffix(const String& loc);
00103 static bool ProvidesImport() { return true; }
00104 static bool ProvidesExport() { return true; }
00105 static String GetFormatName() { return String( "Tiff"); }
00106 static String GetFormatDescription() { return String("Tagged Image File Format"); }
00107
00108 protected:
00109
00110 tiff* open_subimage_file(const boost::filesystem::path& location,
00111 const TIF& formattif);
00112 tiff* open_subimage_stream(std::istream& location,const TIF& formattif);
00113 void load_image_data(tiff* tfile, img::ImageHandle& image,
00114 const TIF& formattif);
00115 virtual void do_export(const img::MapHandle& sh,tiff* tfile,
00116 TIF& formatstruct) const;
00117
00118 };
00119
00120 typedef MapIOHandlerFactory<MapIOTiffHandler> MapIOTiffHandlerFactory;
00121
00122 }}
00123
00124 #endif