OpenSlide
openslide.h
Go to the documentation of this file.
1/*
2 * OpenSlide, a library for reading whole slide image files
3 *
4 * Copyright (c) 2007-2014 Carnegie Mellon University
5 * Copyright (c) 2021 Benjamin Gilbert
6 * All rights reserved.
7 *
8 * OpenSlide is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation, version 2.1.
11 *
12 * OpenSlide is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with OpenSlide. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
30
31#pragma once
32
33#include "openslide-features.h"
34
35#include <stddef.h>
36#include <stdint.h>
37#include <stdbool.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
50typedef struct _openslide openslide_t;
51
59typedef struct _openslide_cache openslide_cache_t;
60
61
67
84OPENSLIDE_PUBLIC()
85const char *openslide_detect_vendor(const char *filename);
86
87
103OPENSLIDE_PUBLIC()
104openslide_t *openslide_open(const char *filename);
105
106
114OPENSLIDE_PUBLIC()
116
117
127OPENSLIDE_PUBLIC()
128void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
129
130
142OPENSLIDE_PUBLIC()
144 int64_t *w, int64_t *h);
145
146
156OPENSLIDE_PUBLIC()
157double openslide_get_level_downsample(openslide_t *osr, int32_t level);
158
159
168OPENSLIDE_PUBLIC()
170 double downsample);
171
196OPENSLIDE_PUBLIC()
198 uint32_t *dest,
199 int64_t x, int64_t y,
200 int32_t level,
201 int64_t w, int64_t h);
202
203
211OPENSLIDE_PUBLIC()
213
214
229OPENSLIDE_PUBLIC()
231
232
240OPENSLIDE_PUBLIC()
243
272
285OPENSLIDE_PUBLIC()
288
294
301#define OPENSLIDE_PROPERTY_NAME_BACKGROUND_COLOR "openslide.background-color"
302
308#define OPENSLIDE_PROPERTY_NAME_BARCODE "openslide.barcode"
309
316#define OPENSLIDE_PROPERTY_NAME_BOUNDS_HEIGHT "openslide.bounds-height"
317
324#define OPENSLIDE_PROPERTY_NAME_BOUNDS_WIDTH "openslide.bounds-width"
325
332#define OPENSLIDE_PROPERTY_NAME_BOUNDS_X "openslide.bounds-x"
333
340#define OPENSLIDE_PROPERTY_NAME_BOUNDS_Y "openslide.bounds-y"
341
347#define OPENSLIDE_PROPERTY_NAME_COMMENT "openslide.comment"
348
355#define OPENSLIDE_PROPERTY_NAME_ICC_SIZE "openslide.icc-size"
356
363#define OPENSLIDE_PROPERTY_NAME_MPP_X "openslide.mpp-x"
364
371#define OPENSLIDE_PROPERTY_NAME_MPP_Y "openslide.mpp-y"
372
378#define OPENSLIDE_PROPERTY_NAME_OBJECTIVE_POWER "openslide.objective-power"
379
385#define OPENSLIDE_PROPERTY_NAME_QUICKHASH1 "openslide.quickhash-1"
386
392#define OPENSLIDE_PROPERTY_NAME_VENDOR "openslide.vendor"
393
395
411
422OPENSLIDE_PUBLIC()
424
436OPENSLIDE_PUBLIC()
437const char *openslide_get_property_value(openslide_t *osr, const char *name);
438
440
451
462OPENSLIDE_PUBLIC()
464
478OPENSLIDE_PUBLIC()
480 const char *name,
481 int64_t *w, int64_t *h);
482
483
510OPENSLIDE_PUBLIC()
512 const char *name,
513 uint32_t *dest);
514
515
525OPENSLIDE_PUBLIC()
527 const char *name);
528
529
546OPENSLIDE_PUBLIC()
548 const char *name,
549 void *dest);
550
552
562
572OPENSLIDE_PUBLIC()
574
583OPENSLIDE_PUBLIC()
585
594OPENSLIDE_PUBLIC()
596
598
604
611OPENSLIDE_PUBLIC()
612const char *openslide_get_version(void);
613
615
623
624#ifdef __cplusplus
625}
626#endif
const char * openslide_get_version(void)
Get the version of the OpenSlide library.
const char *const * openslide_get_associated_image_names(openslide_t *osr)
Get the NULL-terminated array of associated image names.
void openslide_read_region(openslide_t *osr, uint32_t *dest, int64_t x, int64_t y, int32_t level, int64_t w, int64_t h)
Copy pre-multiplied ARGB data from a whole slide image.
void openslide_set_cache(openslide_t *osr, openslide_cache_t *cache)
Attach a cache to the specified OpenSlide object, replacing the current cache.
int32_t openslide_get_level_count(openslide_t *osr)
Get the number of levels in the whole slide image.
const char * openslide_detect_vendor(const char *filename)
Quickly determine whether a whole slide image is recognized.
const char * openslide_get_property_value(openslide_t *osr, const char *name)
Get the value of a single property.
void openslide_read_associated_image_icc_profile(openslide_t *osr, const char *name, void *dest)
Copy the ICC color profile from an associated image.
void openslide_get_associated_image_dimensions(openslide_t *osr, const char *name, int64_t *w, int64_t *h)
Get the dimensions of an associated image.
int64_t openslide_get_icc_profile_size(openslide_t *osr)
Get the size in bytes of the ICC color profile for the whole slide image.
void openslide_close(openslide_t *osr)
Close an OpenSlide object.
int64_t openslide_get_associated_image_icc_profile_size(openslide_t *osr, const char *name)
Get the size in bytes of the ICC color profile for an associated image.
void openslide_get_level_dimensions(openslide_t *osr, int32_t level, int64_t *w, int64_t *h)
Get the dimensions of a level.
double openslide_get_level_downsample(openslide_t *osr, int32_t level)
Get the downsampling factor of a given level.
openslide_cache_t * openslide_cache_create(size_t capacity)
Create a new tile cache, unconnected to any OpenSlide object.
void openslide_read_associated_image(openslide_t *osr, const char *name, uint32_t *dest)
Copy pre-multiplied ARGB data from an associated image.
struct _openslide_cache openslide_cache_t
An OpenSlide tile cache.
Definition openslide.h:59
void openslide_cache_release(openslide_cache_t *cache)
Release the cache.
struct _openslide openslide_t
The main OpenSlide type.
Definition openslide.h:50
const char * openslide_get_error(openslide_t *osr)
Get the current error string.
int32_t openslide_get_best_level_for_downsample(openslide_t *osr, double downsample)
Get the best level to use for displaying the given downsample.
void openslide_read_icc_profile(openslide_t *osr, void *dest)
Copy the ICC color profile from a whole slide image.
openslide_t * openslide_open(const char *filename)
Open a whole slide image.
void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h)
Get the dimensions of level 0 (the largest level).
const char *const * openslide_get_property_names(openslide_t *osr)
Get the NULL-terminated array of property names.