Giter VIP home page Giter VIP logo

openslide's Introduction

OpenSlide

OpenSlide is a C library for reading whole slide image files (also known as virtual slides). It provides a consistent and simple API for reading files from multiple vendors.

Features

OpenSlide can read brightfield whole slide images in several formats:

OpenSlide can also provide access to ICC profiles, textual metadata, and associated images such as a slide label and thumbnail.

Documentation

The API reference is available on the web, and is also included as doc/html/openslide_8h.html in the source tarball. Additional documentation is available on the OpenSlide website.

License

OpenSlide is released under the terms of the GNU Lesser General Public License, version 2.1.

OpenSlide is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Compiling

To build OpenSlide, you will need:

  • Meson
  • cairo ≥ 1.2
  • GDK-PixBuf
  • glib ≥ 2.56
  • libdicom ≥ 1.0 (automatically built if missing)
  • libjpeg
  • libpng
  • libtiff ≥ 4.0
  • libxml2
  • OpenJPEG ≥ 2.1
  • SQLite ≥ 3.14
  • zlib
  • Zstandard

Then:

meson setup builddir
meson compile -C builddir
meson install -C builddir

Acknowledgements

OpenSlide has been developed by Carnegie Mellon University and other contributors.

OpenSlide has been supported by the National Institutes of Health and the Clinical and Translational Science Institute at the University of Pittsburgh.

Development of DICOM and ICC functionality was supported by NCI Imaging Data Commons and has been funded in whole or in part with Federal funds from the National Cancer Institute, National Institutes of Health, under Task Order No. HHSN26110071 under Contract No. HHSN261201500003l.

openslide's People

Contributors

agoode avatar bgilbert avatar billyoneal avatar hauke76 avatar iewchen avatar j0d0nn avatar jaharkes avatar jcupitt avatar kleisauke avatar malaterre avatar openslide-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openslide's Issues

Add some mechanism for dumping tile positions and metadata as JSON (or XML)

_Imported from Trac. This issue originally by _agoode* at 2010-04-28T14:36:16Z.*

The backends are relatively simple, they are just involved with assembling tiles into an image. A lot of work is involved in figuring out where the tiles actually need to go, and this is done in the vendor parsers. It might be interesting to add an option for the backends to dump out the tile positions as XML. Combined with dumping the properties and other metadata, this might be interesting.

Add man pages for all binaries

_Imported from Trac. This issue originally by _agoode* at 2010-03-04T15:19:29Z.*

We should have man pages for the openslide- tools that are installed.

Add openslide_read_region_with_stride (or something)

_Imported from Trac. This issue originally by _agoode* at 2010-04-28T14:30:44Z.*

It would be nice to be able to read_region into an allocated buffer that is larger than w_h_4. Since we are using cairo now, this should be extremely easy to do.

Be more clear about wholeslide library limitations

_Imported from Trac. This issue originally by _agoode* at 2008-11-06T22:49:59Z.*

Update the documentation in the distribution and the website to explain that we do not tell you about slide metadata at all, and we don't scale the image in any way.

Don't keep the associated images in memory indefinitely

_Imported from Trac. This issue originally by _agoode* at 2010-05-12T23:59:29Z.*

Right now, we load the associated images into memory at the beginning and hold onto them to memcpy them when asked. Now that we have error handling, we can load them on demand and report an error if that fails.

We should still save the dimensions at startup though, since the read_associated_image function does not take dimensions. This should be checked against what we read when called, and fail out if wrong.

Compile win64 binaries

_Imported from Trac. This issue originally by _agoode* at 2010-03-25T19:21:53Z.*

Win32 is not enough these days, we need win64 as well.

Create unit tests

_Imported from Trac. This issue originally by _agoode* at 2010-05-11T14:20:33Z.*

The library is complicated enough, with enough error paths and formats that unit tests should be employed.

Fix seams in Trestle

_Imported from Trac. This issue originally by _agoode* at 2009-12-11T20:04:16Z.*

Currently, we just layer over the tiles with overlaps in Trestle. But the vendor's software appears to do better.

test

_Imported from Trac. This issue originally by _anonymous* at 2010-04-26T20:01:24Z.*

test

Investigate tilehelper's behavior of painting backwards, is it bad for performance?

_Imported from Trac. This issue originally by _agoode* at 2010-06-13T03:41:24Z.*

tilehelper will paint tiles from right to left, bottom to top. This seems to be needed for MIRAX + SATURATE. Is it really? Make sure this is clear in the code.

It seems that reading blocks backward could be a performance issue, especially on something like NGR format that is uncompressed on disk and read one scanline at a time.

Post win32 binaries

_Imported from Trac. This issue originally by _agoode* at 2009-07-17T18:39:44Z.*

Support images with channels != 3

_Imported from Trac. This issue originally by _agoode* at 2010-05-06T16:45:01Z.*

For fluorescence imagery, channels may not equal 3. If channels = 1, then we can use the existing read_region API to produce gray. Otherwise, some new API will need to be invented.

openslide_open may fail if channels != 1 or 3. We may need a new open function as well.

Consolidate more platform-specific stuff into openslide-private.h

_Imported from Trac. This issue originally by _agoode* at 2010-07-14T14:21:04Z.*

From Hauke Heibel:

The inttypes guard (would also be required for stdbool which I removed
from openslide-jdatasrc.c) implies that we might consider providing a
single header file with these includes. Maybe openslide-private is the
one I am thinking about. Then it would be great if it were sufficient
for new modules to include this header file which should take care of
bools and inttypes and maybe also the third party includes. Thus we
could prevent new errors on different systems. Maybe one could also
consider having something like openslide-types that only deals with
the standard includes, bools and inttypes and maybe some macros.

Create openslide-ops-error.c for handing errors

_Imported from Trac. This issue originally by _agoode* at 2008-12-24T01:54:35Z.*

If we get a weird error, like when a file changes after opening, we should do something like cairo does and convert ourselves into an error object. Return 0 for width and height, "" for comment, and black for read_region.

Post openslide-testsuite

_Imported from Trac. This issue originally by _agoode* at 2010-01-28T20:50:50Z.*

The openslide-testsuite contains anonymous pathology specimens useful for testing OpenSlide. It is large, but should be posted.

Add VMU info to the website

_Imported from Trac. This issue originally by _agoode* at 2010-06-01T21:01:33Z.*

Update the wiki to talk about our VMU support.

JPEG file "ends prematurely" -- operation created corrupted results

_Imported from Trac. This issue originally by _anonymous* at 2008-11-05T14:35:00Z.*

For some reason, an operation lead to corrupted files only in slide files I viewed with the wholeslide reader, HAMAMATSU format -- this may have occurred due to exiting the program mid-read during testing? I'm not sure why a file would change when "read"

expose image metadata and label in OpenSlide API

_Imported from Trac. This issue originally by [email protected]* at 2009-05-20T03:14:40Z.*

There should be a mechanism to get misc. image meta data from the slide. OpenSlide Java binding API could for example return a Properties object. Meta data such as microns per pixel (MPP) should be exposed through API.

There is also should be a way to get slide label if that information is available. Aperio .svs images usually have a label embedded in the tiff image. Hammatsu images seem to point to some sort of slide map that contains it.

Don't hold file descriptors open longer than needed

_Imported from Trac. This issue originally by _agoode* at 2010-05-04T17:16:02Z.*

The tiff backend will keep file descriptors open while the tiff object is allocated. This can be a limitation if many slides are read at the same time. I believe the jpeg backend does not do this.

Stop printing out stuff when probing TIFF files

_Imported from Trac. This issue originally by _agoode* at 2010-05-04T17:08:54Z.*

libtiff prints out lots of warnings without our knowledge. If libtiff provided a library- and reentrant-safe way of turning this off, we should do it.

Add guessed MPP property

_Imported from Trac. This issue originally by _agoode* at 2009-11-21T15:12:39Z.*

Add something like "openslide.guessed-mpp" for microns per pixel. I think we know how to do it for a few formats.

MIRAX support

_Imported from Trac. This issue originally by _agoode* at 2009-07-16T18:36:09Z.*

Support MIRAX mrxs files.

ndpi support

_Imported from Trac. This issue originally by _agoode* at 2010-06-21T15:08:29Z.*

There are a few issues with ndpi support. First, we need a custom TIFF parser, libtiff isn't up to the task, since it tries to validate things that we don't want validated. Next, we need a way to munge the JPEG stream to support JPEG files that are beyond the limit. I think once those things are taken care of, just using the existing JPEG backend will work.

Document formats

_Imported from Trac. This issue originally by _agoode* at 2009-11-21T15:11:41Z.*

Put documentation of each format on the website.

Wrong background color leads to blending artifacts

In the CMU-1 dataset, the background is white. In OpenSlide, the destination buffer is set to black and this causes artifacts at the border of the scanmap since white and black pixels are blended resulting in grayish intensities.

As discussed, I tried to set the background color as long as it is defined by the file format. I tried to set the color using cairo functionality and my current implementation can be found at

SHA: hauke76@e69f2eda719294a10a88.

For some reason it does not work. Looking at the destination buffer after the call to cairo_paint, the colors are not set as I expected them to be. I followed the sample given here http://cairographics.org/FAQ/ under "How do I clear a surface?". I did not use source_rgb because I explicitly want to set the alpha value to zero and not to 1.0.

Investigate deploying openslide dll as an SxS assembly on windows

_Imported from Trac. This issue originally by _agoode* at 2010-03-28T14:47:37Z.*

It looks like we might want to bundle up all the dependent DLLs that we will ship into an openslide SxS assembly. Is this a good idea?

It doesn't look like you can have private DLLs within an SxS assembly though, but will it all still work?

Internal filenames should be absolute

_Imported from Trac. This issue originally by _agoode* at 2010-01-27T21:39:31Z.*

Internally, we don't necessarily store filenames as absolute. This should probably be changed for robustness?

Consider reporting performance hints to the user

_Imported from Trac. This issue originally by _agoode* at 2010-05-04T17:11:15Z.*

It may be the case that we can expose some hints to the user via properties that allows greater performance when using openslide. These may include optimal width/height to read, x/y alignment, etc. This could correspond to tiles internally, though many formats have overlaps that would make this less useful.

Support images with channel depths > 8 bit

_Imported from Trac. This issue originally by _agoode* at 2010-05-06T16:43:08Z.*

VMU format is 12-bit RGB. Truncating to 8-bit and using the existing read_region API is good enough for now, but we might want to give access to the higher-depth data in some way.

Get mingw32-openjpeg into Fedora

_Imported from Trac. This issue originally by _agoode* at 2009-07-17T18:36:12Z.*

Specfile is done, just need to get it reviewed.

MIRAX seams are back

_Imported from Trac. This issue originally by _agoode* at 2010-02-19T21:12:07Z.*

MIRAX shows seams on CMU-1.mrsx (and others) while displaying layer 1.

Allow multi-threaded access to TIFF files

_Imported from Trac. This issue originally by _agoode* at 2010-05-04T17:13:42Z.*

libtiff does not allow multi-threaded reading of TIFF files. Either fix libtiff or replace it.

Allow cache customization

_Imported from Trac. This issue originally by _agoode* at 2010-05-04T17:12:56Z.*

Right now, we have a simple per-slide cache that is not shared. There should be a way to allow a user to do caching themselves, or not at all if it is a one-pass run. Perhaps the user can provide a cache themselves, run uncached and cache everything themselves.

consider merging the cairo branch

_Imported from Trac. This issue originally by _agoode* at 2010-06-09T16:44:23Z.*

The cairo branch contains a simple addition of openslide-cairo.h and openslide_cairo_read_region(). Consider merging this, but only after thinking about our assumptions of the image backend. (Mirax for one looks and prints horribly when drawn to PDF.)

Add openslide-write-png

_Imported from Trac. This issue originally by _agoode* at 2010-04-28T03:09:58Z.*

openslide-write-png would be a useful utility program that takes a file and writes out a section of it as a png.

avoid pre-computing optimisation for hamamatsu

_Imported from Trac. This issue originally by [email protected]* at 2008-11-06T12:10:28Z.*

The Hamamatsu format includes a .opt file, for "Optimisation". This lists offsets for some of the restart markers in the jpeg files.

Right now, we don't trust this file, since it only includes offsets for each row, not for each restart marker actually in the jpeg. And it seems the last offset is missing from the file.

Instead of scanning all the jpegs at startup (which is slow and very IO intensive), we should sparsely populate the internal offsets list with what we know is valid, and then fill in the knowledge as we discover more restart markers. Downsides are increased latency once the slide is open since we would now be reading less data up front.

Create simple image viewer in C

_Imported from Trac. This issue originally by _agoode* at 2008-11-06T22:50:35Z.*

Make a little SDL viewer to demonstrate the C library.

Add progress support when opening

_Imported from Trac. This issue originally by _agoode* at 2008-11-20T14:32:15Z.*

ws_open is slow, there should be some mechanism for monitoring open progress. Or just make ws_open fast?

Original email:

The proposal:
+--------------[o][-][x]-+
  Loading Slide
  [XXXXXX   ] 75.2%
+-------------------------+
Please create an iterative loading process for the Wholeslide library that adds these two functions:

ws_open_setup()

ws_open_iterative( .., &float progress ) returns -1 when failed, 0 when
complete, ranking 0-1 floating point approximating progress through files based on lines/total filesize estimates

ws_open_end() if necessary, but might not be

This way I can create a process bar animation occurring during the initial
examination process by running this in a thread before triggering the Viewer widget.

Override jpeg library error functions to avoid exit()

_Imported from Trac. This issue originally by _agoode* at 2008-12-23T18:19:12Z.*

If attempting to read a JPEG that is bad, libjpeg will exit(). This can be avoided with use of setjmp/longjmp and overriding of the error structure. It is very important that the library not exit() unnecessarily.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.