OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
map_io_tiff_handler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 #ifndef DX_IO_tiff_IO_PLUGIN_OST_HH
21 #define DX_IO_tiff_IO_PLUGIN_OST_HH
22 
23 /*
24  Authors: Ansgar Philippsen, Andreas Schenk
25 */
26 
27 #include <boost/logic/tribool.hpp>
28 
29 #include "map_io_handler.hh"
30 
31 
32 
33 struct tiff;
34 
35 namespace ost { namespace io {
36 
38 {
39 
40  public:
41 
42  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);
43 
44  Format GetBitDepth() const;
45  void SetBitDepth ( Format bitdepth);
46 
47  bool GetSigned () const;
48  void SetSigned (bool sign);
49 
50  bool GetPhasecolor () const;
51  void SetPhasecolor (bool phasecolor);
52 
53  Format GetFormat () const;
54  void SetFormat (Format bit_depth);
55 
56  boost::logic::tribool GetNormalizeOnSave() const;
57  void SetNormalizeOnSave(boost::logic::tribool normalize_on_save);
58 
59  int GetSubimage() const;
60  void SetSubimage(int subimage);
61 
62 
63  Real GetMaximum() const;
64  Real GetMinimum() const;
65 
67 
68 
69  protected:
70 
71  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);
72  void do_export(const img::MapHandle& image,tiff* tfile,const TIF& formattif) const;
73 
74  private:
75 
76  boost::logic::tribool normalize_on_save_;
77  Format bit_depth_;
78  bool signed_;
79  bool phasecolor_;
80  int subimage_;
81 
82 };
83 
84 
86 {
87  public:
91  virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc,
92  const ImageFormatBase& formatstruct);
93  virtual void Import(img::MapHandle& sh, std::istream& loc,
94  const ImageFormatBase& formatstruct);
95  virtual void Export(const img::MapHandle& sh,
96  const boost::filesystem::path& loc,
97  const ImageFormatBase& formatstruct) const;
98  virtual void Export(const img::MapHandle& sh, std::ostream& loc,
99  const ImageFormatBase& formatstruct) const;
100  static bool MatchContent(unsigned char* header);
101  static bool MatchType(const ImageFormatBase& type);
102  static bool MatchSuffix(const String& loc);
103  static bool ProvidesImport() { return true; }
104  static bool ProvidesExport() { return true; }
105  static String GetFormatName() { return String( "Tiff"); }
106  static String GetFormatDescription() { return String("Tagged Image File Format"); }
107 
108  protected:
109 
110  tiff* open_subimage_file(const boost::filesystem::path& location,
111  const TIF& formattif);
112  tiff* open_subimage_stream(std::istream& location,const TIF& formattif);
113  void load_image_data(tiff* tfile, img::ImageHandle& image,
114  const TIF& formattif);
115  virtual void do_export(const img::MapHandle& sh,tiff* tfile,
116  TIF& formatstruct) const;
117 
118 };
119 
121 
122 }} // ns
123 
124 #endif
std::string String
Definition: base.hh:54
float Real
Definition: base.hh:44
static String FORMAT_STRING
MapIOHandlerFactory< MapIOTiffHandler > MapIOTiffHandlerFactory
#define DLLEXPORT_OST_IO
Manage shared instances of images.