[ome-users] Possible bug in loci.formats.tools.ImageConverter: width/height calculation in convertTilePlane

Kristian Kjærgaard kkjaergaard at gmail.com
Sat Sep 21 14:09:31 BST 2013


I'm not used to mailing lists and reporting bugs, sorry if I do this in 
a unintended way.

In ImageConverter.java (from 
https://raw.github.com/openmicroscopy/bioformats/develop/components/scifio-tools/src/loci/formats/tools/ImageConverter.java, 
obtained today, 2013 September 21st 14:54 UTC+1), lines 573-574 read:

int tileWidth = x < nXTiles - 1 ? w : width % w;
int tileHeight = y < nYTiles - 1 ? h : height % h;

When processing the last tile in a row:

If the width isn't divisable with tileWidth (like 5 isn't divisable with 
2, we have 1 left), this works fine. But if the width is divisable with 
tileWidth (like 4 is divisable with 2), tileWidth is assigned zero 
(because 4 % 2 is zero). In this case, reader.openBytes(...) failes with 
some large file error.

Sollution:

int tileWidth = x < nXTiles - 1 ? w : width - (w*x);
int tileHeight = y < nYTiles - 1 ? h : height - (h*y);

With these lines (when processing the last tile in a row), tileWidth is 
assigned the remaining width not yet processed.

I'm sorry, I don't know how to apply this to github, but I hope this 
mail is helpful.

- Kristian Kjærgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20130921/0b3b0cf1/attachment.html>


More information about the ome-users mailing list