Page 1 of 1

NDPI to TIF

PostPosted: Mon Jan 30, 2017 11:56 am
by swvanderlaan
Hi,

We're using a new Hamamatsu C12000-22 scanner to scan our slides. The output is .NDPI. I'm now trying to convert this to proper TIF files that can be handled by our downstream pipeline (https://github.com/bglnelissen/slideToolkit).

I've found a tool NDPITools which seems to do the job in theory. I use the following command:

Code: Select all
for FILE in $(ls); do echo "* Processing sample [ ${FILE} ]."; ndpi2tiff -t ${FILE} ; done


It seems to work just fine. But when I now use 'slideThumb' from 'slideToolKit' it throws an error:

Code: Select all
MissingRequired: TIFF directory is missing required "TileOffsets" field.


I understand this actually originates from 'LibTIFF': http://libtiff.maptools.org/man/TIFFReadDirectory.3tiff.html.
So, I guess 'openslide' now doesn't understand these newly created TIFF-files because the tiles are there, but it is unclear how they relate to each other? Or am I misinterpreting the error?

Can anyone perhaps give a pointer as to how to solve this issue?

Thanks!

Sander

Below the contents of the newly created TIF-file:

### openslide-show-properties (openslide) ###########################
MissingRequired: TIFF directory is missing required "TileOffsets" field.
openslide.comment: 'x40 z0'
openslide.level-count: '1'
openslide.level[0].downsample: '1'
openslide.level[0].height: '60928'
openslide.level[0].tile-height: '16'
openslide.level[0].tile-width: '4096'
openslide.level[0].width: '69632'
openslide.vendor: 'generic-tiff'
tiff.DateTime: '2017:01:26 08:59:06'
tiff.ImageDescription: 'x40 z0'
tiff.Make: 'Hamamatsu'
tiff.Model: 'C12000-22'
tiff.ResolutionUnit: 'centimeter'
tiff.Software: 'NDP.scan 3.1.9'
tiff.XResolution: '43968'
tiff.YResolution: '43967'

### tiffinfo (libtiff) ##############################################
MissingRequired: TIFF directory is missing required "TileOffsets" field.
TIFF Directory at offset 0x17c20702 (398591746)
Image Width: 69632 Image Length: 60928
Tile Width: 4096 Tile Length: 16
Resolution: 43967 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x40 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x1e242d7a (505687418)
Image Width: 34816 Image Length: 30464
Tile Width: 2048 Tile Length: 16
Resolution: 21983 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x20 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x1ffd3e0e (536690190)
Image Width: 17408 Image Length: 15232
Tile Width: 1024 Tile Length: 16
Resolution: 10991 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x10 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x2098c2ec (546882284)
Image Width: 8704 Image Length: 7616
Tile Width: 512 Tile Length: 16
Resolution: 5495 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x5 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x20d3f898 (550762648)
Image Width: 4352 Image Length: 3808
Tile Width: 256 Tile Length: 16
Resolution: 2747 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x2.5 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x20ed37ce (552417230)
Image Width: 2176 Image Length: 1904
Tile Width: 128 Tile Length: 16
Resolution: 1373 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x1.25 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x20f8e79c (553183132)
Image Width: 1088 Image Length: 952
Tile Width: 64 Tile Length: 16
Resolution: 686 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
YCbCr Subsampling: 1
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: x0.625 z0
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
TIFF Directory at offset 0x20fa2026 (553263142)
Image Width: 1161 Image Length: 398
Tile Width: 256 Tile Length: 256
Resolution: 153 pixels/cm
Bits/Sample: 8
Compression Scheme: JPEG
Photometric Interpretation: YCbCr
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Planar Configuration: single image plane
Reference Black/White:
0: 0 255
1: 128 255
2: 128 255
ImageDescription: macroscopic
Make: Hamamatsu
Model: C12000-22
Software: NDP.scan 3.1.9
DateTime: 2017:01:26 08:59:06
JPEG Tables: (574 bytes)

### identify (ImageMagick) ##########################################
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[0] TIFF 69632x60928 69632x60928+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[1] TIFF 34816x30464 34816x30464+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[2] TIFF 17408x15232 17408x15232+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[3] TIFF 8704x7616 8704x7616+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[4] TIFF 4352x3808 4352x3808+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[5] TIFF 2176x1904 2176x1904+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[6] TIFF 1088x952 1088x952+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF[7] TIFF 1161x398 1161x398+0+0 8-bit sRGB 553.3MB 0.000u 0:00.009
identify: TIFF directory is missing required "TileOffsets" field. `MissingRequired' @ error/tiff.c/TIFFErrors/569.
### file ##########################################
/Users/swvanderlaan/Library/Mobile Documents/com~apple~CloudDocs/Genomics/Project ExpressScanning/Scripts & Development/Hamamatsu/test_originals/AE101.T02-19407.CD34.20170123.TIF: TIFF image data, little-endian

Re: NDPI to TIF

PostPosted: Tue Jan 31, 2017 5:09 pm
by sbesson
Hi,

your interpretation of the error is probably correct as some IFD is missing a tag preventing OpenSlide from operating on the file. `tiffinfo -s` could give extra diagnostics about the strip offsets and sizes. As this is a third party tool, you might want to report the issue directly to the maintainer of the NDPITools.

As an alternative for converting NDPI images to TIFF, have you tried using Bio-Formats and more specifically the bfconvert utility? It is routinely used by several people in our community and I also expect the output to have been used by applications like OpenSlide.

Best,
Sebastien

Re: NDPI to TIF

PostPosted: Tue Jan 31, 2017 6:51 pm
by swvanderlaan
Thanks for the confirmation. I have the suspicion that perhaps this information is already missing in the NDPI file. Or do you think that is impossible?

Does
Code: Select all
bfconvert
work on NDPI files? If so, I will certainly give that a try.

Thanks again

Re: NDPI to TIF

PostPosted: Tue Jan 31, 2017 6:55 pm
by rleigh
bfconvert works with all file types supported by Bio-Formats.