The problem is in openslide-vendor-aperio.c at line 358. When adding associated images, it assumes that if it has only seen one level, then the associated image is the thumbnail. So when there is only one level, each associated image in turn is put into the thumbnail slot.<div>
<br></div><div>I guess it is written this way because the image description for the thumbnail is in a different format than the image description for the other associated images, and the parsing in add_associated_image() will not work for the thumbnail. I'm not sure what the fix might be. Perhaps the parser in add_associated_image() could be smarter, or the default at line 358 could be taken only if there is not already an associated image.</div>
<div><br></div><div>Kent<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 6, 2012 at 4:32 PM, Kent Johnson <span dir="ltr"><<a href="mailto:kent3737@gmail.com" target="_blank">kent3737@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried saving as SVS:JPEG. The key issue seems to be whether there are multiple levels. If I save a small image in SVS:JPEG format, so it has only one level (plus thumbnail, label and macro images), OpenSlide behaves as I described before - it ignores the true thumbnail and the label image and returns the macro image as the thumbnail. If I save a larger image with two levels, OpenSlide behaves correctly.<span class="HOEnZb"><font color="#888888"><div>
<br></div><div>Kent</div></font></span><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 6, 2012 at 12:59 PM, Cornwell, Carl (NIH/NLM/LHC) [C] <span dir="ltr"><<a href="mailto:ccornwell@mail.nih.gov" target="_blank">ccornwell@mail.nih.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It looks like you selected Output/Compression as TIF:LZW - is that correct? If so, can you redo the export with Output/Compression set to SVS:JPEG or SVS:JPEG2000?<br>
<br>
The OpenSlide code (openslide-vendor-aperios.c) accepts the current file as Aperio based only on the appearance of "Aperio" in the image description, then applies various checks which initially pass and identify the components correctly - so, in theory it should correctly assign the sub-images in your file. However, it looks like the LZW compression may be causing some problems - note the unrecognized tag 347 - although I can't see exactly why in the code.<br>
<br>
Perhaps one of the experts will chime in soon.<br>
<br>
--<br>
Carl Cornwell<br>
Contractor<br>
Lister Hill National Center For<br>
Biomedical Communications<br>
National Library of Medicine<br>
8600 Rockville Pike<br>
Bldg. 38A, Room 10S1015D<br>
Bethesda, MD 20894<br>
Voice <a href="tel:%28301%29%20435-5187" value="+13014355187" target="_blank">(301) 435-5187</a><br>
<br>
________________________________<br>
From: Kent Johnson [<a href="mailto:kent3737@gmail.com" target="_blank">kent3737@gmail.com</a>]<br>
Sent: Tuesday, November 06, 2012 10:22 AM<br>
To: <a href="mailto:openslide-users@lists.andrew.cmu.edu" target="_blank">openslide-users@lists.andrew.cmu.edu</a><br>
Subject: Reading file exported from Aperio ImageScope<br>
<div><div><br>
Hi,<br>
<br>
I'm trying to use OpenSlide (openslide-win32-20120908) to read a partial-slide TIFF file exported from Aperio ImageScope. The file is recognized as an Aperio file but the component images are not interpreted correctly.<br>
<br>
The first image is read by OpenSlide as the level 0 image. The second image is a thumbnail. The third image is a label image and the fourth is a macro image. OpenSlide ignores the second and third images and uses the macro image as the thumbnail.<br>
<br>
My expectation is that the second image would be used as the thumbnail and the label and macro images would be included as associated images. Is this something that should work correctly or am I stretching OpenSlide a bit too much?<br>
<br>
Below is the tiffinfo output for the image.<br>
<br>
Thanks,<br>
Kent<br>
<br>
TIFF Directory at offset 0xc7563e<br>
Subfile Type: (0 = 0x0)<br>
Image Width: 3278 Image Length: 3026 Image Depth: 1<br>
Tile Width: 240 Tile Length: 240<br>
Bits/Sample: 8<br>
Compression Scheme: LZW<br>
Photometric Interpretation: RGB color<br>
Image Description: "Aperio Image Library v11.2.1 \r\n68340x43430 [49868,23390 3278x3026] (240x240) LZW;Aperio Image Library v8.0<br>
.19\n69360x43530 [0,0 68340x43430] (240x240) JPEG/RGB Q=70|AppMag = 20|StripeWidth = 2034|ScanScope ID = PHUSCA-W20585|Filename =<br>
13203|Title = none|Date = 01/03/07|Time = 14:09:11|User = f92fa4e0-e189-4a07-bb9b-095c3f5bbde4|MPP = 0.4667|Left = 9.760571|Top =<br>
22.175273|LineCameraSkew = 0.000000|LineAreaXOffset = 0.000000|LineAreaYOffset = 0.000000|DSR ID = 192.168.2.102|ImageID = 13203|O<br>
riginalWidth = 69360|Originalheight = 43530|OriginalWidth = 68340|OriginalHeight = 43430"<br>
Samples/Pixel: 3<br>
Planar Configuration: single image plane<br>
Predictor: horizontal differencing 2 (0x2)<br>
TIFF Directory at offset 0xd93922<br>
Subfile Type: (0 = 0x0)<br>
Image Width: 831 Image Length: 768 Image Depth: 1<br>
Bits/Sample: 8<br>
Compression Scheme: LZW<br>
Photometric Interpretation: RGB color<br>
Image Description: "Aperio Image Library v11.2.1 \n3278x3026 -> 831x768 - ;Aperio Image Library v8.0.19\n69360x43530 [0,0 68340x<br>
43430] (240x240) JPEG/RGB Q=70|AppMag = 20|StripeWidth = 2034|ScanScope ID = PHUSCA-W20585|Filename = 13203|Title = none|Date = 01<br>
/03/07|Time = 14:09:11|User = f92fa4e0-e189-4a07-bb9b-095c3f5bbde4|MPP = 0.4667|Left = 9.760571|Top = 22.175273|LineCameraSkew = 0<br>
.000000|LineAreaXOffset = 0.000000|LineAreaYOffset = 0.000000|DSR ID = 192.168.2.102|ImageID = 13203|OriginalWidth = 69360|Origina<br>
lheight = 43530|OriginalWidth = 68340|OriginalHeight = 43430"<br>
Samples/Pixel: 3<br>
Rows/Strip: 3<br>
Planar Configuration: single image plane<br>
Predictor: horizontal differencing 2 (0x2)<br>
TIFF Directory at offset 0xdb0ede<br>
Subfile Type: reduced-resolution image (1 = 0x1)<br>
Image Width: 356 Image Length: 320 Image Depth: 1<br>
Bits/Sample: 8<br>
Compression Scheme: LZW<br>
Photometric Interpretation: RGB color<br>
Image Description: "Aperio Image Library v11.2.1 \nlabel 356x320"<br>
Samples/Pixel: 3<br>
Rows/Strip: 7<br>
Planar Configuration: single image plane<br>
Predictor: horizontal differencing 2 (0x2)<br>
TIFFReadDirectory: Warning, exported from ImageScope 13203.tif: unknown field with tag 347 (0x15b) encountered.<br>
TIFF Directory at offset 0xdbcd6c<br>
Subfile Type: reduced-resolution image (9 = 0x9)<br>
Image Width: 640 Image Length: 246 Image Depth: 1<br>
Bits/Sample: 8<br>
Compression Scheme: JPEG<br>
Photometric Interpretation: RGB color<br>
YCbCr Subsampling: 2, 2<br>
Image Description: "Aperio Image Library v11.2.1 \nmacro 640x246"<br>
Samples/Pixel: 3<br>
Rows/Strip: 16<br>
Planar Configuration: single image plane<br>
Tag 347: <unsupported data type in TIFFPrint><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>