scalableminds / webknossos

Visualize, share and annotate your large 3D images online
https://webknossos.org
GNU Affero General Public License v3.0
130 stars 24 forks source link

Add "Rotate" button to dataset layers #7334

Open philippotto opened 1 year ago

philippotto commented 1 year ago

Detailed Description

The user should be able to rotate dataset layers on the fly. The rotation should probably be persisted. Implementation-wise the existing affine transformations can be used. ~One important aspect might be that skeleton layers don't know anything about transformations, yet. This means that the nodes would stay at their current position when rotating layers.~ transforms should work with nodes currently. however, one cannot modify the skeleton layer if it's rendered with transforms.

Context

See https://scm.slack.com/archives/C5AKLAV0B/p1694764730277899

MichaelBuessemeyer commented 4 weeks ago

@hotzenklotz What about this ThreeJs example? https://threejs.org/examples/misc_controls_transform.html

We could use that in a smaller scale, show a cube with marked surfaces and only enable the rotation controls. If the controls are too quirky they can be replaced with three and sliders ranging from 0 to 360 and the three scene is only used for displaying what the will be rendered.

Moreover, I'd like to try to add some kind of camera to the scene so the user can see what to expect.

Another idea would be to have a small annotation view (3 rectangles) like the ortho viewports in which the current "cube with marked surfaces" is rendered according to the current settings

Kinda like this: Image (Note: I did not check whether that's a possible valid orientation)

hotzenklotz commented 4 weeks ago
  1. The ThreeJS example is really cool. The code for that is also fairly small (<200LOC) so that could be a viable option.
  2. Regardless of the preview/threejs/etc, I would always have a synced number input so that a) the users can double check any changes made with actual numbers or b) input the numbers directly if they know them already.
  3. I always images this feature/setting to be in a settings pages somewhere. So, I would not show/preview any actual data but just the generic "texture" with the colored viewport names XY, etc.

I personally find the rotating, interactive cube preview (threejs) easier for my brain than to imagine the XZ plane in the XY viewport (like in you mockup above). But I could imaging other people feeling differently about this.

MichaelBuessemeyer commented 4 weeks ago

Additional idea form @valentin-pinkau: have a unrotated semi-transparent cube that shows the initial rotation for the proposed visualization.

Moreover, valentin also mentioned that a visualization may not be necessary. Instead the user would switch a few times between the settings and viewing the dataset until the wanted orientation is reached.

One open question that came up is whether to only allow rotations of multiples of 90 degrees or also something arbitrary inbetween

hotzenklotz commented 4 weeks ago

Moreover, valentin also mentioned that a visualization may not be necessary. Instead the user would switch a few times between the settings and viewing the dataset until the wanted orientation is reached.

Yes, the first and easiest version can just be number inputs. For some people that will be enough. For some not. See the case of @Tobias314 trying to rotate a datasets together with Anna and how hard it was to communicate right.

One open question that came up is whether to only allow rotations of multiples of 90 degrees or also something arbitrary inbetween

Any interactive preview/widget probably should be align to 90°. A number input probably does not need this. If people want to do arbitrary rotation in a number inputs (and we support this kind of transformation) then it should be fine.

MichaelBuessemeyer commented 1 week ago

More implementation details were discussed here: https://scm.slack.com/archives/C5AKLAV0B/p1731504476951809