brainglobe / brainglobe-heatmap

Rendering anatomical heatmaps with brainrender and matplotlib
https://brainglobe.info
MIT License
34 stars 10 forks source link

Coordinates output format #2

Closed FedeClaudi closed 2 years ago

FedeClaudi commented 2 years ago

Following up on: https://github.com/brainglobe/brainrender/pull/186

cc: @vigji

We should discuss how we want to format the output of the regions' coordinates in the 2D plane.

Currently it's a dict of N x 2 arrays, but with an added twist: if after slicing a region's mesh is left in 2 distinct components (e.g. left/right hemisphere) the coordinates for each ''piece'' are saved separately.

Overall we should think about what format should these exported (csv?), how we deal with distinct components (merge?) and if we want to allow for basic transforms like rotations mirroring etc.

vigji commented 2 years ago

Do we want them exported? I was thinking about having the function called at runtime to extract the coordinates upstream from whatever application of the user, without intermediate saving.

For the components, I would just give them by default as lists, normally just of length 1; not only there's the left right situation but the same volume could be cut in N parts also on the same hemisphere, so I'll leave that as an unspecified list.

For the transforms, I get the sense that the user should just be provided with a deterministic way of specifying the position of the cutting plane, and to understand the consequences of defining it in some way. Something like mirroring or rotation would then simply become a matter of adjusting the parameters for the plane definition (inverting point order, or sign of the normal vector).

FedeClaudi commented 2 years ago

I think exporting them would be a useful feature, but I guess people can do that on their own if they want to.

yeah that's fair. I guess we should try to fix things by improving the plane definition/behavior fist.

FedeClaudi commented 2 years ago

Okay, as suggested it exports the coordinates of the sliced mashes as a dictionary region: list[coords1, coords2...] where the coordsX are Nx2 numpy array of coordinates. Thank's to Marco's suggestion in the other discussions there's not need for tansforms as the points come out the right way up.