ome-files  0.5.0
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 <memory>
42 #include <string>
43 #include <vector>
44 
45 #include <boost/filesystem/path.hpp>
46 
47 #include <ome/files/CoreMetadata.h>
48 #include <ome/files/TileCoverage.h>
49 #include <ome/files/tiff/TileInfo.h>
50 #include <ome/files/tiff/Types.h>
51 #include <ome/files/VariantPixelBuffer.h>
52 
53 #include <ome/common/log.h>
54 
55 #include <ome/xml/model/enums/PixelType.h>
56 
57 namespace ome
58 {
59  namespace files
60  {
61  namespace tiff
62  {
63 
64  class TIFF;
65  class IFD;
66 
73  std::shared_ptr<CoreMetadata>
74  makeCoreMetadata(const IFD& ifd);
75 
82  void
83  getCoreMetadata(const IFD& ifd,
84  CoreMetadata& core);
85 
92  struct IFDRange
93  {
95  boost::filesystem::path filename;
100  };
101 
103  typedef std::vector<IFDRange> SeriesIFDRange;
104 
114  ifdIndex(const SeriesIFDRange& seriesIFDRange,
115  dimension_size_type series,
116  dimension_size_type plane);
117 
140  bool
141  enableBigTIFF(const boost::optional<bool>& wantBig,
143  const boost::filesystem::path& filename,
144  ome::common::Logger& logger);
145 
146  }
147  }
148 }
149 
150 #endif // OME_FILES_TIFF_UTIL_H
151 
152 /*
153  * Local Variables:
154  * mode:C++
155  * End:
156  */
logging::sources::severity_logger_mt< logging::trivial::severity_level > Logger
std::vector< IFDRange > SeriesIFDRange
Mapping between series index and IFD range.
Definition: Util.h:103
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
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:58
uint64_t storage_size_type
Size type for storage size.
Definition: Types.h:64
Range of IFDs for an image series.
Definition: Util.h:92
Open Microscopy Environment C++.
dimension_size_type end
End index.
Definition: Util.h:99
boost::filesystem::path filename
Filename of TIFF containing the IFDs.
Definition: Util.h:95
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
std::shared_ptr< CoreMetadata > makeCoreMetadata(const IFD &ifd)
Create CoreMetadata from an IFD.
Definition: Util.cpp:135
void getCoreMetadata(const IFD &ifd, CoreMetadata &core)
Get CoreMetadata from an IFD.
Definition: Util.cpp:143
dimension_size_type begin
Start index.
Definition: Util.h:97
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:1241