Closed arrigo55 closed 4 years ago
Hello @arrigo55m,
Sure, try:
vips copy CMU-1.svs[level=2] x.tiff[tile,compression=jpeg]
To pull out level 2 into a jpeg-compressed, tiled tiff.
You could pull out all levels with eg.:
n_levels=$(vipsheader -f openslide.level-count CMU-1.svs)
for level in {0..$((n_levels-1))}; do
vips copy CMU-1.svs[level=$level] x-$level.tiff[tile,compression=jpeg]
done
Thank you John, but with
vips copy CMU-1.svs[level=2] x.tiff[tile,compression=jpeg]
I get the message: tiffload: no property named `level' Regards Arrigo
Il giorno gio 9 gen 2020 alle ore 15:55 John Cupitt < notifications@github.com> ha scritto:
Hello @arrigo55m,
Sure, try:
vips copy CMU-1.svs[level=2] x.tiff[tile,compression=jpeg]
To pull out level 2 into a jpeg-compressed, tiled tiff.
You could pull out all levels with eg.:
n_levels=$(vipsheader -f openslide.level-count CMU-1.svs) for level in {0..$((n_levels-1))}; do vips copy CMU-1.svs[level=$level] x-$level.tiff[tile,compression=jpeg] done
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libvips/libvips/issues/1521?email_source=notifications&email_token=ACORQNT5FXW4T6UKA24BW3LQ443ELA5CNFSM4KEZAS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIQSHVI#issuecomment-572597205, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORQNTX5LKQAZFU2XLEOBLQ443ELANCNFSM4KEZAS5A .
Which libvips version are you using?
8.9.0 has an unfortunate error in openslide handling and you need to use
vips openslideload CMU-1.svs x.tiff[tile,compression=jpeg] --level=2
instead.
If you are using an older libvips, then your libvips has been built without openslide support.
The installed version on MAC is 8.9.0. With:
vips openslideload CMU-1.svs x.tiff[tile,compression=jpeg] --level=2
I get the message:
(vips:15187): Openslide-WARNING **: 11:39:27.079: Downsampled images not correctly ordered: 1 < 16.0019 openslide2vips: unsupported slide format
Apparently Openslide is not recognized, but it is installed. Any suggestion? Arrigo
Il giorno gio 9 gen 2020 alle ore 17:40 John Cupitt < notifications@github.com> ha scritto:
Which libvips version are you using?
8.9.0 has an unfortunate error in openslide handling and you need to use
vips openslideload CMU-1.svs x.tiff[tile,compression=jpeg] --level=2
instead.
If you are using an older libvips, then your libvips has been built without openslide support.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libvips/libvips/issues/1521?email_source=notifications&email_token=ACORQNUKBT6FQ376MIW5EVLQ45HP5A5CNFSM4KEZAS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIQ57DY#issuecomment-572645263, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORQNQ6IYFGC7MVHJBSV7DQ45HP5ANCNFSM4KEZAS5A .
I downloaded this test image:
http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1.svs
Then ran this on my mac:
12:25 $ vips openslideload CMU-1.svs x.tif --level=2
12:25 $ vipsheader x.tif
x.tif: 2875x2057 uchar, 4 bands, srgb, tiffload_source
Perhaps your image is not in a format that openslide supports?
Maybe you have a multiplane svs?
https://github.com/openslide/openslide/issues/31#issuecomment-474055041
You should be able to read the highest detail layer (layer 0).
I am having the similar issue. Using CAMELYON17 Hamamatsu images and working with libvips 8.8.3 from conda forge. I got the tiffload: no property named 'level'
error. Should I install the latest version from releases? Is there any possibility that conda forge will be updated?
It sounds like the conda binary has been built without openslide support.
You'll need to find another binary, or build it yourself. What platform are you using?
Ok, then I will go for the manual install, thanks. I'm using linux (Ubuntu 18.04 LTS and CentOS 7)
Still using libvips 8.8.3 with conda. I used:
vips copy tumor_002.tif[level=1] x.tiff[tile,compression=jpeg]
vips openslideload tumor_002.tif x.tiff[tile,compression=jpeg] --level=1
vips tiffsave tumor_002.tif [level=1] x.tiff --tile --bigtiff --compression=jpeg
and all of them seems to generate the proper tiff file but somehow its corrupted. If I use openslide
and try img.get_thumbnail((224, 224))
it freezes and consume all free memory without giving me the image. However, if tried on the source image it works nicely.
Also tried with --compression=lzw
with same result
The source image is Phillips scanned. Any known issues on it?
vipsheader -a tumor_002.tif
tumor_002.tif: 97792x219648 uchar, 4 bands, rgb, openslideload
width: 97792
height: 219648
bands: 4
format: uchar
coding: none
interpretation: rgb
xoffset: 0
yoffset: 0
xres: 1
yres: 1
filename: tumor_002.tif
vips-loader: openslideload
slide-level: 0
openslide.level-count: 10
openslide.level[0].downsample: 1
openslide.level[0].height: 219648
openslide.level[0].tile-height: 512
openslide.level[0].tile-width: 512
openslide.level[0].width: 97792
openslide.level[1].downsample: 2
openslide.level[1].height: 109824
openslide.level[1].tile-height: 512
openslide.level[1].tile-width: 512
openslide.level[1].width: 48896
openslide.level[2].downsample: 4
openslide.level[2].height: 54912
openslide.level[2].tile-height: 512
openslide.level[2].tile-width: 512
openslide.level[2].width: 24448
openslide.level[3].downsample: 8
openslide.level[3].height: 27456
openslide.level[3].tile-height: 512
openslide.level[3].tile-width: 512
openslide.level[3].width: 12224
openslide.level[4].downsample: 16
openslide.level[4].height: 13728
openslide.level[4].tile-height: 512
openslide.level[4].tile-width: 512
openslide.level[4].width: 6112
openslide.level[5].downsample: 32
openslide.level[5].height: 6864
openslide.level[5].tile-height: 512
openslide.level[5].tile-width: 512
openslide.level[5].width: 3056
openslide.level[6].downsample: 64
openslide.level[6].height: 3432
openslide.level[6].tile-height: 512
openslide.level[6].tile-width: 512
openslide.level[6].width: 1528
openslide.level[7].downsample: 128
openslide.level[7].height: 1716
openslide.level[7].tile-height: 512
openslide.level[7].tile-width: 512
openslide.level[7].width: 764
openslide.level[8].downsample: 256
openslide.level[8].height: 858
openslide.level[8].tile-height: 512
openslide.level[8].tile-width: 512
openslide.level[8].width: 382
openslide.level[9].downsample: 512
openslide.level[9].height: 429
openslide.level[9].tile-height: 512
openslide.level[9].tile-width: 512
openslide.level[9].width: 191
openslide.mpp-x: 0.24309399999999998
openslide.mpp-y: 0.24309399999999998
openslide.quickhash-1: cd13cb888d77890b96200c50ce19c7359c3f8ab01e51a75e6334da66ba3ff10e
openslide.vendor: philips
philips.DICOM_BITS_ALLOCATED: 8
philips.DICOM_BITS_STORED: 8
philips.DICOM_DERIVATION_DESCRIPTION: tiff-useBigTIFF=1-useRgb=0-levels=10003,10002,10000,10001-processing=0-q80-sourceFilename="T14-27071-I1-6"
philips.DICOM_HIGH_BIT: 7
philips.DICOM_LOSSY_IMAGE_COMPRESSION: 01
philips.DICOM_LOSSY_IMAGE_COMPRESSION_METHOD: "PHILIPS_TIFF_1_0"
philips.DICOM_LOSSY_IMAGE_COMPRESSION_RATIO: "3"
philips.DICOM_MANUFACTURER: 3D Histech
philips.DICOM_PHOTOMETRIC_INTERPRETATION: RGB
philips.DICOM_PIXEL_REPRESENTATION: 0
philips.DICOM_PIXEL_SPACING: "0.000243094" "0.000243094"
philips.DICOM_PLANAR_CONFIGURATION: 0
philips.DICOM_SAMPLES_PER_PIXEL: 3
philips.DICOM_SOFTWARE_VERSIONS: "4.0.3"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[0].DICOM_PIXEL_SPACING: "0.000243902" "0.000243902"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[0].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[0].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 97792
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[0].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 0
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[0].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 219648
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[1].DICOM_PIXEL_SPACING: "0.000487805" "0.000487805"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[1].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[1].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 49152
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[1].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 1
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[1].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 110080
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[2].DICOM_PIXEL_SPACING: "0.00097561" "0.00097561"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[2].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[2].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 24576
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[2].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 2
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[2].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 55296
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[3].DICOM_PIXEL_SPACING: "0.00195122" "0.00195122"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[3].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[3].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 12288
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[3].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 3
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[3].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 27648
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[4].DICOM_PIXEL_SPACING: "0.00390244" "0.00390244"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[4].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[4].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 6144
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[4].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 4
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[4].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 13824
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[5].DICOM_PIXEL_SPACING: "0.00780488" "0.00780488"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[5].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[5].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 3072
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[5].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 5
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[5].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 7168
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[6].DICOM_PIXEL_SPACING: "0.0156098" "0.0156098"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[6].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[6].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 1536
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[6].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 6
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[6].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 3584
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[7].DICOM_PIXEL_SPACING: "0.0312195" "0.0312195"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[7].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[7].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 1024
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[7].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 7
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[7].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 2048
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[8].DICOM_PIXEL_SPACING: "0.062439" "0.062439"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[8].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[8].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 512
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[8].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 8
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[8].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 1024
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[9].DICOM_PIXEL_SPACING: "0.124878" "0.124878"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[9].PIIM_DP_PIXEL_DATA_REPRESENTATION_POSITION: "0" "0" "0"
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[9].PIIM_PIXEL_DATA_REPRESENTATION_COLUMNS: 512
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[9].PIIM_PIXEL_DATA_REPRESENTATION_NUMBER: 9
philips.PIIM_PIXEL_DATA_REPRESENTATION_SEQUENCE[9].PIIM_PIXEL_DATA_REPRESENTATION_ROWS: 512
philips.PIM_DP_IMAGE_COLUMNS: 97792
philips.PIM_DP_IMAGE_ROWS: 219648
philips.PIM_DP_IMAGE_TYPE: WSI
philips.PIM_DP_SOURCE_FILE: %FILENAME%
philips.PIM_DP_UFS_INTERFACE_VERSION: 3.0
philips.UFS_IMAGE_PIXEL_TRANSFORMATION_METHOD: 0
tiff.ResolutionUnit: inch
tiff.Software: Philips DP v1.0
slide-associated-images: macro
Also, the output image seems to have the correct information in it:
vipsheader -a x.tiff
tumor_002_20X.tiff: 48896x109824 uchar, 3 bands, srgb, tiffload
width: 48896
height: 109824
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 1
yres: 1
filename: tumor_002_20X.tiff
vips-loader: tiffload
n-pages: 1
resolution-unit: cm
orientation: 1
What do you mean by the image being corrupted? Is there an error message, or do you see visible errors?
You could try forcing bigtiff, if you are going over the 2GB mark in your output file. If you are seeing visible damage, it could be a pixman bug, in which case try building with an older version.
I'd try nip2 for viewing the output image.
"Corrupted" maybe was maybe not the best work, sorry for the misunderstanding.
I tried to open it with QuPath ang GIMP and both give me errors.
However, searching and trying a little I found that adding --pyramid
seems to solve the issue:
vips tiffsave tumor_002.tif [level=1] x.tiff --tile --compression=jpeg --pyramid
However when I check its properties:
vipsheader -a x.tiff
tumor_002_20X.tiff: 48896x110592 uchar, 3 bands, srgb, tiffload
width: 48896
height: 110592
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 1
yres: 1
filename: tumor_001.tiff
vips-loader: tiffload
n-pages: 11
resolution-unit: cm
orientation: 1
It seems now that I have 1 more pages
(like level
I guess) is this due to the pyramid resizing to fit in tiff
right? Since level=0
has the right dimensions is not so important :smile:
Yes, --pyramid
will write a set of pages shrinking by x2 each time, with the full res image as page 0.
You won't be able to open huge TIFF images for viewing with gimp or qupath. Try nip2, it should handle this OK. It can view slide images directly as well.
I don't know if libvips can do this kind of operation. Any suggestion?