38 #ifndef OME_FILES_IN_OMETIFFREADER_H
39 #define OME_FILES_IN_OMETIFFREADER_H
41 #include <ome/files/in/MinimalTIFFReader.h>
42 #include <ome/files/tiff/TIFF.h>
46 #include <ome/xml/meta/BaseMetadata.h>
70 using ::ome::files::FormatReader::getOptimalTileWidth;
71 using ::ome::files::FormatReader::getOptimalTileHeight;
84 typedef std::map<boost::filesystem::path, std::pair<ome::compat::shared_ptr<ome::files::tiff::TIFF>,
bool> >
tiff_map;
106 mutable ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata>
cachedMetadata;
128 isThisType(
const boost::filesystem::path& name,
157 const ome::compat::shared_ptr<const tiff::IFD>
166 addTIFF(
const boost::filesystem::path& tiff);
179 const ome::compat::shared_ptr<const ome::files::tiff::TIFF>
180 getTIFF(
const boost::filesystem::path& tiff)
const;
189 validTIFF(
const boost::filesystem::path& tiff)
const;
199 closeTIFF(
const boost::filesystem::path& tiff);
207 ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata>
217 ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata>
232 ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata>
238 close(
bool fileOnly =
false);
240 const std::vector<std::string>&
244 const std::vector<boost::filesystem::path>
261 initFile(
const boost::filesystem::path&
id);
276 const boost::filesystem::path&
currentId,
277 const boost::filesystem::path& currentDir,
278 const boost::optional<std::string>& currentUUID);
291 std::vector<boost::optional<ome::xml::model::primitives::Timestamp> >& timestamps);
329 boost::optional<ome::xml::model::primitives::NonNegativeInteger>& zIndexStart,
330 boost::optional<ome::xml::model::primitives::NonNegativeInteger>& tIndexStart,
331 boost::optional<ome::xml::model::primitives::NonNegativeInteger>& cIndexStart);
350 boost::optional<ome::xml::model::primitives::NonNegativeInteger>& tdIFD,
400 ome::compat::shared_ptr< ome::xml::meta::MetadataStore>
420 ome::compat::shared_ptr< ome::xml::meta::MetadataStore>
429 #endif // OME_FILES_IN_OMETIFFREADER_H
const ome::compat::shared_ptr< const ome::files::tiff::TIFF > getTIFF(const boost::filesystem::path &tiff) const
Get a an open TIFF file from the internal TIFF map.
Definition: OMETIFFReader.cpp:1366
boost::filesystem::path cachedMetadataFile
Cached metadata file location (for re-using parsed metadata).
Definition: OMETIFFReader.h:112
const std::vector< std::string > & getDomains() const
Get the domains represented by the current file.
Definition: OMETIFFReader.cpp:354
logging::sources::severity_logger_mt< logging::trivial::severity_level > Logger
ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata > cacheMetadata(const boost::filesystem::path &id) const
Read and cache metadata.
Definition: OMETIFFReader.cpp:1447
void fixOMEROMetadata(ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series)
Fix invalid OMERO OME-TIFF metadata.
Definition: OMETIFFReader.cpp:1250
const std::vector< boost::filesystem::path > getSeriesUsedFiles(bool noPixels) const
Get the files used by the active series.
Definition: OMETIFFReader.cpp:361
Tagged Image File Format (TIFF).
Definition: TIFF.h:156
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
dimension_size_type seriesFileSamplesPerPixel(const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series)
Get the samples per pixel from the first IFD for a series.
bool validTIFF(const boost::filesystem::path &tiff) const
Check if a cached TIFF is valid (can be opened).
Definition: OMETIFFReader.cpp:1408
bool isSingleFile(const boost::filesystem::path &id) const
Is this a single-file format?
Definition: OMETIFFReader.cpp:223
void getLookupTable(dimension_size_type plane, VariantPixelBuffer &buf) const
Get the color lookup table associated with an image plane.
Definition: OMETIFFReader.cpp:1323
ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata > readMetadata(const ome::files::tiff::TIFF &tiff)
Read metadata into metadata store from an open TIFF.
Definition: OMETIFFReader.cpp:1426
bool hasSPW
Has screen-plate-well metadata.
Definition: OMETIFFReader.h:103
invalid_file_map invalidFiles
Invalid filename to valid filename mapping.
Definition: OMETIFFReader.h:90
FormatReader::FileGroupOption fileGroupOption(const std::string &id)
Returns an enum indicating that we cannot, must, or might group the files in this dataset...
Definition: OMETIFFReader.cpp:387
void cleanMetadata(ome::xml::meta::OMEXMLMetadata &meta)
Clean up OME-XML metadata.
Definition: OMETIFFReader.cpp:1121
uuid_file_map files
UUID to filename mapping.
Definition: OMETIFFReader.h:87
ome::compat::shared_ptr< ome::xml::meta::MetadataStore > getMetadataStoreForConversion()
Get a MetadataStore suitable for writing.
Definition: OMETIFFReader.cpp:1491
bool isThisType(const boost::filesystem::path &name, bool open) const
Check if the given file is a valid instance of this file format.
Definition: OMETIFFReader.cpp:266
tiff_map tiffs
Open TIFF files.
Definition: OMETIFFReader.h:94
OMETIFFReader()
Constructor.
Definition: OMETIFFReader.cpp:174
bool isFilenameThisTypeImpl(const boost::filesystem::path &name) const
isThisType file implementation for readers.
Definition: OMETIFFReader.cpp:276
TIFF reader with support for OME-XML metadata.
Definition: OMETIFFReader.h:67
ome::compat::shared_ptr< ome::xml::meta::MetadataStore > getMetadataStoreForDisplay()
Get a MetadataStore suitable for display.
Definition: OMETIFFReader.cpp:1497
void close(bool fileOnly=false)
Close the currently open file.
Definition: OMETIFFReader.cpp:205
void fixDimensions(ome::xml::meta::BaseMetadata::index_type series)
Attempt to correct logically inconsistent dimensions.
Definition: OMETIFFReader.cpp:1285
void seriesIndexStart(const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &zIndexStart, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &tIndexStart, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &cIndexStart)
Get starting index for each dimension.
Definition: OMETIFFReader.cpp:1132
void initFile(const boost::filesystem::path &id)
Initialize the given file.
Definition: OMETIFFReader.cpp:424
ome::common::Logger logger
Message logger.
Definition: OMETIFFReader.h:75
ome::compat::shared_ptr< ::ome::xml::meta::OMEXMLMetadata > cachedMetadata
Cached metadata (for re-using parsed metadata).
Definition: OMETIFFReader.h:106
std::map< boost::filesystem::path, boost::filesystem::path > invalid_file_map
Map filename to another file.
Definition: OMETIFFReader.h:81
virtual ~OMETIFFReader()
Destructor.
Definition: OMETIFFReader.cpp:193
boost::filesystem::path metadataFile
Metadata file.
Definition: OMETIFFReader.h:97
void getAcquisitionDates(const ome::xml::meta::OMEXMLMetadata &meta, std::vector< boost::optional< ome::xml::model::primitives::Timestamp > > ×tamps)
Get acquisition dates for each image.
Definition: OMETIFFReader.cpp:1102
const ome::compat::shared_ptr< const tiff::IFD > ifdAtIndex(dimension_size_type plane) const
Get the IFD index for a plane in the current series.
Definition: OMETIFFReader.cpp:329
bool getTiffDataValues(const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series, ome::xml::meta::BaseMetadata::index_type tiffData, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &tdIFD, ome::xml::model::primitives::NonNegativeInteger &numPlanes, ome::xml::model::primitives::NonNegativeInteger &firstZ, ome::xml::model::primitives::NonNegativeInteger &firstT, ome::xml::model::primitives::NonNegativeInteger &firstC)
Get values from a TiffData element.
Definition: OMETIFFReader.cpp:1184
std::map< std::string, boost::filesystem::path > uuid_file_map
Map UUID to filename.
Definition: OMETIFFReader.h:78
std::map< boost::filesystem::path, std::pair< ome::compat::shared_ptr< ome::files::tiff::TIFF >, bool > > tiff_map
Map filename to open TIFF handle.
Definition: OMETIFFReader.h:84
void closeTIFF(const boost::filesystem::path &tiff)
Close an open TIFF file from the internal TIFF map.
Definition: OMETIFFReader.cpp:1415
void findUsedFiles(const ome::xml::meta::OMEXMLMetadata &meta, const boost::filesystem::path ¤tId, const boost::filesystem::path ¤tDir, const boost::optional< std::string > ¤tUUID)
Get UUID to file associations and used files.
Definition: OMETIFFReader.cpp:1012
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
void openBytesImpl(dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const
Obtain a sub-image of an image plane.
Definition: OMETIFFReader.cpp:1345
std::vector< boost::filesystem::path > usedFiles
Used files.
Definition: OMETIFFReader.h:100
void addTIFF(const boost::filesystem::path &tiff)
Add a TIFF file to the internal TIFF map.
Definition: OMETIFFReader.cpp:1360