ome-files 0.1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

IFD.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_IFD_H
39 #define OME_FILES_TIFF_IFD_H
40
41 #include <string>
42
43 #include <ome/compat/memory.h>
44
45 #include <ome/files/CoreMetadata.h>
46 #include <ome/files/TileCoverage.h>
47 #include <ome/files/tiff/TileInfo.h>
48 #include <ome/files/tiff/Types.h>
49 #include <ome/files/VariantPixelBuffer.h>
50
51 #include <ome/xml/model/enums/PixelType.h>
52
53 namespace ome
54 {
55 namespace files
56 {
57 namespace tiff
58 {
59
60 class TIFF;
61
63 template<typename Tag>
64 class Field;
65
71 class IFD : public ome::compat::enable_shared_from_this<IFD>
72 {
73 private:
74 class Impl;
76 ome::compat::shared_ptr<Impl> impl;
77
78 protected:
80 IFD(ome::compat::shared_ptr<TIFF>& tiff,
81 offset_type offset);
82
84 IFD(ome::compat::shared_ptr<TIFF>& tiff);
85
86 private:
88 IFD (const IFD&);
89
91 IFD&
92 operator= (const IFD&);
93
94 public:
96 virtual ~IFD();
97
105 static ome::compat::shared_ptr<IFD>
106 openIndex(ome::compat::shared_ptr<TIFF>& tiff,
107 directory_index_type index);
108
116 static ome::compat::shared_ptr<IFD>
117 openOffset(ome::compat::shared_ptr<TIFF>& tiff,
118 offset_type offset);
119
126 static ome::compat::shared_ptr<IFD>
127 current(ome::compat::shared_ptr<TIFF>& tiff);
128
134 ome::compat::shared_ptr<TIFF>&
135 getTIFF() const;
136
142 void
143 makeCurrent() const;
144
152 offset_type
153 getOffset() const;
154
165 void
166 getRawField(tag_type tag,
167 ...) const;
168
179 void
180 setRawField(tag_type tag,
181 ...);
182
189 template<typename TagCategory>
190 Field<TagCategory>
191 getField(TagCategory tag)
192 {
193 return Field<TagCategory>(this->shared_from_this(), tag);
194 }
195
202 template<typename TagCategory>
203 const Field<TagCategory>
204 getField(TagCategory tag) const
205 {
206 return Field<TagCategory>(const_cast<IFD *>(this)->shared_from_this(), tag);
207 }
208
214 TileType
215 getTileType() const;
216
222 void
223 setTileType(TileType type);
224
232 dimension_size_type
233 getCurrentTile() const;
234
246 void
247 setCurrentTile(dimension_size_type tile);
248
255 TileInfo
256 getTileInfo();
257
264 const TileInfo
265 getTileInfo() const;
266
272 std::vector<TileCoverage>&
273 getTileCoverage();
274
280 const std::vector<TileCoverage>&
281 getTileCoverage() const;
282
288 uint32_t
289 getImageWidth() const;
290
296 void
297 setImageWidth(uint32_t width);
298
304 uint32_t
305 getImageHeight() const;
306
312 void
313 setImageHeight(uint32_t height);
314
320 uint32_t
321 getTileWidth() const;
322
328 void
329 setTileWidth(uint32_t width);
330
336 uint32_t
337 getTileHeight() const;
338
344 void
345 setTileHeight(uint32_t height);
346
357 ::ome::xml::model::enums::PixelType
358 getPixelType() const;
359
369 void
370 setPixelType(::ome::xml::model::enums::PixelType type);
371
377 uint16_t
378 getBitsPerSample() const;
379
385 void
386 setBitsPerSample(uint16_t samples);
387
393 uint16_t
394 getSamplesPerPixel() const;
395
401 void
402 setSamplesPerPixel(uint16_t samples);
403
409 PlanarConfiguration
410 getPlanarConfiguration() const;
411
417 void
418 setPlanarConfiguration(PlanarConfiguration planarconfig);
419
425 PhotometricInterpretation
426 getPhotometricInterpretation() const;
427
433 void
434 setPhotometricInterpretation(PhotometricInterpretation photometric);
435
441 void
442 readImage(VariantPixelBuffer& buf) const;
443
448 void
449 readImage(VariantPixelBuffer& buf,
450 dimension_size_type subC) const;
451
466 void
467 readImage(VariantPixelBuffer& dest,
468 dimension_size_type x,
469 dimension_size_type y,
470 dimension_size_type w,
471 dimension_size_type h) const;
472
477 void
478 readImage(VariantPixelBuffer& dest,
479 dimension_size_type x,
480 dimension_size_type y,
481 dimension_size_type w,
482 dimension_size_type h,
483 dimension_size_type subC) const;
484
490 void
491 readLookupTable(VariantPixelBuffer& buf) const;
492
498 void
499 writeImage(const VariantPixelBuffer& buf);
500
505 void
506 writeImage(const VariantPixelBuffer& buf,
507 dimension_size_type subC);
508
522 void
523 writeImage(const VariantPixelBuffer& source,
524 dimension_size_type x,
525 dimension_size_type y,
526 dimension_size_type w,
527 dimension_size_type h);
528
533 void
534 writeImage(const VariantPixelBuffer& source,
535 dimension_size_type x,
536 dimension_size_type y,
537 dimension_size_type w,
538 dimension_size_type h,
539 dimension_size_type subC);
540
546 ome::compat::shared_ptr<IFD>
547 next() const;
548
554 bool
555 last() const;
556 };
557
558 }
559 }
560 }
561
562 #endif // OME_FILES_TIFF_IFD_H
563
564 /*
565 * Local Variables:
566 * mode:C++
567 * End:
568 */
ome::files::tiff::TileType
TileType
Type of tile.
Definition: Types.h:208
ome::files::tiff::IFD::setPlanarConfiguration
void setPlanarConfiguration(PlanarConfiguration planarconfig)
Set planar configuration.
Definition: IFD.cpp:1159
ome::files::tiff::IFD::getField
const Field< TagCategory > getField(TagCategory tag) const
Get a Field by its tag enumeration.
Definition: IFD.h:204
ome::files::tiff::IFD::setTileHeight
void setTileHeight(uint32_t height)
Set the tile height.
Definition: IFD.cpp:948
ome::files::tiff::IFD::next
ome::compat::shared_ptr< IFD > next() const
Get next directory.
Definition: IFD.cpp:1391
ome::files::tiff::IFD::setSamplesPerPixel
void setSamplesPerPixel(uint16_t samples)
Set samples per pixel.
Definition: IFD.cpp:1140
ome::files::tiff::IFD::IFD
IFD(ome::compat::shared_ptr< TIFF > &tiff, offset_type offset)
Constructor (not public).
Definition: IFD.cpp:653
memory.h
ome::files::tiff::IFD::getRawField
void getRawField(tag_type tag,...) const
Get a field by its tag number.
Definition: IFD.cpp:738
ome::files::dimension_size_type
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
ome::files::tiff::IFD::getImageHeight
uint32_t getImageHeight() const
Get the image height.
Definition: IFD.cpp:875
ome::files::tiff::IFD::getPhotometricInterpretation
PhotometricInterpretation getPhotometricInterpretation() const
Get photometric interpretation.
Definition: IFD.cpp:1166
ome::files::tiff::IFD::setCurrentTile
void setCurrentTile(dimension_size_type tile)
Set the current tile being written.
Definition: IFD.cpp:826
ome::files::tiff::TileInfo
Tile information for an IFD.
Definition: TileInfo.h:61
ome::files::tiff::IFD::setPixelType
void setPixelType(::ome::xml::model::enums::PixelType type)
Set the OME data model PixelType.
Definition: IFD.cpp:1062
ome::files::tiff::PlanarConfiguration
PlanarConfiguration
Planar configuration of samples.
Definition: Types.h:167
ome::files::tiff::IFD::setPhotometricInterpretation
void setPhotometricInterpretation(PhotometricInterpretation photometric)
Set photometric interpretation.
Definition: IFD.cpp:1178
ome::files::tiff::IFD::getBitsPerSample
uint16_t getBitsPerSample() const
Get bits per sample.
Definition: IFD.cpp:1105
ome::files::tiff::tag_type
unsigned int tag_type
Tag number.
Definition: Types.h:59
ome::files::tiff::IFD::openOffset
static ome::compat::shared_ptr< IFD > openOffset(ome::compat::shared_ptr< TIFF > &tiff, offset_type offset)
Open an IFD.
Definition: IFD.cpp:689
ome::files::tiff::IFD::last
bool last() const
Check if this is the last directory.
Definition: IFD.cpp:1412
ome::files::tiff::IFD::getCurrentTile
dimension_size_type getCurrentTile() const
Get the current tile being written.
Definition: IFD.cpp:820
ome::files::tiff::IFD::getTileHeight
uint32_t getTileHeight() const
Get the tile height.
Definition: IFD.cpp:927
ome::files::tiff::IFD::getTileType
TileType getTileType() const
Get the tile type.
Definition: IFD.cpp:792
ome::files::tiff::offset_type
uint64_t offset_type
IFD offset.
Definition: Types.h:56
ome::files::tiff::IFD::getTileWidth
uint32_t getTileWidth() const
Get the tile width.
Definition: IFD.cpp:894
ome::files::tiff::IFD::getTIFF
ome::compat::shared_ptr< TIFF > & getTIFF() const
Get the source TIFF this descriptor belongs to.
Definition: IFD.cpp:726
ome
ome::files::tiff::IFD::setTileType
void setTileType(TileType type)
Set the tile type.
Definition: IFD.cpp:814
ome::files::tiff::IFD::getTileCoverage
std::vector< TileCoverage > & getTileCoverage()
Get tile coverage cache.
Definition: IFD.cpp:844
ome::files::tiff::IFD::writeImage
void writeImage(const VariantPixelBuffer &buf)
Write a whole image plane from a pixel buffer.
Definition: IFD.cpp:1298
ome::files::tiff::IFD::~IFD
virtual ~IFD()
Destructor.
Definition: IFD.cpp:668
ome::files::tiff::IFD::setTileWidth
void setTileWidth(uint32_t width)
Set the tile width.
Definition: IFD.cpp:913
ome::files::tiff::IFD::setRawField
void setRawField(tag_type tag,...)
Set a field by its tag number.
Definition: IFD.cpp:767
ome::files::tiff::IFD::readImage
void readImage(VariantPixelBuffer &buf) const
Read a whole image plane into a pixel buffer.
Definition: IFD.cpp:1185
ome::files::tiff::IFD::getImageWidth
uint32_t getImageWidth() const
Get the image width.
Definition: IFD.cpp:856
ome::files::tiff::IFD::getPixelType
::ome::xml::model::enums::PixelType getPixelType() const
Get the OME data model PixelType.
Definition: IFD.cpp:962
ome::files::tiff::IFD::getPlanarConfiguration
PlanarConfiguration getPlanarConfiguration() const
Get planar configuration.
Definition: IFD.cpp:1147
ome::files::tiff::IFD::getOffset
offset_type getOffset() const
Get the directory offset.
Definition: IFD.cpp:732
ome::files::tiff::IFD::makeCurrent
void makeCurrent() const
Make this IFD the current directory.
Definition: IFD.cpp:706
ome::files::tiff::IFD::impl
ome::compat::shared_ptr< Impl > impl
Private implementation details.
Definition: IFD.h:74
ome::files::tiff::Field
Field representing a tag value.
Definition: Field.h:157
ome::xml::model::enums::PixelType
ome::files::tiff::IFD::setImageHeight
void setImageHeight(uint32_t height)
Set the image height.
Definition: IFD.cpp:887
ome::files::tiff::IFD::Impl
Internal implementation details of OffsetIFD.
Definition: IFD.cpp:582
ome::files::tiff::IFD::current
static ome::compat::shared_ptr< IFD > current(ome::compat::shared_ptr< TIFF > &tiff)
Get the current IFD.
Definition: IFD.cpp:698
ome::files::tiff::IFD::readLookupTable
void readLookupTable(VariantPixelBuffer &buf) const
Read a lookup table into a pixel buffer.
Definition: IFD.cpp:1252
ome::files::tiff::IFD::setImageWidth
void setImageWidth(uint32_t width)
Set the image width.
Definition: IFD.cpp:868
ome::files::tiff::IFD::setBitsPerSample
void setBitsPerSample(uint16_t samples)
Set bits per sample.
Definition: IFD.cpp:1117
ome::files::tiff::PhotometricInterpretation
PhotometricInterpretation
Photometric interpretation of pixel data.
Definition: Types.h:149
ome::files::tiff::IFD::getTileInfo
TileInfo getTileInfo()
Get tiling metadata.
Definition: IFD.cpp:832
ome::files::tiff::directory_index_type
uint16_t directory_index_type
IFD index.
Definition: Types.h:53
ome::files::tiff::IFD
Image File Directory (IFD).
Definition: IFD.h:71
ome::files::tiff::IFD::getField
Field< TagCategory > getField(TagCategory tag)
Get a Field by its tag enumeration.
Definition: IFD.h:191
ome::files::tiff::IFD::openIndex
static ome::compat::shared_ptr< IFD > openIndex(ome::compat::shared_ptr< TIFF > &tiff, directory_index_type index)
Open an IFD by index.
Definition: IFD.cpp:673
ome::files::tiff::IFD::getSamplesPerPixel
uint16_t getSamplesPerPixel() const
Get samples per pixel.
Definition: IFD.cpp:1128
ome::files::VariantPixelBuffer
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
ome::files::tiff::IFD::operator=
IFD & operator=(const IFD &)
Assignment operator (deleted).