bioformats  5.1.0
MinimalTIFFReader.h
1 /*
2  * #%L
3  * OME-BIOFORMATS C++ library for image IO.
4  * Copyright © 2006 - 2015 Open Microscopy Environment:
5  * - Massachusetts Institute of Technology
6  * - National Institutes of Health
7  * - University of Dundee
8  * - Board of Regents of the University of Wisconsin-Madison
9  * - Glencoe Software, Inc.
10  * %%
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * The views and conclusions contained in the software and documentation are
33  * those of the authors and should not be interpreted as representing official
34  * policies, either expressed or implied, of any organization.
35  * #L%
36  */
37 
38 #ifndef OME_BIOFORMATS_IN_MINIMALTIFFREADER_H
39 #define OME_BIOFORMATS_IN_MINIMALTIFFREADER_H
40 
41 #include <ome/bioformats/detail/FormatReader.h>
42 
43 #include <vector>
44 
45 namespace ome
46 {
47  namespace bioformats
48  {
49  namespace tiff
50  {
51 
52  class TIFF;
53  class IFD;
54 
55  }
56 
58  namespace in
59  {
60 
68  {
69  protected:
71  typedef std::vector<std::pair<dimension_size_type, dimension_size_type> > series_ifd_map_type;
72 
74  ome::compat::shared_ptr<ome::bioformats::tiff::TIFF> tiff;
75 
77  series_ifd_map_type series_ifd_map;
78 
79  public:
82 
85 
87  virtual
89 
90  protected:
91  // Documented in superclass.
92  void
93  initFile(const boost::filesystem::path& id);
94 
98  virtual
99  void
100  readIFDs();
101 
102  // Documented in superclass.
103  bool
104  isFilenameThisTypeImpl(const boost::filesystem::path& name) const;
105 
113  const ome::compat::shared_ptr<const tiff::IFD>
115 
116  public:
117  // Documented in superclass.
118  void
119  close(bool fileOnly = false);
120 
121  // Documented in superclass.
122  void
124  dimension_size_type no) const;
125 
126  protected:
127  // Documented in superclass.
128  void
130  VariantPixelBuffer& buf,
134  dimension_size_type h) const;
135 
136  public:
144  ome::compat::shared_ptr<ome::bioformats::tiff::TIFF>
145  getTIFF();
146 
154  const ome::compat::shared_ptr<ome::bioformats::tiff::TIFF>
155  getTIFF() const;
156  };
157 
158  }
159  }
160 }
161 
162 #endif // OME_BIOFORMATS_IN_MINIMALTIFFREADER_H
163 
164 /*
165  * Local Variables:
166  * mode:C++
167  * End:
168  */
Interface for all biological file format readers (default behaviour).
Definition: FormatReader.h:109
void openBytesImpl(dimension_size_type no, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const
Obtain a sub-image of an image plane.
Definition: MinimalTIFFReader.cpp:252
Properties specific to a particular reader.
Definition: FormatReader.h:66
virtual ~MinimalTIFFReader()
Destructor.
Definition: MinimalTIFFReader.cpp:106
Basic TIFF reader.
Definition: MinimalTIFFReader.h:67
std::vector< std::pair< dimension_size_type, dimension_size_type > > series_ifd_map_type
Mapping between series index and start and end IFD as a half-open range.
Definition: MinimalTIFFReader.h:71
MinimalTIFFReader()
Constructor.
Definition: MinimalTIFFReader.cpp:90
void close(bool fileOnly=false)
Close the currently open file.
Definition: MinimalTIFFReader.cpp:150
void initFile(const boost::filesystem::path &id)
Initialize the given file.
Definition: MinimalTIFFReader.cpp:159
void getLookupTable(VariantPixelBuffer &buf, dimension_size_type no) const
Get the color lookup table associated with an image plane.
Definition: MinimalTIFFReader.cpp:232
bool isFilenameThisTypeImpl(const boost::filesystem::path &name) const
isThisType file implementation for readers.
Definition: MinimalTIFFReader.cpp:111
const ReaderProperties & readerProperties
Reader properties specific to the derived file format.
Definition: FormatReader.h:117
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
ome::compat::shared_ptr< ome::bioformats::tiff::TIFF > tiff
Underlying TIFF file.
Definition: MinimalTIFFReader.h:74
Tagged Image File Format (TIFF).
Definition: TIFF.h:156
const ome::compat::shared_ptr< const tiff::IFD > ifdAtIndex(dimension_size_type no) const
Get the IFD index for a plane in the current series.
Definition: MinimalTIFFReader.cpp:117
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:72
Image File Directory (IFD).
Definition: IFD.h:71
virtual void readIFDs()
Read metadata from IFDs.
Definition: MinimalTIFFReader.cpp:197
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
ome::compat::shared_ptr< ome::bioformats::tiff::TIFF > getTIFF()
Get open TIFF file.
Definition: MinimalTIFFReader.cpp:278
series_ifd_map_type series_ifd_map
Mapping between series index and start and end IFD as a half-open range.
Definition: MinimalTIFFReader.h:77