-
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
Make mappings work with 8 and 16 bit segmentations #3953
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.
Thanks for delving into this! The changes look really good.
One thing, though: Can you search for const isMergerModeSupported =
and adapt that code? The merger mode is currently disabled for 8 and 16 bit segmentations, but that can be undone now 🎉 :)
return vec4(bucketColor.b, bucketColor.a, bucketColor.b, bucketColor.a); | ||
} | ||
} | ||
|
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 add a comment line here stating that the following code deals with packingDegree == 4.0? :) Took me a few seconds to figure out why there isn't a if (packingDegree == 4.0) {
statement.
@@ -207,6 +207,14 @@ export const getColorForCoords: ShaderModule = { | |||
|
|||
float rgbaIndex = linearizeVec3ToIndexWithMod(offsetInBucket, bucketWidth, packingDegree); | |||
|
|||
if (packingDegree == 2.0) { | |||
if (rgbaIndex == 0.0) { | |||
return vec4(bucketColor.r, bucketColor.g, bucketColor.r, bucketColor.g); |
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.
Why is the pattern rgrg
? Can't wrap my head around it right now :)
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 added a comment :)
Getting a vec4 using texture2d from a 2-channel texture (as in the case of 16-bit segmentations) will return a vector like (a,a,a,b), which is why the binary search for mappings on the shader failed (as an exact match of (a,b,0,0) would be needed). I solved this by allowing a new packingDegree of 2 for 16-bit layers and by transforming the volume_color before using the mapping binary search (according to the packing degree).
Therefore, 8-bit segmentations which have a packingDegree of 4 should now work as well.
URL of deployed dev instance (used for testing):
Steps to test:
webknossos.apiReady(3).then(async (api) => {api.data.setMapping(api.data.getVolumeTracingLayerName(), {1: 2, 2: 3}, {hideUnmappedIds: true})})
Issues: