ome-files 0.2.2

CoreMetadata.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_COREMETADATA_H
39 #define OME_FILES_COREMETADATA_H
40
41 #include <map>
42 #include <numeric>
43 #include <string>
44 #include <vector>
45
46 #include <ome/compat/cstdint.h>
47
48 #include <ome/files/MetadataMap.h>
49 #include <ome/files/Modulo.h>
50 #include <ome/files/Types.h>
51
52 #include <ome/xml/meta/BaseMetadata.h>
53 #include <ome/xml/model/enums/DimensionOrder.h>
54 #include <ome/xml/model/enums/PixelType.h>
55
56 namespace ome
57 {
58 namespace files
59 {
60
78 class CoreMetadata
79 {
80 public:
82 dimension_size_type sizeX;
83
85 dimension_size_type sizeY;
86
88 dimension_size_type sizeZ;
89
91 std::vector<dimension_size_type> sizeC;
92
94 dimension_size_type sizeT;
95
97 dimension_size_type thumbSizeX;
98
100 dimension_size_type thumbSizeY;
101
103 ome::xml::model::enums::PixelType pixelType;
104
106 pixel_size_type bitsPerPixel;
107
109 dimension_size_type imageCount;
110
112 Modulo moduloZ;
113
115 Modulo moduloT;
116
118 Modulo moduloC;
119
121 ome::xml::model::enums::DimensionOrder dimensionOrder;
122
124 bool orderCertain;
125
127 bool littleEndian;
128
133 bool interleaved;
134
136 bool indexed;
137
139 bool falseColor;
140
142 bool metadataComplete;
143
145 MetadataMap seriesMetadata;
146
148 bool thumbnail;
149
156 dimension_size_type resolutionCount;
157
159 CoreMetadata();
160
166 CoreMetadata(const CoreMetadata& copy);
167
169 virtual
170 ~CoreMetadata();
171 };
172
180 template<class charT, class traits>
181 inline std::basic_ostream<charT,traits>&
182 operator<< (std::basic_ostream<charT,traits>& os,
183 const CoreMetadata& core)
184 {
185 os << "sizeX = " << core.sizeX << '\n'
186 << "sizeY = " << core.sizeY << '\n'
187 << "sizeZ = " << core.sizeZ << '\n'
188 << "sizeC = " << std::accumulate(core.sizeC.begin(), core.sizeC.end(), dimension_size_type(0));
189 if (core.sizeC.size() > 1U)
190 {
191 os << " [";
192 for (std::vector<dimension_size_type>::const_iterator i = core.sizeC.begin();
193 i != core.sizeC.end();
194 ++i)
195 {
196 os << *i;
197 if (i + 1 != core.sizeC.end())
198 os << ", ";
199 }
200 os << ']';
201 }
202 os << "\nsizeT = " << core.sizeT << '\n'
203 << "thumbSizeX = " << core.thumbSizeX << '\n'
204 << "thumbSizeY = " << core.thumbSizeY << '\n'
205 << "pixelType = " << core.pixelType << '\n'
206 << "bitsPerPixel = " << core.bitsPerPixel << '\n'
207 << "imageCount = " << core.imageCount << '\n'
208 << "moduloZ = {\n" << core.moduloZ
209 << "}\nmoduloT = {\n" << core.moduloT
210 << "}\nmoduloC = {\n" << core.moduloC
211 << "}\ndimensionOrder = " << core.dimensionOrder << '\n'
212 << "orderCertain = " << core.orderCertain << '\n';
213 os << "rgb = [";
214 for (std::vector<dimension_size_type>::const_iterator i = core.sizeC.begin();
215 i != core.sizeC.end();
216 ++i)
217 {
218 os << (*i > 1);
219 if (i + 1 != core.sizeC.end())
220 os << ", ";
221 }
222 os << ']';
223 os << "\nlittleEndian = " << core.littleEndian << '\n'
224 << "interleaved = " << core.interleaved << '\n'
225 << "indexed = " << core.indexed << '\n'
226 << "falseColor = " << core.falseColor << '\n'
227 << "metadataComplete = " << core.metadataComplete << '\n'
228 << "seriesMetadata = " << core.seriesMetadata.size() << " keys" << '\n'
229 << "thumbnail = " << core.thumbnail << '\n'
230 << "resolutionCount = " << core.resolutionCount << '\n';
231 return os;
232 }
233
234 }
235 }
236
237 #endif // OME_FILES_COREMETADATA_H
238
239 /*
240 * Local Variables:
241 * mode:C++
242 * End:
243 */
ome::files::CoreMetadata::metadataComplete
bool metadataComplete
Is all of the metadata stored within the file parsed correctly?
Definition: CoreMetadata.h:142
ome::files::CoreMetadata::seriesMetadata
MetadataMap seriesMetadata
Non-core metadata associated with this series.
Definition: CoreMetadata.h:145
ome::files::CoreMetadata::sizeT
dimension_size_type sizeT
Number of timepoints.
Definition: CoreMetadata.h:94
ome::files::pixel_size_type
uint32_t pixel_size_type
Size type for pixel bit depths.
Definition: Types.h:62
ome::files::CoreMetadata::moduloT
Modulo moduloT
Modulo T dimension.
Definition: CoreMetadata.h:115
ome::files::CoreMetadata::CoreMetadata
CoreMetadata()
Constructor.
Definition: CoreMetadata.cpp:45
ome::files::dimension_size_type
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
ome::files::CoreMetadata::orderCertain
bool orderCertain
Are we confident that the dimension order is correct?
Definition: CoreMetadata.h:124
ome::files::CoreMetadata::resolutionCount
dimension_size_type resolutionCount
Sub-resolution count.
Definition: CoreMetadata.h:156
ome::files::CoreMetadata::pixelType
ome::xml::model::enums::PixelType pixelType
Number of bytes per pixel.
Definition: CoreMetadata.h:103
ome::files::CoreMetadata::~CoreMetadata
virtual ~CoreMetadata()
Destructor.
Definition: CoreMetadata.cpp:100
ome::files::CoreMetadata::moduloC
Modulo moduloC
Modulo C dimension.
Definition: CoreMetadata.h:118
ome::files::MetadataMap
Metadata key-value map using a restricted set of value types.
Definition: MetadataMap.h:79
ome::files::CoreMetadata::imageCount
dimension_size_type imageCount
Total number of images.
Definition: CoreMetadata.h:109
ome::files::CoreMetadata::sizeX
dimension_size_type sizeX
Width (in pixels) of images in this series.
Definition: CoreMetadata.h:82
ome::xml::model::enums::DimensionOrder
ome::files::CoreMetadata::dimensionOrder
ome::xml::model::enums::DimensionOrder dimensionOrder
Order in which dimensions are stored.
Definition: CoreMetadata.h:121
ome
Open Microscopy Environment C++.
ome::files::CoreMetadata::thumbSizeY
dimension_size_type thumbSizeY
Height (in pixels) of thumbnail images in this series.
Definition: CoreMetadata.h:100
ome::files::CoreMetadata
Core metadata values.
Definition: CoreMetadata.h:78
ome::files::CoreMetadata::bitsPerPixel
pixel_size_type bitsPerPixel
Number of valid bits per pixel. */.
Definition: CoreMetadata.h:106
cstdint.h
ome::files::CoreMetadata::littleEndian
bool littleEndian
Is the pixel byte order little endian?
Definition: CoreMetadata.h:127
ome::files::CoreMetadata::indexed
bool indexed
Are images are stored as indexed color?
Definition: CoreMetadata.h:136
ome::files::CoreMetadata::thumbnail
bool thumbnail
Is this series is a lower-resolution copy of another series?
Definition: CoreMetadata.h:148
ome::xml::model::enums::PixelType
ome::files::CoreMetadata::sizeC
std::vector< dimension_size_type > sizeC
Number of channels.
Definition: CoreMetadata.h:91
ome::files::CoreMetadata::falseColor
bool falseColor
Can the color map (if present) be ignored?
Definition: CoreMetadata.h:139
ome::files::CoreMetadata::interleaved
bool interleaved
true if channels are stored RGBRGBRGB...; false if channels are stored RRR...GGG...BBB...
Definition: CoreMetadata.h:133
ome::files::CoreMetadata::sizeZ
dimension_size_type sizeZ
Number of Z sections.
Definition: CoreMetadata.h:88
ome::files::Modulo
A subdimension of Z, C, or T.
Definition: Modulo.h:57
ome::files::CoreMetadata::thumbSizeX
dimension_size_type thumbSizeX
Width (in pixels) of thumbnail images in this series.
Definition: CoreMetadata.h:97
ome::files::CoreMetadata::sizeY
dimension_size_type sizeY
Height (in pixels) of images in this series.
Definition: CoreMetadata.h:85
ome::files::CoreMetadata::moduloZ
Modulo moduloZ
Modulo Z dimension.
Definition: CoreMetadata.h:112