openslide / openslide

C library for reading virtual slide images
https://openslide.org/
GNU Lesser General Public License v2.1
409 stars 226 forks source link

Support images with multiple main images #99

Open zeeMonkeez opened 12 years ago

zeeMonkeez commented 12 years ago

Many of my scans from a Leica SCN400 (in .scn format) have multiple scan regions, and are thus reported by openslide-show-properties as "Found multiple main images" and cannot be opened.

bgilbert commented 12 years ago

Could you post an example file (or send me one privately)?

zeeMonkeez commented 12 years ago

Sent a ~600MB example file via a dropbox service to your github email.

bgilbert commented 12 years ago

Thanks for the report and sample. Fixing this will require some additional API, the details of which are still being worked out.

In the short term, we could allow the file to be opened, but only provide access to the first scan region. However, I'm not sure how useful that would be.

zeeMonkeez commented 12 years ago

Thanks for working on it. I guess it'd still be useful, as I need to organise a collection of scans without access to SlidePath. Thanks again.

bgilbert commented 12 years ago

You can pull the short-term fix from the leica-allow-multiple-main branch of bgilbert/openslide. I'm not targeting it for master for now.

andor-pierdelacabeza commented 12 years ago

I had problems to make deepzoom files with vips out of leica files because of this. Leica files has multiple levels, so when I make a 'dzsave', it chooses the first one (the smaller) for doing the conversion, when I need, in fact, the bigger one.

Once I built your branch, it began working properly.

Thanks a lot for the fix. :+1:

Any expectation on getting this on main or having your branch up to date with the rest? Thank you again!

bgilbert commented 12 years ago

Without the fix, OpenSlide refuses to open the file. VIPS then interprets it as an ordinary TIFF and gives you the first TIFF directory, which happens to be the thumbnail.

A proper fix for this issue will require API changes that won't happen for a while yet. In the interim, I'm hesitant to have OpenSlide just return the first main image (as the branch does) because of the potential for confusion.

bgilbert commented 11 years ago

Partially fixed in master. We now render Leica regions onto a canvas the size of the entire slide. If there are multiple regions, we render them in the appropriate places.

Some Leica slides have multiple regions scanned with different objectives, and the pyramid levels from these regions are actually interleaved. (For example, one might have levels at 40/10/2.5 and another at 20/5/1.25.) We currently reject those slides pending the API support described above.

jacksonofalltrades commented 9 years ago

Any idea when full API support will be added for multiple regions?

bgilbert commented 9 years ago

It's a pretty major project, since multiple regions, multiple focal planes, arbitrary color channels for fluorescence imaging, and possibly high-bit-depth support are all tangled up together. (I'd rather not bolt extension after extension onto the API, each addressing only a part of the problem.) I expect it to happen eventually, but I don't have an ETA.

bgilbert commented 9 years ago

Added sample slides: Leica-2 has multiple pyramids with coplanar levels, and Leica-3 has multiple pyramids with non-coplanar levels.

UbiCue commented 8 years ago

Has the leica-allow-multiple-main branch mentioned on 9/20/2012 since been brought into the master branch, or was another approach used to provide Leica support in more recent versions of Openslide?

bgilbert commented 8 years ago

leica-allow-multiple-main wasn't (and won't be) merged to master, because it ignored extra main images without notifying the user. The partial fix mentioned in https://github.com/openslide/openslide/issues/99#issuecomment-24486004 is 8d2d98136e50f167dd76b8b8156f12498b0c6a56, which is included in 3.4.0 and above. The only Leica files still affected by this issue are those with multiple main images scanned at different resolutions, which OpenSlide won't support until the API can be extended.

allanw1 commented 7 years ago

With the release of the Versa, more labs will start generating these kinds of files. The Versa always does a scan at 1.25x before doing the chosen magnification. I think there wouldn't be many people mixing magnifications and stacking them in one region. Instead of doing a full implementation, is it possible to get a workaround that just ignores everything except the highest magnification and then composite all of the regions together?

bgilbert commented 7 years ago

@allanw1 Could you post the slide XML from such a file? You can extract it with tiffinfo.

allanw1 commented 7 years ago

I'll email you a link to this small sample file. My current workaround is to use ImageScope to export it as an .svs file and then use openslide on that (at the same time reducing this 40x scan to a 20x image).

$ openslide-show-properties test_small.scn openslide-show-properties: test_small.scn: Slides with dissimilar main images are not supported $ identify test_small.scn test_small.scn[0] TIFF64 5633x12121 5633x12121+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[1] TIFF64 2816x6060 2816x6060+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[2] TIFF64 1408x3030 1408x3030+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[3] TIFF64 704x1515 704x1515+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[4] TIFF64 352x757 352x757+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[5] TIFF64 176x378 176x378+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[6] TIFF64 215x150 215x150+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[7] TIFF64 10018x10011 10018x10011+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[8] TIFF64 5009x5005 5009x5005+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[9] TIFF64 2504x2502 2504x2502+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[10] TIFF64 1252x1251 1252x1251+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[11] TIFF64 626x625 626x625+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000 test_small.scn[12] TIFF64 313x312 313x312+0+0 8-bit DirectClass 50.04MB 0.000u 0:00.000

bgilbert commented 7 years ago

@allanw1 Thanks for the samples. Despite the error message, this is actually a different problem, which I've filed as #189. The low-resolution image exists in older slides as well, and OpenSlide has special-case code to expose it as a macro image. Apparently the file format changed a bit and OpenSlide isn't recognizing the macro image for what it is. That should be relatively easy to fix.