OpenSlide
openslide.h
Go to the documentation of this file.
00001 /*
00002  *  OpenSlide, a library for reading whole slide image files
00003  *
00004  *  Copyright (c) 2007-2010 Carnegie Mellon University
00005  *  All rights reserved.
00006  *
00007  *  OpenSlide is free software: you can redistribute it and/or modify
00008  *  it under the terms of the GNU Lesser General Public License as
00009  *  published by the Free Software Foundation, version 2.1.
00010  *
00011  *  OpenSlide is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with OpenSlide. If not, see
00018  *  <http://www.gnu.org/licenses/>.
00019  *
00020  */
00021 
00027 #ifndef OPENSLIDE_OPENSLIDE_H_
00028 #define OPENSLIDE_OPENSLIDE_H_
00029 
00030 #include <openslide-features.h>
00031 
00032 #include <stdio.h>
00033 #include <stdint.h>
00034 
00038 typedef struct _openslide openslide_t;
00039 
00040 
00048 
00055 OPENSLIDE_PUBLIC()
00056 bool openslide_can_open(const char *filename);
00057 
00058 
00065 OPENSLIDE_PUBLIC()
00066 openslide_t *openslide_open(const char *filename);
00067 
00068 
00075 OPENSLIDE_PUBLIC()
00076 int32_t openslide_get_layer_count(openslide_t *osr);
00077 
00078 
00087 OPENSLIDE_PUBLIC()
00088 void openslide_get_layer0_dimensions(openslide_t *osr, int64_t *w, int64_t *h);
00089 
00090 
00101 OPENSLIDE_PUBLIC()
00102 void openslide_get_layer_dimensions(openslide_t *osr, int32_t layer,
00103                                     int64_t *w, int64_t *h);
00104 
00105 
00114 OPENSLIDE_PUBLIC()
00115 double openslide_get_layer_downsample(openslide_t *osr, int32_t layer);
00116 
00117 
00125 OPENSLIDE_PUBLIC()
00126 int32_t openslide_get_best_layer_for_downsample(openslide_t *osr,
00127                                                 double downsample);
00128 
00146 OPENSLIDE_PUBLIC()
00147 void openslide_read_region(openslide_t *osr,
00148                            uint32_t *dest,
00149                            int64_t x, int64_t y,
00150                            int32_t layer,
00151                            int64_t w, int64_t h);
00152 
00153 
00160 OPENSLIDE_PUBLIC()
00161 void openslide_close(openslide_t *osr);
00163 
00205 OPENSLIDE_PUBLIC()
00206 const char *openslide_get_error(openslide_t *osr);
00208 
00214 
00218 #define OPENSLIDE_PROPERTY_NAME_COMMENT "openslide.comment"
00219 
00223 #define OPENSLIDE_PROPERTY_NAME_VENDOR "openslide.vendor"
00224 
00228 #define OPENSLIDE_PROPERTY_NAME_QUICKHASH1 "openslide.quickhash-1"
00229 
00236 #define OPENSLIDE_PROPERTY_NAME_BACKGROUND_COLOR "openslide.background-color"
00237 
00238 
00244 
00257 OPENSLIDE_PUBLIC()
00258 const char * const *openslide_get_property_names(openslide_t *osr);
00259 
00260 
00275 OPENSLIDE_PUBLIC()
00276 const char *openslide_get_property_value(openslide_t *osr, const char *name);
00277 
00285 OPENSLIDE_PUBLIC()
00286 const char *openslide_get_comment(openslide_t *osr);
00287 
00289 
00295 
00310 OPENSLIDE_PUBLIC()
00311 const char * const *openslide_get_associated_image_names(openslide_t *osr);
00312 
00326 OPENSLIDE_PUBLIC()
00327 void openslide_get_associated_image_dimensions(openslide_t *osr,
00328                                                const char *name,
00329                                                int64_t *w, int64_t *h);
00330 
00331 
00347 OPENSLIDE_PUBLIC()
00348 void openslide_read_associated_image(openslide_t *osr,
00349                                      const char *name,
00350                                      uint32_t *dest);
00352 
00353 
00354 // these are meant to throw compile- and link-time errors,
00355 // since the functions they replace were never implemented
00356 int _openslide_give_prefetch_hint_UNIMPLEMENTED(void);
00357 void _openslide_cancel_prefetch_hint_UNIMPLEMENTED(void);
00358 #define openslide_give_prefetch_hint(osr, x, y, layer, w, h)    \
00359   _openslide_give_prefetch_hint_UNIMPLEMENTED(-1);
00360 #define openslide_cancel_prefetch_hint(osr, prefetch_id)        \
00361   _openslide_cancel_prefetch_hint_UNIMPLEMENTED(-1)
00362 
00363 
00372 #endif