bioformats  5.1.2
Classes | Public Member Functions | Protected Attributes | List of all members
ome::bioformats::TileCoverage Class Reference

Tile coverage cache. More...

#include <ome/bioformats/TileCoverage.h>

Classes

class  Impl
 Internal implementation details of TileCoverage. More...
 

Public Member Functions

 TileCoverage ()
 Constructor.
 
virtual ~TileCoverage ()
 Destructor.
 
bool insert (const PlaneRegion &region, bool coalesce=true)
 Insert a region into the coverage cache. More...
 
bool remove (const PlaneRegion &region)
 Remove a region from the coverage cache. More...
 
dimension_size_type size () const
 Get the number of separate regions in the coverage cache. More...
 
void clear ()
 Clear the coverage cache of all covered regions.
 
dimension_size_type coverage (const PlaneRegion &region) const
 Covered area within the region. More...
 
bool covered (const PlaneRegion &region) const
 Check if a region is completely covered. More...
 

Protected Attributes

ome::compat::shared_ptr< Implimpl
 Private implementation details.
 

Detailed Description

Tile coverage cache.

Cache and query covered 2D regions. Regions are stored in an R*Tree as half-open ranges of [x1,y1..x2,y2). This may be used, for example, to prevent writing out incomplete tiles and to output tiles in order when used with an accompanying tile cache.

Member Function Documentation

dimension_size_type ome::bioformats::TileCoverage::coverage ( const PlaneRegion region) const

Covered area within the region.

This is the sum of all covered areas within the specified region. If the area is completely covered, this value will equal the area of the specified region.

Parameters
regionthe region to check.
Returns
the covered area.

References ome::bioformats::PlaneRegion::area(), impl, and ome::bioformats::PlaneRegion::valid().

Referenced by covered(), and insert().

+ Here is the caller graph for this function:

bool ome::bioformats::TileCoverage::covered ( const PlaneRegion region) const

Check if a region is completely covered.

Parameters
regionthe region to check.
Returns
true if completely covered, false otherwise.

References coverage(), ome::bioformats::PlaneRegion::h, and ome::bioformats::PlaneRegion::w.

bool ome::bioformats::TileCoverage::insert ( const PlaneRegion region,
bool  coalesce = true 
)

Insert a region into the coverage cache.

The insert will only succeed if the region is completely uncovered. That is, it must not overlap with any currently covered region in the cache.

Region coalescing is enabled by default because the overhead of merging adjacent regions is much less than the cost of searching the cache with thousand of tiles. If filling the cache with aligned tiles of the same size in a consistent order, this should result in a very low region count (less than 5) and hence lookups will be very fast. It will be necessary to disable coalescing if the regions will subsequently be removed, since region splitting is not implemented.

Parameters
regionthe region to insert.
coalescetrue to merge with adjacent tiles, or false to ensure the region is kept separated.
Returns
true if the region was inserted, or false if not inserted.

References coverage(), impl, and ome::bioformats::PlaneRegion::valid().

bool ome::bioformats::TileCoverage::remove ( const PlaneRegion region)

Remove a region from the coverage cache.

A separate region of the exact size of the specified region must exist in the coverage cache or else removal will fail. Disable coalescing if it is preventing removal due to merging adjacent tiles.

Parameters
regionthe region to remove.
Returns
true if the region was removed, or false if not removed.

References impl.

dimension_size_type ome::bioformats::TileCoverage::size ( ) const

Get the number of separate regions in the coverage cache.

Returns
the number of separate regions.

References impl.


The documentation for this class was generated from the following files: