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

Melissa Linkert melissa at glencoesoftware.com
Thu Sep 26 00:35:06 BST 2013


Hi Kristian,

> 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.

Thank you very much for reporting this bug, and for proposing a fix.

I have opened a corresponding pull request on GitHub which contains the
fix:

https://github.com/openmicroscopy/bioformats/pull/711

Regards,
-Melissa

On Sat, Sep 21, 2013 at 03:09:31PM +0200, Kristian Kjærgaard wrote:
> 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

> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users




More information about the ome-users mailing list