Problem using Crop On Import from LOCI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem using Crop On Import from LOCI

Olivier Burri
Hello,

I'm using Crop On Import in Loci BioFormats (More Specifically, Ext.openSubImage()) to open a very large .vsi file from an Olympus OlyVIA slide scanner.

Everything works well globally, but when I look more closely at the area I'm cropping, it doesn't match the data properly.

Suppose I have an image which is 4608x4608 pixels and that I have a thumbnail for it that is 512x512 pixels
(This file is uploaded onto the Loci-Server under "VSI Bug FluoCells.rar").

Now I make a box at (0,0) of width and height = 50 in the thumbnail image.
The coordinates on the full size image would be:
X: 4608/512 * 0 = 0
Y: 4608/512 * 0 = 0
W: 4608/512 * 50 = 450
H: 4608/512 * 50 = 450

By using crop on import with this, I get the expected result.

Now if I select a box atthe bottom-right corner of the image of the same size:
The box is at (462,462) and has width and height = 50 again
The coordinates on the full size image would be: (For the crop on import)
X: 4608/512 * 462 = 4158
Y: 4608/512 * 462 = 4158
W: 4608/512 * 50 = 450
H: 4608/512 * 50 = 450

The top-left coordinate of the box is (On the full image) (4158,4158)
The top-right coordinate of the box is (On the full image) (4608,4608)

Which means I should get exactly the bottom right edge of the original image

Instead I get the image you see in annex. The coordinates are off by a few hundred pixels (281 to be precise).

Would anyone know how to fix that?

Best,

Oli

ImageOffsetBug.jpg (38K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem using Crop On Import from LOCI

Melissa Linkert-2
Hi Oli,

> I'm using Crop On Import in Loci BioFormats (More Specifically, Ext.openSubImage()) to open a very large .vsi file from an Olympus OlyVIA slide scanner.
>
> Everything works well globally, but when I look more closely at the area I'm cropping, it doesn't match the data properly.
>
> Suppose I have an image which is 4608x4608 pixels and that I have a thumbnail for it that is 512x512 pixels
> (This file is uploaded onto the Loci-Server under "VSI Bug FluoCells.rar").
>
> Now I make a box at (0,0) of width and height = 50 in the thumbnail image.
> The coordinates on the full size image would be:
> X: 4608/512 * 0 = 0
> Y: 4608/512 * 0 = 0
> W: 4608/512 * 50 = 450
> H: 4608/512 * 50 = 450
>
> By using crop on import with this, I get the expected result.
>
> Now if I select a box atthe bottom-right corner of the image of the same size:
> The box is at (462,462) and has width and height = 50 again
> The coordinates on the full size image would be: (For the crop on import)
> X: 4608/512 * 462 = 4158
> Y: 4608/512 * 462 = 4158
> W: 4608/512 * 50 = 450
> H: 4608/512 * 50 = 450
>
> The top-left coordinate of the box is (On the full image) (4158,4158)
> The top-right coordinate of the box is (On the full image) (4608,4608)
>
> Which means I should get exactly the bottom right edge of the original image
>
> Instead I get the image you see in annex. The coordinates are off by a few hundred pixels (281 to be precise).
>
> Would anyone know how to fix that?

Thanks for reporting this.  The problem is that the full resolution
image is not actually 4608 x 4608, but rather 4327 x 4327.  What happens
is that the image is stored as a set of tiles (9 x 9 tiles of 512 x 512
pixels each), with the image being padded by 0-valued pixels as needed
to make up the difference between the real size and the tile dimensions.
That's why you see the black border on the bottom and right-hand side of
the full resolution image.

Obviously, that's not quite right, so the soon-to-be-released 4.4
version of Bio-Formats will fix this to return a 4327 x 4327 image with
the padding properly stripped away.  You will need to adjust your
calculations accordingly, but otherwise it should just work.

Regards,
-Melissa

On Fri, May 18, 2012 at 12:18:33PM +0000, Burri Olivier wrote:

> Hello,
>
> I'm using Crop On Import in Loci BioFormats (More Specifically, Ext.openSubImage()) to open a very large .vsi file from an Olympus OlyVIA slide scanner.
>
> Everything works well globally, but when I look more closely at the area I'm cropping, it doesn't match the data properly.
>
> Suppose I have an image which is 4608x4608 pixels and that I have a thumbnail for it that is 512x512 pixels
> (This file is uploaded onto the Loci-Server under "VSI Bug FluoCells.rar").
>
> Now I make a box at (0,0) of width and height = 50 in the thumbnail image.
> The coordinates on the full size image would be:
> X: 4608/512 * 0 = 0
> Y: 4608/512 * 0 = 0
> W: 4608/512 * 50 = 450
> H: 4608/512 * 50 = 450
>
> By using crop on import with this, I get the expected result.
>
> Now if I select a box atthe bottom-right corner of the image of the same size:
> The box is at (462,462) and has width and height = 50 again
> The coordinates on the full size image would be: (For the crop on import)
> X: 4608/512 * 462 = 4158
> Y: 4608/512 * 462 = 4158
> W: 4608/512 * 50 = 450
> H: 4608/512 * 50 = 450
>
> The top-left coordinate of the box is (On the full image) (4158,4158)
> The top-right coordinate of the box is (On the full image) (4608,4608)
>
> Which means I should get exactly the bottom right edge of the original image
>
> Instead I get the image you see in annex. The coordinates are off by a few hundred pixels (281 to be precise).
>
> Would anyone know how to fix that?
>
> Best,
>
> Oli