OpenSlide: openslide.h Source File

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
50 typedef struct _openslide openslide_t;
51
59 typedef struct _openslide_cache openslide_cache_t;
60
61
67
84OPENSLIDE_PUBLIC()
85const char *openslide_detect_vendor(const char *filename);
86
87
103OPENSLIDE_PUBLIC()
104 openslide_t *openslide_open(const char *filename);
105
106
114OPENSLIDE_PUBLIC()
115int32_t openslide_get_level_count(openslide_t *osr);
116
117
127OPENSLIDE_PUBLIC()
128 void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
129
130
142OPENSLIDE_PUBLIC()
143 void openslide_get_level_dimensions(openslide_t *osr, int32_t level,
144 int64_t *w, int64_t *h);
145
146
156OPENSLIDE_PUBLIC()
157 double openslide_get_level_downsample(openslide_t *osr, int32_t level);
158
159
168OPENSLIDE_PUBLIC()
169int32_t openslide_get_best_level_for_downsample(openslide_t *osr,
170 double downsample);
171
196OPENSLIDE_PUBLIC()
197 void openslide_read_region(openslide_t *osr,
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()
212int64_t openslide_get_icc_profile_size(openslide_t *osr);
213
214
229OPENSLIDE_PUBLIC()
230 void openslide_read_icc_profile(openslide_t *osr, void *dest);
231
232
240OPENSLIDE_PUBLIC()
241 void openslide_close(openslide_t *osr);
243
272
285OPENSLIDE_PUBLIC()
286const char *openslide_get_error(openslide_t *osr);
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()
423const char * const *openslide_get_property_names(openslide_t *osr);
424
436OPENSLIDE_PUBLIC()
437const char *openslide_get_property_value(openslide_t *osr, const char *name);
438
440
451
462OPENSLIDE_PUBLIC()
463const char * const *openslide_get_associated_image_names(openslide_t *osr);
464
478OPENSLIDE_PUBLIC()
479 void openslide_get_associated_image_dimensions(openslide_t *osr,
480 const char *name,
481 int64_t *w, int64_t *h);
482
483
510OPENSLIDE_PUBLIC()
511 void openslide_read_associated_image(openslide_t *osr,
512 const char *name,
513 uint32_t *dest);
514
515
525OPENSLIDE_PUBLIC()
526int64_t openslide_get_associated_image_icc_profile_size(openslide_t *osr,
527 const char *name);
528
529
546OPENSLIDE_PUBLIC()
547 void openslide_read_associated_image_icc_profile(openslide_t *osr,
548 const char *name,
549 void *dest);
550
552
562
572OPENSLIDE_PUBLIC()
573 openslide_cache_t *openslide_cache_create(size_t capacity);
574
583OPENSLIDE_PUBLIC()
584 void openslide_set_cache(openslide_t *osr, openslide_cache_t *cache);
585
594OPENSLIDE_PUBLIC()
595 void openslide_cache_release(openslide_cache_t *cache);
596
598
604
611OPENSLIDE_PUBLIC()
612const char *openslide_get_version(void);
613
615
623
624#ifdef __cplusplus
625}
626#endif
openslide_get_version
const char * openslide_get_version(void)
Get the version of the OpenSlide library.
openslide_get_associated_image_names
const char *const * openslide_get_associated_image_names(openslide_t *osr)
Get the NULL-terminated array of associated image names.
openslide_read_region
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.
openslide_set_cache
void openslide_set_cache(openslide_t *osr, openslide_cache_t *cache)
Attach a cache to the specified OpenSlide object, replacing the current cache.
openslide_get_level_count
int32_t openslide_get_level_count(openslide_t *osr)
Get the number of levels in the whole slide image.
openslide_detect_vendor
const char * openslide_detect_vendor(const char *filename)
Quickly determine whether a whole slide image is recognized.
openslide_get_property_value
const char * openslide_get_property_value(openslide_t *osr, const char *name)
Get the value of a single property.
openslide_read_associated_image_icc_profile
void openslide_read_associated_image_icc_profile(openslide_t *osr, const char *name, void *dest)
Copy the ICC color profile from an associated image.
openslide_get_associated_image_dimensions
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.
openslide_get_icc_profile_size
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.
openslide_close
void openslide_close(openslide_t *osr)
Close an OpenSlide object.
openslide_get_associated_image_icc_profile_size
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.
openslide_get_level_dimensions
void openslide_get_level_dimensions(openslide_t *osr, int32_t level, int64_t *w, int64_t *h)
Get the dimensions of a level.
openslide_get_level_downsample
double openslide_get_level_downsample(openslide_t *osr, int32_t level)
Get the downsampling factor of a given level.
openslide_cache_create
openslide_cache_t * openslide_cache_create(size_t capacity)
Create a new tile cache, unconnected to any OpenSlide object.
openslide_read_associated_image
void openslide_read_associated_image(openslide_t *osr, const char *name, uint32_t *dest)
Copy pre-multiplied ARGB data from an associated image.
openslide_cache_t
struct _openslide_cache openslide_cache_t
An OpenSlide tile cache.
Definition openslide.h:59
openslide_cache_release
void openslide_cache_release(openslide_cache_t *cache)
Release the cache.
openslide_t
struct _openslide openslide_t
The main OpenSlide type.
Definition openslide.h:50
openslide_get_error
const char * openslide_get_error(openslide_t *osr)
Get the current error string.
openslide_get_best_level_for_downsample
int32_t openslide_get_best_level_for_downsample(openslide_t *osr, double downsample)
Get the best level to use for displaying the given downsample.
openslide_read_icc_profile
void openslide_read_icc_profile(openslide_t *osr, void *dest)
Copy the ICC color profile from a whole slide image.
openslide_open
openslide_t * openslide_open(const char *filename)
Open a whole slide image.
openslide_get_level0_dimensions
void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h)
Get the dimensions of level 0 (the largest level).
openslide_get_property_names
const char *const * openslide_get_property_names(openslide_t *osr)
Get the NULL-terminated array of property names.