-
Notifications
You must be signed in to change notification settings - Fork 24
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
Display warning when resolution gets too low during zooming #6255
Display warning when resolution gets too low during zooming #6255
Conversation
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.
Very cool stuff! I left some comments to tweak the feature a bit :)
@Dagobert42 awesome stuff 🎉 I just tested it out and tweaked some small things, since they caught my eye:
|
…b.com:scalableminds/webknossos into show-warning-when-zooming-z1-downsampled-data
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.
really hyped about this :) see my last two suggestions, though 🤓
CHANGELOG.unreleased.md
Outdated
@@ -11,6 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released | |||
[Commits](https://github.com/scalableminds/webknossos/compare/22.06.0...HEAD) | |||
|
|||
### Added | |||
Added a warning for when the resolution in the XY viewport on z=1-downsampled datasets becomes too chunky, explaining the problem and how to mitigate it. [#6255](https://github.com/scalableminds/webknossos/pull/6255) |
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.
Added a warning for when the resolution in the XY viewport on z=1-downsampled datasets becomes too chunky, explaining the problem and how to mitigate it. [#6255](https://github.com/scalableminds/webknossos/pull/6255) | |
Added a warning for when the resolution in the XY viewport on z=1-downsampled datasets becomes too low, explaining the problem and how to mitigate it. [#6255](https://github.com/scalableminds/webknossos/pull/6255) |
for (let i = 0; i < 2; i++) { | ||
const voxelPerPixelXY = currentZoomStep / currentRes[i]; | ||
if (voxelPerPixelXY < minVoxelPerPixel) { | ||
Toast.warning(messages["dataset.z1_downsampling_hint"], { | ||
sticky: true, | ||
key: "DOWNSAMPLING_CAUSES_BAD_QUALITY", | ||
onClose: setUserClosedWarningTrue, | ||
}); | ||
} else { | ||
Toast.close("DOWNSAMPLING_CAUSES_BAD_QUALITY"); | ||
} | ||
} |
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.
The Toast.warning
and Toast.close
calls should not happen in the for loop (right now, one dimension could have a poor quality, but the other dimension could immediately close the notification again). Since the for-loop only has two iterations, it might be easier to write it like this:
const showWarning = (currentZoomStep / currentRes[0] < minVoxelPerPixel) || (currentZoomStep / currentRes[1] < minVoxelPerPixel);
if (showWarning) {
...
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.
True, I believe I was originally thinking about iterating over the z dimension as well, but I guess there's really no use-case for that 😅
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.
Actually, this also solves the linter complaining about multiple instantiations of the arrow function (which was the reason for setUserClosedWarningTrue) 👍
@@ -284,6 +284,8 @@ instead. Only enable this option if you understand its effect. All layers will n | |||
"This dataset location is marked as 'scratch' and meant for testing only. Please move this dataset to a permanent storage location and reimport it.", | |||
"dataset.resolution_mismatch": | |||
"This dataset contains multiple layers which differ in their resolution. Please convert the layers to make their resolutions match. Otherwise, rendering errors cannot be avoided.", | |||
"dataset.z1_downsampling_hint": | |||
"The currently rendered quality is not optimal due to the available magnifications and the viewport arrangement. To improve the quality try to increase the size of the XY viewport (e.g. by maximizing it).", |
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.
@fm3 do you want to have a look at the wording? :) this is currently what @Dagobert42 and I came up with, but I know that you have a good eye for improving messages towards conciseness :)
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 the message is already very good, but I notice it is very general.
I’d say that the constant_z downsampling is a very special case and could be explicitly mentioned? “For datasets that were not downsampled in z, it is recommended to view only the XY viewport.” – what do you think?
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.
The current code simply checks the rendered quality (ratio of #data_voxels to #rendered_pixels) and does not check whether the dataset was z1 downsampled. Therefore, the message is a bit generic. However, it would probably be alright to use your suggestion, anyway, since the quality should not drop for another reason 🤷 I don't have a strong opinion on this..
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.
Yeah, I already guessed that this may be the reason. Let’s stick with the original message then, not risking false positives there :)
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.
"The current resolution of the XY viewport is not optimal because the dataset is not downsampled along the Z-axis. To improve the quality try to increase the size of the XY viewport (e.g. by maximizing it)."
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.
Maybe this could be a short, yet more specific compromise?
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.
Awesome 🎉 Works great 👍 I'm already accepting it, but let's wait for @fm3's opinion on the wording before merging.
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)