ome-files  0.1.1
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 
79  {
80  public:
83 
86 
89 
91  std::vector<dimension_size_type> sizeC;
92 
95 
98 
101 
104 
107 
110 
113 
116 
119 
122 
125 
128 
134 
136  bool indexed;
137 
140 
143 
146 
148  bool thumbnail;
149 
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  */
bool metadataComplete
Is all of the metadata stored within the file parsed correctly?
Definition: CoreMetadata.h:142
MetadataMap seriesMetadata
Non-core metadata associated with this series.
Definition: CoreMetadata.h:145
dimension_size_type sizeT
Number of timepoints.
Definition: CoreMetadata.h:94
uint32_t pixel_size_type
Size type for pixel bit depths.
Definition: Types.h:62
Modulo moduloT
Modulo T dimension.
Definition: CoreMetadata.h:115
CoreMetadata()
Constructor.
Definition: CoreMetadata.cpp:45
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
bool orderCertain
Are we confident that the dimension order is correct?
Definition: CoreMetadata.h:124
dimension_size_type resolutionCount
Sub-resolution count.
Definition: CoreMetadata.h:156
ome::xml::model::enums::PixelType pixelType
Number of bytes per pixel.
Definition: CoreMetadata.h:103
virtual ~CoreMetadata()
Destructor.
Definition: CoreMetadata.cpp:100
Modulo moduloC
Modulo C dimension.
Definition: CoreMetadata.h:118
Metadata key-value map using a restricted set of value types.
Definition: MetadataMap.h:79
dimension_size_type imageCount
Total number of images.
Definition: CoreMetadata.h:109
dimension_size_type sizeX
Width (in pixels) of images in this series.
Definition: CoreMetadata.h:82
ome::xml::model::enums::DimensionOrder dimensionOrder
Order in which dimensions are stored.
Definition: CoreMetadata.h:121
dimension_size_type thumbSizeY
Height (in pixels) of thumbnail images in this series.
Definition: CoreMetadata.h:100
Core metadata values.
Definition: CoreMetadata.h:78
pixel_size_type bitsPerPixel
Number of valid bits per pixel. */.
Definition: CoreMetadata.h:106
bool littleEndian
Is the pixel byte order little endian?
Definition: CoreMetadata.h:127
bool indexed
Are images are stored as indexed color?
Definition: CoreMetadata.h:136
bool thumbnail
Is this series is a lower-resolution copy of another series?
Definition: CoreMetadata.h:148
std::vector< dimension_size_type > sizeC
Number of channels.
Definition: CoreMetadata.h:91
bool falseColor
Can the color map (if present) be ignored?
Definition: CoreMetadata.h:139
bool interleaved
true if channels are stored RGBRGBRGB...; false if channels are stored RRR...GGG...BBB...
Definition: CoreMetadata.h:133
dimension_size_type sizeZ
Number of Z sections.
Definition: CoreMetadata.h:88
A subdimension of Z, C, or T.
Definition: Modulo.h:57
dimension_size_type thumbSizeX
Width (in pixels) of thumbnail images in this series.
Definition: CoreMetadata.h:97
dimension_size_type sizeY
Height (in pixels) of images in this series.
Definition: CoreMetadata.h:85
Modulo moduloZ
Modulo Z dimension.
Definition: CoreMetadata.h:112