Opening and reading supported file formats

Benjamin Gilbert bgilbert at cs.cmu.edu
Wed Feb 24 04:03:40 EST 2016


On Tue, Feb 23, 2016 at 11:31:01AM +0200, Evert Trollip via openslide-users wrote:
> Any idea why it doesn't want to open the CMU-1 file? Here is the code:

>     char const* filename = "CMU-1.tiff";
>     char const* slide_format_vendor = openslide_detect_vendor(filename);

Are you running your test program from the directory containing the slide
file?


Unrelated, but FYI:

> #include "openslide/openslide-features.h"

You shouldn't need to include this by hand.

>     image = openslide_open(filename);
>     if(image == NULL)
>     {
>         std::cout << "File not opened!" << std::endl;
>     }
>     else
>     {
>         std::cout << "File successfully opened." << std::endl << "A
> new OpenSlide object has been created." << std::endl;
>     }

If openslide_open() returns NULL, the call failed.  If it returns non-NULL,
the call did not necessarily succeed; you might have an openslide_t* in
error state.  In that case, you should call openslide_get_error() on the
openslide_t* and verify that it returns NULL.

--Benjamin Gilbert


More information about the openslide-users mailing list