-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support pixelmap annotations #776
Conversation
With `layerParams.keepLower = false`, `pixelmap` layers would disappear if the viewer was zoomed in past the maximum level. (This is possible in HistomicsUI, which is where this issue was observed.
let pixelmapData = pixelmapElement.values; | ||
if (pixelmapElement.boundaries) { | ||
let valuesWithBoundaries = new Array(pixelmapData.length * 2).fill(0); | ||
pixelmapData = valuesWithBoundaries.map((d, i) => pixelmapData[Math.floor(i / 2)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You aren't using the values in the valuesWithBoundaries array. So fill
is a wasted operation. This would probably be better as:
let valuesWithBoundaries = new Array(pixelmapData.length * 2);
for (let i = 0; i < pixelmapData.length; i += 1) {
valuesWithBoundaries[i * 2] = valuesWithBoundaries[i * 2 + 1] = pixelmapData[i];
}
Function calls tend to be slow, so avoiding map
ping something that is potentially millions long is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 89cc536
@@ -129,7 +129,6 @@ var GeojsImageViewerWidgetExtension = function (viewer) { | |||
*/ | |||
_addPixelmapLayerParams(layerParams, pixelmapElement) { | |||
// For pixelmap overlays, there are additional parameters to set | |||
layerParams.keepLower = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need this set to false, since otherwise you'll get off effects if the superpixels are transparent.
I think this was fixed in OpenGeoscience/geojs@7ea4977. Are you on the master build of geojs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm
is telling me that I have [email protected]
, which looks like the latest release.
With layerParams.keepLower = false
, I was seeing a problem in HisotmicsUI where zooming in past the number of levels would cause the pixelmap to disappear until zoomed out again. For example, in my testing I was working with a whole slide image with magnification 20, so HUI allows zooming in to 40x. The pixelmap layer would not be visible when zooming between 20x and 40x.
Without setting keepLower = false
, I did not see that issue. I didn't see any effects (not sure what I should be looking out for though). Is there a better way to allow this kind of zooming while keeping the layer visible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should obviously see the issue if the fill color is transparent and the stroke color is opaque. We either need to change some parameters or there is a bug in GeoJS. I'll investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be a PR in GeoJS shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the issue now. I'll go ahead and add that line back. I'm still not sure how to deal with the issue of zooming "past" the pixelmap layer that I'm seeing in HistomicsUI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenGeoscience/geojs#1178. I'll merge when it passes CI and then it will be available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that PR did the trick. I've added keepLower = false
back in 65ae579
This is actually needed in the case that the pixelmap categories contain a fully transparent fill color and opaque stroke color.
This PR updates the
large_image
plugin to support drawingpixelmap
annotations (see #767).