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 
00204 OPENSLIDE_PUBLIC()
00205 const char *openslide_get_error(openslide_t *osr);
00207 
00213 
00217 #define OPENSLIDE_PROPERTY_NAME_COMMENT "openslide.comment"
00218 
00222 #define OPENSLIDE_PROPERTY_NAME_VENDOR "openslide.vendor"
00223 
00227 #define OPENSLIDE_PROPERTY_NAME_QUICKHASH1 "openslide.quickhash-1"
00228 
00233 #define OPENSLIDE_PROPERTY_NAME_BACKGROUND_COLOR "openslide.background-color"
00234 
00235 
00241 
00254 OPENSLIDE_PUBLIC()
00255 const char * const *openslide_get_property_names(openslide_t *osr);
00256 
00257 
00272 OPENSLIDE_PUBLIC()
00273 const char *openslide_get_property_value(openslide_t *osr, const char *name);
00274 
00282 OPENSLIDE_PUBLIC()
00283 const char *openslide_get_comment(openslide_t *osr);
00284 
00286 
00292 
00307 OPENSLIDE_PUBLIC()
00308 const char * const *openslide_get_associated_image_names(openslide_t *osr);
00309 
00323 OPENSLIDE_PUBLIC()
00324 void openslide_get_associated_image_dimensions(openslide_t *osr,
00325                                                const char *name,
00326                                                int64_t *w, int64_t *h);
00327 
00328 
00344 OPENSLIDE_PUBLIC()
00345 void openslide_read_associated_image(openslide_t *osr,
00346                                      const char *name,
00347                                      uint32_t *dest);
00349 
00350 
00351 // these are meant to throw compile- and link-time errors,
00352 // since the functions they replace were never implemented
00353 int _openslide_give_prefetch_hint_UNIMPLEMENTED(void);
00354 void _openslide_cancel_prefetch_hint_UNIMPLEMENTED(void);
00355 #define openslide_give_prefetch_hint(osr, x, y, layer, w, h)    \
00356   _openslide_give_prefetch_hint_UNIMPLEMENTED(-1);
00357 #define openslide_cancel_prefetch_hint(osr, prefetch_id)        \
00358   _openslide_cancel_prefetch_hint_UNIMPLEMENTED(-1)
00359 
00360 
00369 #endif