コード例 #1
0
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      dimension_size_type
      FormatWriter::getPlane() const
      {
        assertId(currentId, true);

        return plane;
      }
コード例 #2
0
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      void
      FormatWriter::changeOutputFile(const boost::filesystem::path& id)
      {
        assertId(currentId, true);

        setId(id);
      }
コード例 #3
0
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      dimension_size_type
      FormatWriter::getSeries() const
      {
        assertId(currentId, true);

        return series;
      }
コード例 #4
0
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
 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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
 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.cpp プロジェクト: dgault/bioformats
 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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      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
ファイル: FormatWriter.cpp プロジェクト: dgault/bioformats
      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;
      }