Open surchs opened 3 years ago
This is a bit similar to the reverse_y
option. Maybe we can generalize this. I wonder if it's possible (and sensible) to do the flip by configuring the axii.
AFAICT there is no way to "just flip the x and y axii". So I think the best way to go about this is to flip the images at the server side (right before encoding it to base64). This also means that we need to take this into account in a couple of places.
Also, people adding additional traces to the figure (with the new extra_traces
property) should take into account that it is flipped. But this is probably fine.
I think that would be a good solution. Would you add this as a flag for only this specific case (i.e. rotate 90 degrees) or more generally and let the users pick (e.g. let users pick the in plane rotation or pass a function that does it)?
Good question. If we only allow a 90 degree rotation, someone else is bound to ask for a rotation of -90 at some point. A function is probably to general, since we must take the rotation into account internally.
What about an argument rotate
that can be -1
, 0
or 1
. Together with the reverse_y
, that gives 6 possible configurations, and I think, all possible configurations that people could reasonably want.
Or maybe orientation
? Or another name?
I think a keyword like pre-rotate
or rotation
is great. It'd be great if the acceptable values can be human readable, but as we are handling 3D volumes, maybe words like "left", or "clockwise" aren't super intuitive? I guess we could just say in the docstring: "allows in-plane rotations by 90 degrees, either clockwise or counterclockwise" would be pretty straightforward. What do you think?
Well, this orientation is in the 2D plane, so words like that should be fine. So one of:
@emmanuelle opinions?
Human brain MRI volumes are generally organized in the R-A-S orientation in voxel space, i.e. moving along the volume axes moves through the "real world" image in Right-Left, Anterior-Posterior, Superior-Inferior directions respectively. And if the data were not oriented as expected, nilearn offers a way to try to get them there.
To display slices from these volumes in the expected display conventions (that differ somewhat between radiologists and neurologists): , we need to flip them by 90 degrees. Here is a short example to show this:
This looks like so:
This "flip the slice by 90 degrees before displaying" is also what nilearn does in it's plotting tools:
Since we aren't displaying static images of single slices, I think it'd be best to allow the user to ask us to flip the slices before displaying on the dash-slicer side of things.