bioformats  5.1.6
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 <ome/bioformats/tiff/Util.h>
44 
45 #include <vector>
46 
47 namespace ome
48 {
49  namespace bioformats
50  {
51  namespace tiff
52  {
53 
54  class TIFF;
55  class IFD;
56 
57  }
58 
60  namespace in
61  {
62 
70  {
71  protected:
73  ome::compat::shared_ptr<ome::bioformats::tiff::TIFF> tiff;
74 
77 
78  public:
81 
84 
86  virtual
88 
89  protected:
90  // Documented in superclass.
91  void
92  initFile(const boost::filesystem::path& id);
93 
97  virtual
98  void
99  readIFDs();
100 
101  // Documented in superclass.
102  bool
103  isFilenameThisTypeImpl(const boost::filesystem::path& name) const;
104 
112  const ome::compat::shared_ptr<const tiff::IFD>
114 
115  public:
116  // Documented in superclass.
117  void
118  close(bool fileOnly = false);
119 
120  // Documented in superclass.
121  void
123  VariantPixelBuffer& buf) const;
124 
125  protected:
126  // Documented in superclass.
127  void
129  VariantPixelBuffer& buf,
133  dimension_size_type h) const;
134 
135  public:
143  ome::compat::shared_ptr<ome::bioformats::tiff::TIFF>
144  getTIFF();
145 
153  const ome::compat::shared_ptr<ome::bioformats::tiff::TIFF>
154  getTIFF() const;
155  };
156 
157  }
158  }
159 }
160 
161 #endif // OME_BIOFORMATS_IN_MINIMALTIFFREADER_H
162 
163 /*
164  * Local Variables:
165  * mode:C++
166  * End:
167  */
Interface for all biological file format readers (default behaviour).
Definition: FormatReader.h:107
Properties specific to a particular reader.
Definition: FormatReader.h:64
virtual ~MinimalTIFFReader()
Destructor.
Definition: MinimalTIFFReader.cpp:110
const ome::compat::shared_ptr< const tiff::IFD > ifdAtIndex(dimension_size_type plane) const
Get the IFD index for a plane in the current series.
Definition: MinimalTIFFReader.cpp:128
Basic TIFF reader.
Definition: MinimalTIFFReader.h:69
MinimalTIFFReader()
Constructor.
Definition: MinimalTIFFReader.cpp:94
void openBytesImpl(dimension_size_type plane, 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:245
void close(bool fileOnly=false)
Close the currently open file.
Definition: MinimalTIFFReader.cpp:137
void initFile(const boost::filesystem::path &id)
Initialize the given file.
Definition: MinimalTIFFReader.cpp:146
bool isFilenameThisTypeImpl(const boost::filesystem::path &name) const
isThisType file implementation for readers.
Definition: MinimalTIFFReader.cpp:122
const ReaderProperties & readerProperties
Reader properties specific to the derived file format.
Definition: FormatReader.h:115
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
dimension_size_type plane
The number of the current plane in the current series.
Definition: FormatReader.h:148
ome::compat::shared_ptr< ome::bioformats::tiff::TIFF > tiff
Underlying TIFF file.
Definition: MinimalTIFFReader.h:73
tiff::SeriesIFDRange seriesIFDRange
Mapping between series index and start and end IFD as a half-open range.
Definition: MinimalTIFFReader.h:76
std::vector< IFDRange > SeriesIFDRange
Mapping between series index and IFD range.
Definition: Util.h:104
Tagged Image File Format (TIFF).
Definition: TIFF.h:156
void getLookupTable(dimension_size_type plane, VariantPixelBuffer &buf) const
Get the color lookup table associated with an image plane.
Definition: MinimalTIFFReader.cpp:225
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
Image File Directory (IFD).
Definition: IFD.h:71
virtual void readIFDs()
Read metadata from IFDs.
Definition: MinimalTIFFReader.cpp:184
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:260