예제 #1
0
      dimension_size_type
      FormatWriter::getPlane() const
      {
        assertId(currentId, true);

        return plane;
      }
예제 #2
0
      void
      FormatWriter::changeOutputFile(const boost::filesystem::path& id)
      {
        assertId(currentId, true);

        setId(id);
      }
예제 #3
0
      dimension_size_type
      FormatWriter::getSeries() const
      {
        assertId(currentId, true);

        return series;
      }
예제 #4
0
      void
      FormatWriter::setLookupTable(dimension_size_type       /* plane */,
                                   const VariantPixelBuffer& /* buf */)
      {
        assertId(currentId, true);

        throw std::runtime_error("Writer does not implement lookup tables");
      }
예제 #5
0
      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;
      }
예제 #6
0
      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);
      }
예제 #7
0
 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);
 }
예제 #8
0
 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);
 }
예제 #9
0
      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);
      }
예제 #10
0
 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);
 }
예제 #11
0
      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());
          }
      }
예제 #12
0
      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;
      }
예제 #13
0
      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);
      }
예제 #14
0
      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;
      }