-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Description
When trying to write a black-white tif file (a tumor mask for breast cancer H&E slides) I am running into an error which I have been trying to solve for the last few hours, but to no avail. I was wondering if you would happen to know what could be the cause of this. I have also tried to solve it by replacing it with a conda installation, but with the same result.
- example tif file and code included below
Installation information
linux: 5.8.14-arch1-1
python: 3.8
vips: https://github.com/libvips/libvips/releases/download/v8.11.2/vips-8.11.2.tar.gz
libjpeg: libjpeg-turbo8-dev
ibgtk2.0-dev
libgsf-1-dev
libtiff5-dev
pyvips: 2.1.15
sample code:
mask_fname = 'tumor_010_mask.tif'
image = pyvips.Image.new_from_file(mask_fname)
# does not work, gives TIFFFillTile errors
arr = np.ndarray(buffer=image.write_to_memory())
# does not work, gives TIFFFillTile errors
image.write_to_file('test.tif')
Whenever I try to run the above sample code, I get the following errors:
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-29-21eb559af30f> in <module>
1 image = pyvips.Image.new_from_file(mask_fname, access=pyvips.Access.SEQUENTIAL)
2
----> 3 arr = np.ndarray(buffer=image.write_to_memory(),
4 dtype=dict_inverse(dtype_to_format)[image.format],
5 shape=[image.height, image.width, image.bands])
/usr/local/lib/python3.8/site-packages/pyvips/vimage.py in write_to_memory(self)
619 pointer = vips_lib.vips_image_write_to_memory(self.pointer, psize)
620 if pointer == ffi.NULL:
--> 621 raise Error('unable to write to memory')
622 pointer = ffi.gc(pointer, glib_lib.g_free)
623
Error: unable to write to memory
TIFFFillTile: 0: Invalid tile byte count, tile 0
TIFFFillTile: 0: Invalid tile byte count, tile 1
TIFFFillTile: 0: Invalid tile byte count, tile 2
TIFFFillTile: 0: Invalid tile byte count, tile 3
TIFFFillTile: 0: Invalid tile byte count, tile 4
TIFFFillTile: 0: Invalid tile byte count, tile 5
TIFFFillTile: 0: Invalid tile byte count, tile 6
.
.
.
TIFFFillTile: 0: Invalid tile byte count, tile 189
TIFFFillTile: 0: Invalid tile byte count, tile 190
Metadata
Metadata
Assignees
Labels
No labels