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
31#ifndef OPENSLIDE_OPENSLIDE_H_
32#define OPENSLIDE_OPENSLIDE_H_
33
34#include "openslide-features.h"
35
36#include <stddef.h>
37#include <stdint.h>
38#include <stdbool.h>
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
51typedef struct _openslide openslide_t;
52
60typedef struct _openslide_cache openslide_cache_t;
61
62
68
85OPENSLIDE_PUBLIC()
86const char *openslide_detect_vendor(const char *filename);
87
88
104OPENSLIDE_PUBLIC()
105openslide_t *openslide_open(const char *filename);
106
107
115OPENSLIDE_PUBLIC()
117
118
128OPENSLIDE_PUBLIC()
129void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
130
131
143OPENSLIDE_PUBLIC()
145 int64_t *w, int64_t *h);
146
147
157OPENSLIDE_PUBLIC()
158double openslide_get_level_downsample(openslide_t *osr, int32_t level);
159
160
169OPENSLIDE_PUBLIC()
171 double downsample);
172
197OPENSLIDE_PUBLIC()
199 uint32_t *dest,
200 int64_t x, int64_t y,
201 int32_t level,
202 int64_t w, int64_t h);
203
204
212OPENSLIDE_PUBLIC()
214
215
230OPENSLIDE_PUBLIC()
232
233
241OPENSLIDE_PUBLIC()
244
286OPENSLIDE_PUBLIC()
289
295
302#define OPENSLIDE_PROPERTY_NAME_BACKGROUND_COLOR "openslide.background-color"
303
310#define OPENSLIDE_PROPERTY_NAME_BOUNDS_HEIGHT "openslide.bounds-height"
311
318#define OPENSLIDE_PROPERTY_NAME_BOUNDS_WIDTH "openslide.bounds-width"
319
326#define OPENSLIDE_PROPERTY_NAME_BOUNDS_X "openslide.bounds-x"
327
334#define OPENSLIDE_PROPERTY_NAME_BOUNDS_Y "openslide.bounds-y"
335
341#define OPENSLIDE_PROPERTY_NAME_COMMENT "openslide.comment"
342
349#define OPENSLIDE_PROPERTY_NAME_ICC_SIZE "openslide.icc-size"
350
357#define OPENSLIDE_PROPERTY_NAME_MPP_X "openslide.mpp-x"
358
365#define OPENSLIDE_PROPERTY_NAME_MPP_Y "openslide.mpp-y"
366
372#define OPENSLIDE_PROPERTY_NAME_OBJECTIVE_POWER "openslide.objective-power"
373
379#define OPENSLIDE_PROPERTY_NAME_QUICKHASH1 "openslide.quickhash-1"
380
386#define OPENSLIDE_PROPERTY_NAME_VENDOR "openslide.vendor"
387
389
405
416OPENSLIDE_PUBLIC()
418
430OPENSLIDE_PUBLIC()
431const char *openslide_get_property_value(openslide_t *osr, const char *name);
432
434
445
456OPENSLIDE_PUBLIC()
458
472OPENSLIDE_PUBLIC()
474 const char *name,
475 int64_t *w, int64_t *h);
476
477
504OPENSLIDE_PUBLIC()
506 const char *name,
507 uint32_t *dest);
508
509
519OPENSLIDE_PUBLIC()
521 const char *name);
522
523
540OPENSLIDE_PUBLIC()
542 const char *name,
543 void *dest);
544
546
556
566OPENSLIDE_PUBLIC()
568
577OPENSLIDE_PUBLIC()
579
588OPENSLIDE_PUBLIC()
590
592
598
605OPENSLIDE_PUBLIC()
606const char *openslide_get_version(void);
607
609
618#ifdef __cplusplus
619}
620#endif
621
622#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:60
void openslide_cache_release(openslide_cache_t *cache)
Release the cache.
struct _openslide openslide_t
The main OpenSlide type.
Definition: openslide.h:51
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.