Closed almarklein closed 3 years ago
Thanks for the issue. What would be passed to Javascript for mask
would be b64 image strings I guess? Therefore the memory cost is the same whether the image string is created from a multichannel or single-channel array.
in terms of user-facing API probably 2) will be a more common case I guess. I'd vote for 2).
@surchs @nicholas-esterer please chime in!
What would be passed to Javascript for mask would be b64 image strings I guess?
For now, yes, but I'm hoping that we can keep this an implementation detail, so it can be changed without affecting the public API.
Proposal pr: #18
Would masks have to be the same size as the volume already in the slicer? Or could we specify an offset to upload smaller masks?
In the proposed PR the mask has to match the shape of the volume. But we could allow for an offset, if we want. I can imagine that being handy to be more memory efficient ...
Opened PR for the covid app, to show what it currently looks like: https://github.com/plotly/dash-sample-apps/pull/525
Would masks have to be the same size as the volume already in the slicer? Or could we specify an offset to upload smaller masks?
It'd be worth checking the performance burden of passing empty arrays for "uninteresting" parts of the mask. From what I remember from your tests @nicholas-esterer, the resulting b64 image strings are tiny but it still takes some time to do the serialization. With the current approach of passing not all the data to the client but only what is needed (plus some caching) this could be different now...
We could also test, per slice, whether the overlay is all zeros in the alpha channel, and just send null
in that case, skipping the encoding step.
The slicer needs to be able to overlay segmentation data (e.g. masks). Two suggestions:
With 1) the user has somewhat more flexibility, but the user would have to compose the mask, and the memory cost is high. With 2) we can still support multiple "layers", by allowing the mask to be integer, we can provide a default colormap or allow providing a single color to make single-layer masks easier.
Maybe there are other ideas?