Custom vendor format
Benjamin Gilbert
bgilbert at cs.cmu.edu
Mon May 12 23:47:06 EDT 2014
Hi Tim,
On 05/12/2014 04:05 PM, Blattner, Timothy J. wrote:
> So I was wondering if it would be possible for me to add support into
> OpenSlide to visualize images that are constructed using a CSV file that
> contain ‘path_to_file, x_pixel_position, y_pixel_position’.
You should be able to create a vendor driver for such a format without
too much difficulty.
https://github.com/openslide/openslide/wiki/AddingASlideFormat
From your description, it sounds as though the output of the scanner is
a single zoom level with no downsampling. With one small exception,
OpenSlide never synthesizes downsampled levels, so the API would report
a single-level slide. Naturally, that may not be useful to you.
If downsampled tiles could be precalculated and stored during scanning,
that would allow OpenSlide to present a multi-level slide suitable for
zooming. In that case, either you will end up with very small tiles (in
highly-downsampled levels) or you will need to merge tiles during
downsampling. That, in turn, would require you to resolve overlaps
during downsampling, which may be more work than you want to do. (We do
support a couple of formats which concatenate and downsample adjacent
tiles *without* first resolving overlaps, and I wholeheartedly advise
not doing that.)
(The small exception is that OpenSlide can efficiently downsample JPEG
tiles by 1/2, 1/4, or 1/8 at runtime, as a concession for Hamamatsu VMS.
That approach uses less CPU than a full decode, but the same amount of
disk I/O.)
Also note that the tilemap grid expects to receive both the position and
dimensions for each tile, so you'll want the metadata to include tile
dimensions.
Does that help? Feel free to ask questions on this list if you run into
trouble.
> Now the tricky part with this technique is we would need to do
> blending on the overlapping regions, so either linear, average, or
> overlay; however, I think that it will not be expensive to do
> blending on the fly.
We currently use CAIRO_OPERATOR_SATURATE, so in effect we're only using
pixels from the frontmost (bottom-right) overlapping tile except at
seams. But, since vendor drivers draw directly to the Cairo context,
you should be able to use any of the Cairo compositing operators.
--Benjamin Gilbert
More information about the openslide-users
mailing list