dimension_size_type FormatWriter::getPlane() const { assertId(currentId, true); return plane; }
void FormatWriter::changeOutputFile(const boost::filesystem::path& id) { assertId(currentId, true); setId(id); }
dimension_size_type FormatWriter::getSeries() const { assertId(currentId, true); return series; }
void FormatWriter::setLookupTable(dimension_size_type /* plane */, const VariantPixelBuffer& /* buf */) { assertId(currentId, true); throw std::runtime_error("Writer does not implement lookup tables"); }
void FormatWriter::setMetadataRetrieve(ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& retrieve) { assertId(currentId, false); if (!retrieve) throw std::logic_error("MetadataStore can not be null"); metadataRetrieve = retrieve; }
void FormatWriter::saveBytes(dimension_size_type plane, VariantPixelBuffer& buf) { assertId(currentId, true); dimension_size_type width = metadataRetrieve->getPixelsSizeX(getSeries()); dimension_size_type height = metadataRetrieve->getPixelsSizeY(getSeries()); saveBytes(plane, buf, 0, 0, width, height); }
ome::compat::array<dimension_size_type, 3> FormatWriter::getZCTCoords(dimension_size_type index) const { assertId(currentId, true); return ome::bioformats::getZCTCoords(getDimensionOrder(), getSizeZ(), getEffectiveSizeC(), getSizeT(), getImageCount(), index); }
dimension_size_type FormatWriter::getIndex(dimension_size_type z, dimension_size_type c, dimension_size_type t) const { assertId(currentId, true); return ome::bioformats::getIndex(getDimensionOrder(), getSizeZ(), getEffectiveSizeC(), getSizeT(), getImageCount(), z, c, t); }
void MinimalTIFFReader::openBytesImpl(dimension_size_type plane, VariantPixelBuffer& buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const { assertId(currentId, true); const ome::compat::shared_ptr<const IFD>& ifd(ifdAtIndex(plane)); ifd->readImage(buf, x, y, w, h); }
FormatWriter::FormatWriter(const WriterProperties& writerProperties): writerProperties(writerProperties), currentId(boost::none), out(), series(0), plane(0), compression(boost::none), interleaved(boost::none), sequential(false), framesPerSecond(0), metadataRetrieve(ome::compat::make_shared<DummyMetadata>()) { assertId(currentId, false); }
void MinimalTIFFReader::getLookupTable(dimension_size_type plane, VariantPixelBuffer& buf) const { assertId(currentId, true); const ome::compat::shared_ptr<const IFD>& ifd(ifdAtIndex(plane)); try { ifd->readLookupTable(buf); } catch (const std::exception& e) { boost::format fmt("Failed to get lookup table:"); fmt % e.what(); throw FormatException(fmt.str()); } }
void FormatWriter::setPlane(dimension_size_type plane) const { assertId(currentId, true); if (plane >= getImageCount()) { boost::format fmt("Invalid plane: %1%"); fmt % plane; throw std::logic_error(fmt.str()); } const dimension_size_type currentPlane = getPlane(); if (currentPlane != plane && (plane > 0 && currentPlane != plane - 1)) { boost::format fmt("Plane set out of order: %1% (currently %2%)"); fmt % plane % currentPlane; throw std::logic_error(fmt.str()); } this->plane = plane; }
void MinimalTIFFWriter::saveBytes(dimension_size_type plane, VariantPixelBuffer& buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) { assertId(currentId, true); setPlane(plane); dimension_size_type expectedIndex = tiff::ifdIndex(seriesIFDRange, getSeries(), plane); if (ifdIndex != expectedIndex) { boost::format fmt("IFD index mismatch: actual is %1% but %2% expected"); fmt % ifdIndex % expectedIndex; throw FormatException(fmt.str()); } ifd->writeImage(buf, x, y, w, h); }
void FormatWriter::setSeries(dimension_size_type series) const { assertId(currentId, true); if (series >= getSeriesCount()) { boost::format fmt("Invalid series: %1%"); fmt % series; throw std::logic_error(fmt.str()); } const dimension_size_type currentSeries = getSeries(); if (currentSeries != series && (series > 0 && currentSeries != series - 1)) { boost::format fmt("Series set out of order: %1% (currently %2%)"); fmt % series % currentSeries; throw std::logic_error(fmt.str()); } this->series = series; this->plane = 0U; }