FW: openslide
Villalon, Elena
villalel at umdnj.edu
Mon Nov 29 09:25:44 EST 2010
Hello,I have some troubles with the Java GUI you have developed in openslide. When you reach the highest layer of an image then you can keep zooming out and making the image smaller and smaller until it disappears from the JFrame and, for some of them, it throws an OutOfMemoryException because the array of data is too large; you may solve it increasing the available memory.
>
However, those image frames seem to add no further information. They are
for the highest layer, they request more and more data, and looking at
the GUI the image is just shrinking until it disappears.
I think the reason is because there are two parameters in OpenSlideView that control the zooming maxDownsample and downsampleExponent, which are defaulted to 1.2 and 40, respectively. When you get to the lowest
layer (i.e. layer=0) you may zooming until the downsample oldDS or newDS
is equal to 1.2 and then it stops. However, when you zoom out you may reach a newDS equal to 1.2^40=1469.7715679690841, and the image just disappears from the screen with an OutOfMemoryErrorException because the array of data is too large. If you decrease the exponent to say to 22, then 1.2^22= 55 and you do not have any of the problems mention above but I do not know if it may affects the quality of the image in any other way. So I just stop the zooming out as the code below, but I think it will be better to tune up the maxDownSaple and DownSampleExponent. Please let me know your opinion and if there is an optimal way of choosing those two parameters.
Elena
> Regards
>
> Elena
>
>
>
>
>
> //EV created these new class variables
>
> *private**boolean*firstZoom= *true*;
>
> *double*firstDS;
>
>
>
> *private**void*zoomSlide(*int*mouseX, *int*mouseY, *int*amount) {
>
> *double*oldDS = getDownsample();
>
>
>
>
>
> *int*centerX = mouseX + viewPosition.x;
>
> *int*centerY = mouseY + viewPosition.y;
>
>
>
> *final**double*bx = centerX * oldDS;
>
> *final**double*by = centerY * oldDS;
>
> *double*dold = *this*.osr.getBestLayerForDownsample(oldDS);
>
>
>
> //EV LayerCount is the number of layers in the image; get
> largest layer to stop zooming
>
> *if*(firstZoom&& dold>= (LayerCount-1)){
>
> firstDS= oldDS;
>
> firstZoom=*false*;
>
> }
>
> adjustDownsample(amount);
>
>
>
> *final**double*newDS = getDownsample();
>
> //EV I added this condition so not to make image shrink away
>
> *double*dnew = *this*.osr.getBestLayerForDownsample(newDS);
>
>
>
>
>
> *if*(newDS > firstDS&& dnew>=(LayerCount-1)) {
>
> adjustDownsample(-amount);
>
> *return*;
>
> }
>
>
>
> *if*(oldDS != newDS) {
>
> viewPosition.translate((*int*) Math./round/(bx / newDS) -
> centerX,
>
> (*int*) Math./round/(by / newDS) - centerY);
>
> }
>
> }
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 269 bytes
Desc: signature.asc
Url : http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20101129/c6a947c3/attachment.bin
More information about the openslide-users
mailing list