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  * All rights reserved.
6  *
7  * OpenSlide is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, version 2.1.
10  *
11  * OpenSlide is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with OpenSlide. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
30 #ifndef OPENSLIDE_OPENSLIDE_H_
31 #define OPENSLIDE_OPENSLIDE_H_
32 
33 #include "openslide-features.h"
34 
35 #include <stdint.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 typedef struct _openslide openslide_t;
45 
46 
52 
69 OPENSLIDE_PUBLIC()
70 const char *openslide_detect_vendor(const char *filename);
71 
72 
88 OPENSLIDE_PUBLIC()
89 openslide_t *openslide_open(const char *filename);
90 
91 
99 OPENSLIDE_PUBLIC()
101 
102 
112 OPENSLIDE_PUBLIC()
113 void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
114 
115 
127 OPENSLIDE_PUBLIC()
128 void openslide_get_level_dimensions(openslide_t *osr, int32_t level,
129  int64_t *w, int64_t *h);
130 
131 
141 OPENSLIDE_PUBLIC()
142 double openslide_get_level_downsample(openslide_t *osr, int32_t level);
143 
144 
153 OPENSLIDE_PUBLIC()
155  double downsample);
156 
174 OPENSLIDE_PUBLIC()
176  uint32_t *dest,
177  int64_t x, int64_t y,
178  int32_t level,
179  int64_t w, int64_t h);
180 
181 
189 OPENSLIDE_PUBLIC()
190 void openslide_close(openslide_t *osr);
192 
234 OPENSLIDE_PUBLIC()
235 const char *openslide_get_error(openslide_t *osr);
237 
243 
247 #define OPENSLIDE_PROPERTY_NAME_COMMENT "openslide.comment"
248 
252 #define OPENSLIDE_PROPERTY_NAME_VENDOR "openslide.vendor"
253 
257 #define OPENSLIDE_PROPERTY_NAME_QUICKHASH1 "openslide.quickhash-1"
258 
265 #define OPENSLIDE_PROPERTY_NAME_BACKGROUND_COLOR "openslide.background-color"
266 
272 #define OPENSLIDE_PROPERTY_NAME_OBJECTIVE_POWER "openslide.objective-power"
273 
280 #define OPENSLIDE_PROPERTY_NAME_MPP_X "openslide.mpp-x"
281 
288 #define OPENSLIDE_PROPERTY_NAME_MPP_Y "openslide.mpp-y"
289 
296 #define OPENSLIDE_PROPERTY_NAME_BOUNDS_X "openslide.bounds-x"
297 
304 #define OPENSLIDE_PROPERTY_NAME_BOUNDS_Y "openslide.bounds-y"
305 
312 #define OPENSLIDE_PROPERTY_NAME_BOUNDS_WIDTH "openslide.bounds-width"
313 
320 #define OPENSLIDE_PROPERTY_NAME_BOUNDS_HEIGHT "openslide.bounds-height"
321 
322 
328 
341 OPENSLIDE_PUBLIC()
342 const char * const *openslide_get_property_names(openslide_t *osr);
343 
344 
359 OPENSLIDE_PUBLIC()
360 const char *openslide_get_property_value(openslide_t *osr, const char *name);
361 
363 
369 
384 OPENSLIDE_PUBLIC()
385 const char * const *openslide_get_associated_image_names(openslide_t *osr);
386 
400 OPENSLIDE_PUBLIC()
402  const char *name,
403  int64_t *w, int64_t *h);
404 
405 
421 OPENSLIDE_PUBLIC()
423  const char *name,
424  uint32_t *dest);
426 
432 
439 OPENSLIDE_PUBLIC()
440 const char *openslide_get_version(void);
441 
443 
452 
472 OPENSLIDE_PUBLIC()
473 OPENSLIDE_DEPRECATED_FOR(openslide_detect_vendor or openslide_open)
474 bool openslide_can_open(const char *filename);
475 
476 
484 OPENSLIDE_PUBLIC()
485 OPENSLIDE_DEPRECATED_FOR(openslide_get_level_count)
487 
488 
498 OPENSLIDE_PUBLIC()
499 OPENSLIDE_DEPRECATED_FOR(openslide_get_level0_dimensions)
500 void openslide_get_layer0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
501 
502 
514 OPENSLIDE_PUBLIC()
515 OPENSLIDE_DEPRECATED_FOR(openslide_get_level_dimensions)
516 void openslide_get_layer_dimensions(openslide_t *osr, int32_t level,
517  int64_t *w, int64_t *h);
518 
519 
529 OPENSLIDE_PUBLIC()
530 OPENSLIDE_DEPRECATED_FOR(openslide_get_level_downsample)
531 double openslide_get_layer_downsample(openslide_t *osr, int32_t level);
532 
533 
542 OPENSLIDE_PUBLIC()
543 OPENSLIDE_DEPRECATED_FOR(openslide_get_best_level_for_downsample)
545  double downsample);
546 
556 OPENSLIDE_PUBLIC()
558 const char *openslide_get_comment(openslide_t *osr);
559 
561 
562 #ifndef OPENSLIDE_SIMPLIFY_HEADERS
563 // these are meant to throw compile- and link-time errors,
564 // since the functions they replace were never implemented
565 int _openslide_give_prefetch_hint_UNIMPLEMENTED(void);
566 void _openslide_cancel_prefetch_hint_UNIMPLEMENTED(void);
567 #define openslide_give_prefetch_hint(osr, x, y, level, w, h) \
568  _openslide_give_prefetch_hint_UNIMPLEMENTED(-1);
569 #define openslide_cancel_prefetch_hint(osr, prefetch_id) \
570  _openslide_cancel_prefetch_hint_UNIMPLEMENTED(-1)
571 #endif
572 
581 #ifdef __cplusplus
582 }
583 #endif
584 
585 #endif
int32_t openslide_get_best_layer_for_downsample(openslide_t *osr, double downsample)
Get the best level to use for displaying the given 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.
const char * openslide_get_property_value(openslide_t *osr, const char *name)
Get the value of a single property.
const char * openslide_get_comment(openslide_t *osr)
Get the comment (if any) for this image.
void openslide_get_layer0_dimensions(openslide_t *osr, int64_t *w, int64_t *h)
Get the dimensions of level 0 (the largest level).
struct _openslide openslide_t
The main OpenSlide type.
Definition: openslide.h:44
#define OPENSLIDE_PROPERTY_NAME_COMMENT
The name of the property containing a slide's comment, if any.
Definition: openslide.h:247
const char * openslide_get_error(openslide_t *osr)
Get the current error string.
void openslide_read_associated_image(openslide_t *osr, const char *name, uint32_t *dest)
Copy pre-multiplied ARGB data from an associated image.
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.
bool openslide_can_open(const char *filename)
Return whether openslide_open() will succeed.
int32_t openslide_get_layer_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 *const * openslide_get_associated_image_names(openslide_t *osr)
Get the NULL-terminated array of associated image names.
void openslide_get_level_dimensions(openslide_t *osr, int32_t level, int64_t *w, int64_t *h)
Get the dimensions of a level.
void openslide_get_layer_dimensions(openslide_t *osr, int32_t level, int64_t *w, int64_t *h)
Get the dimensions of a level.
void openslide_get_level0_dimensions(openslide_t *osr, int64_t *w, int64_t *h)
Get the dimensions of level 0 (the largest level).
double openslide_get_level_downsample(openslide_t *osr, int32_t level)
Get the downsampling factor of a given level.
const char * openslide_get_version(void)
Get the version of the OpenSlide library.
int32_t openslide_get_level_count(openslide_t *osr)
Get the number of levels in the whole slide image.
openslide_t * openslide_open(const char *filename)
Open a whole slide image.
const char *const * openslide_get_property_names(openslide_t *osr)
Get the NULL-terminated array of property names.
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.
void openslide_close(openslide_t *osr)
Close an OpenSlide object.
double openslide_get_layer_downsample(openslide_t *osr, int32_t level)
Get the downsampling factor of a given level.