ome-files 0.2.2

Util.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_TIFF_UTIL_H
39 #define OME_FILES_TIFF_UTIL_H
40
41 #include <string>
42 #include <vector>
43
44 #include <boost/filesystem/path.hpp>
45
46 #include <ome/compat/memory.h>
47
48 #include <ome/files/CoreMetadata.h>
49 #include <ome/files/TileCoverage.h>
50 #include <ome/files/tiff/TileInfo.h>
51 #include <ome/files/tiff/Types.h>
52 #include <ome/files/VariantPixelBuffer.h>
53
54 #include <ome/common/log.h>
55
56 #include <ome/xml/model/enums/PixelType.h>
57
58 namespace ome
59 {
60 namespace files
61 {
62 namespace tiff
63 {
64
65 class TIFF;
66 class IFD;
67
74 ome::compat::shared_ptr<CoreMetadata>
75 makeCoreMetadata(const IFD& ifd);
76
83 void
84 getCoreMetadata(const IFD& ifd,
85 CoreMetadata& core);
86
93 struct IFDRange
94 {
96 boost::filesystem::path filename;
98 dimension_size_type begin;
100 dimension_size_type end;
101 };
102
104 typedef std::vector<IFDRange> SeriesIFDRange;
105
114 dimension_size_type
115 ifdIndex(const SeriesIFDRange& seriesIFDRange,
116 dimension_size_type series,
117 dimension_size_type plane);
118
141 bool
142 enableBigTIFF(const boost::optional<bool>& wantBig,
143 storage_size_type pixelSize,
144 const boost::filesystem::path& filename,
145 ome::common::Logger& logger);
146
147 }
148 }
149 }
150
151 #endif // OME_FILES_TIFF_UTIL_H
152
153 /*
154 * Local Variables:
155 * mode:C++
156 * End:
157 */
ome::common::Logger
logging::sources::severity_logger_mt< logging::trivial::severity_level > Logger
ome::files::tiff::SeriesIFDRange
std::vector< IFDRange > SeriesIFDRange
Mapping between series index and IFD range.
Definition: Util.h:104
ome::files::tiff::ifdIndex
dimension_size_type ifdIndex(const SeriesIFDRange &seriesIFDRange, dimension_size_type series, dimension_size_type plane)
Compute IFD index from IFD map and plane index.
Definition: Util.cpp:363
ome::files::dimension_size_type
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
ome::files::storage_size_type
uint64_t storage_size_type
Size type for storage size.
Definition: Types.h:65
ome::files::tiff::IFDRange
Range of IFDs for an image series.
Definition: Util.h:93
ome
Open Microscopy Environment C++.
ome::files::tiff::IFDRange::end
dimension_size_type end
End index.
Definition: Util.h:100
memory.h
ome::files::tiff::IFDRange::filename
boost::filesystem::path filename
Filename of TIFF containing the IFDs.
Definition: Util.h:96
ome::files::tiff::enableBigTIFF
bool enableBigTIFF(const boost::optional< bool > &wantBig, storage_size_type pixelSize, const boost::filesystem::path &filename, ome::common::Logger &logger)
Check if BigTIFF should be enabled.
Definition: Util.cpp:390
ome::files::tiff::getCoreMetadata
void getCoreMetadata(const IFD &ifd, CoreMetadata &core)
Get CoreMetadata from an IFD.
Definition: Util.cpp:143
ome::files::tiff::makeCoreMetadata
ome::compat::shared_ptr< CoreMetadata > makeCoreMetadata(const IFD &ifd)
Create CoreMetadata from an IFD.
Definition: Util.cpp:135
log.h
ome::files::tiff::IFDRange::begin
dimension_size_type begin
Start index.
Definition: Util.h:98
ome::files::pixelSize
storage_size_type pixelSize(const ::ome::xml::meta::MetadataRetrieve &meta, dimension_size_type series)
Get the total size of pixel data in a series.
Definition: MetadataTools.cpp:1250