Skip to content
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

Communicate truncated 64 bit segmentation #4598

Merged
merged 20 commits into from
May 27, 2020
Merged

Conversation

youri-k
Copy link
Contributor

@youri-k youri-k commented May 5, 2020

URL of deployed dev instance (used for testing):

Steps to test:

  • abc

Issues:


MichaelBuessemeyer and others added 2 commits April 23, 2020 21:53
* not working as intended as the segmentation is 32 bit for the frontend
Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend LGTM and works for me :)

@MichaelBuessemeyer MichaelBuessemeyer marked this pull request as ready for review May 7, 2020 13:38
@MichaelBuessemeyer
Copy link
Contributor

@daniel-wer Would you please check the frontend part?

@@ -433,10 +433,14 @@ function setupLayerForVolumeTracing(
const fallbackLayerIndex = _.findIndex(layers, layer => layer.name === tracing.fallbackLayer);
const fallbackLayer = layers[fallbackLayerIndex];
const boundaries = getBoundaries(dataset);
// The frontend does not support uint64 data. Thus if the segmentation is uint64
// we treat it as uint32 and save that it originally has the element class uint64.
const isUint64Segmentation = tracing.elementClass === "uint64";
Copy link
Contributor Author

@youri-k youri-k May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is tracing.elementClass referring to, the elementClass or the originalElementClass?
The backend converts an elementClass of uint64 to uint32, so the elementClass value should never be uint64.
This is how we achieved the original cheap uint64 support, see #4233. If you want to, the backend can send the real elementClass to the frontend, which would mean we could rid of the originalElementClass in the backend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is in case of volume tracings (as opposed to view mode). the tracing still sends the uint64.
but yeah, feel free to unify this in whichever way seems best :)

Copy link
Member

@fm3 fm3 May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to be extra careful before allowing 64 bit volume tracings, as they will probably mix 32 bit and 64 bit data. But this PR mainly deals with the view mode, right @MichaelBuessemeyer ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I got no mail notification that youri posted this concern 😕.

But this PR mainly deals with the view mode, right @MichaelBuessemeyer ?

No it doesn't This PR also enables 64-bit volume tracings in the frontend. If we do not what this behaviour (and that's what I think is your opinion) we just have to remove the changes in lines 436-438, 442. Then the user will get a warning upon opening a volume tracing.

@youri: When the user creates a volume tracing the backend creates an empty tracing (maybe including a fallback layer). At this point the backend seems inconsistent, because trying to create a volume tracing on a dataset with a uint64-bit segmentation layer will set the elementClass of the initial tracing to elementClass. At least that's what I remember and why I needed to add the lines 436-438, 442.

According to the suggestion to always send the 64-bit element class as the property elementClass and getting rid of originalElementClass: This should be possible :).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thank you for your reply!

We should extensively test the 64 bit volume tracing, especially with how fallback layer data is incorporated into the tracing, and if this works with #4602
But yeah, let’s try it :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a conversation with Youri and we decided it would be preferrable not to allow 64-bit volume tracings yet.

While the trouble with their data being in 32 bit and the fallback buckets being 64 bit is invisible in the wK frontend, since the fallback buckets will be truncated to 32 bit, the data will not actually be compatible, it will not actually be clear which ID should belong to which cell.

Additionally, saving 32 bit data labeled as 64 bit data can lead to incompatibilities in case the frontend in some future version using some future javascript features actually produces 64 bit data. Then our implicit knowledge becomes ambiguous.

Since no user has yet wished for volume tracings with 64 bit fallback layer, and this PR was originally only about the user notification about truncated data, please remove the changes you mentioned, @MichaelBuessemeyer , so that the user can not trace on 64 bit volume tracings. Additionally, @youri-k , please add an check in the back-end side creation of volume tracings, so that 64 bit volume tracings can not be created.

@MichaelBuessemeyer
Copy link
Contributor

MichaelBuessemeyer commented May 14, 2020

@daniel-wer Could you please review the frontend part of this PR?

I added the optional originalElementClass property to the segmentation layer type. This makes it possible to know that the original element class on the server is unit64 and not the truncated uint32 type.

Just saving the uint64 as the elementClass might make things a bit more complicated because we have to touch all the code that relies on the fact that the element class of the segmentation can never be uint64.

The conversion of type uint64 to uint32 is not done for the segmentation layer if we have a volume tracing as volume tracings for uint64 segmentation data are currently not allowed.

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelBuessemeyer Frontend looks good to me, I added a couple of suggestions. I couldn't test yet, but will report back after the CI run was successful :)

frontend/javascripts/messages.js Outdated Show resolved Hide resolved
@@ -295,6 +295,24 @@ function initializeDataset(
dataSet: dataset.dataSource.id.name,
});

// Here we add the originalElementClass property to the segmentation layer if it exists.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a matter of personal preference, but I think usually comments should short and concise, so Add the original ... instead of Here we add the original .... Please drop the we from the other comments as well. Apart from that, the comments are written very well 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for that feedback. I'll pay attention to that 🙂

@@ -434,9 +452,13 @@ function setupLayerForVolumeTracing(
const fallbackLayer = layers[fallbackLayerIndex];
const boundaries = getBoundaries(dataset);

// We do not adjust the elementClass here if it is uint64, because uint64 volume tracings are not supported.
// Not adjusting the elementClass will cause the later check for supported layer element classes to fail
// if the segmentation of type uint64.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// if the segmentation of type uint64.
// if the segmentation is of type uint64.

const tracingLayer = {
name: tracing.id,
elementClass: tracing.elementClass,
originalElementClass: tracing.elementClass,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the originalElementClass need to be set here at all? In the type definition it's declared as optional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you are correct. I'll revert the changes here 👍

<React.Fragment>
{title}{" "}
<Tooltip title={message["tracing.uint64_segmentation_warning"]}>
<Icon type="info-circle" style={{ color: "rgb(255, 155, 85)" }} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use warning as the type instead. That would better fit with the color and the intention of this message to warn the user that the displayed ids may not be correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that makes sense 🤯

@daniel-wer
Copy link
Member

Testing went well 👍

@youri-k How much effort would it be to make this error message a little more helpful and display the actual error message concerning the uint64 layer instead of the generic one in the top level? It's fine if it's not feasible, I just wanted to check :)

uint64_error

@fm3
Copy link
Member

fm3 commented May 19, 2020

I think it should be relatively easy to move the “because you are not a memeber of a team that has access” down into the debug info chain (so that it only shows when it is actually true).
This way the top-level error stays the generic »failed to create annotation« but upon expanding the correct reason is available.
We could even consider renaming the expand button to »show more information« rather than just »debug« because I think there are a number of occasions where this info is also helpful to the user (or at least their team manager).
What do you think?

@youri-k
Copy link
Contributor Author

youri-k commented May 19, 2020

I'll do the suggested changes and I'm also in favor of renaming the expand button.

@MichaelBuessemeyer
Copy link
Contributor

@daniel-wer Could you please check the few changes I pushed?

Copy link
Member

@daniel-wer daniel-wer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelBuessemeyer Frontend, LGTM 👍

@youri-k
Copy link
Contributor Author

youri-k commented May 20, 2020

This should be good to go, or @MichaelBuessemeyer?

@MichaelBuessemeyer
Copy link
Contributor

If the backend part is also approved then sure 🎉

@MichaelBuessemeyer
Copy link
Contributor

@youri-k Is the backend part also approved?

@youri-k youri-k merged commit 9bb14a6 into master May 27, 2020
@philippotto philippotto deleted the communicate-truncated-uint64 branch June 14, 2022 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Communicate to the user if 64 bit segmentation ids are truncated to 32 bit
4 participants