ome-files 0.1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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