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