brainreg
brainreg copied to clipboard
Support registration of partial images
As with amap
Hi Adam. I think we'd like to go ahead and see if we can get this masking approach sorted. I'm happy to try and give adding the functionality in a bash.
Hey @wudustan, awesome. There are some old ideas in this issue but the specific implementation would need to be updated for brainreg.
@vigji did you end up getting anywhere registering hemispheres?
I think a lot of the work can be done by masking/cropping the target_brain
array, somewhere around here. Passing that array to run_niftyreg
should hopefully take care of the registration (with some parameter tweaks), but then the deformation field (from sample to atlas space) would need to be edited to ensure that the target space was the full atlas, and not the hemispheres.
Thanks for that. How would you like to proceed? I'm still trying to understand exactly how the deformation field step works.
The deformation field is saved as three separate 3D tiff files, each of which are the same size and shape as the downsampled raw data. They act as a look up, so that for each coordinate in your (downsampled) raw data, you can find the position in atlas space (in mm), in axis 0, 1 and 2 (in each of the files).
If you only pass part of the atlas to the registration step, you should be able to convert the resulting files into a format that is compatible with the "normal" case of using the entire atlas. Then the rest of the pipeline should work as normal. For the images in atlas space, this would be adding padding of the same shape and size that you "cut" from the atlas array in the beginning. For the deformation field, I think something like this should work:
- Only right hemisphere - do nothing
- Only left hemisphere - Add
atlas image width / 2
(in mm) todeformation_field_2.tiff
- For other, arbitrary volumes, do something similar, but in whichever of 3 dimensions are needed.
Does any of this make sense? Maybe if you could give the masking a go, and submit a PR we can discuss?
Hi,
has there been any progress on this issue? we currently are trying to do registration on some of our partial brain acquisition and were wondering if this could be the reason why we are not getting a more precise registration?
Thanks!
No progress yet. I don't have the time to work on it yet. Hoping someone can spare a couple of weeks to get this working.
Hi, Have there been any updates on this issue? I'd like to register a mouse-brain hemisphere to one of the atlases (e.g. allen 25um), and was wondering if there is a way to do this.
Unfortunately not @vv-21. Waiting/hoping for someone to have a bit of free time to tackle this.
#49 I am linking my old issue here for reference.
I think I'll give this a try. @adamltyson would you be willing to spend 20 min on zoom with me so that I expose my idea, I'd like to have your feedback on it.
@JulesScholler sure, I'll email you.
I gave a thumbs up to this issue, and wanted to express interest in it. The description isn't detailed, so I'll explain what would be useful to us. We acquire a single slice of a brain, some 10s or 100um thick. Would it be feasible to register such a slice using the implementations being proposed?
Hi @chrisroat, unfortunately this issue relates to 3D registration, but of some volume less than a whole brain (e.g. hemisphere, or some other big "chunk"). If you have a section (unless it's >1mm thick), that's essentially a 2D registration problem that brainreg isn't set up to handle. For 2D data I would recommend ABBA (@NicoKiaru has started looking into linking up ABBA and BrainGlobe).
I suppose it's still 3d, since you have to find it's full orientation in the atlas. But I get that just a dozen voxels in z (at 10um res) may not contain a lot of information.
I will check out ABBA, though at first pass the docs look to be serial datasets (not just a single slice), but maybe it would work.
@chrisroat I didn't test it, but ABBA can somewhat handle 'small sections'. What it will do is just use the middle plane for the registration.
Hi @JulesScholler,
referring to your comment
#49 I am linking my old issue here for reference.
I think I'll give this a try. @adamltyson would you be willing to spend 20 min on zoom with me so that I expose my idea, I'd like to have your feedback on it.
did you succeed in subregion/hemisphere registration?
@drchrisch - as far as I know, this feature hasn't been implemented by anyone yet.
Because nobody is really interested (unfortunately, I happen to have a number of hemispheres to work on), it is totally meaningless, it would require rebuilding everything from scratch?
It wouldn't require rewriting brainreg, but it isn't trivial. There would be a bit of work to add the necessary code (maybe a day once familiar with the codebase?), but then there may be a lot of parameter optimisation to work with the different input data.
It seems there were attemps to include hemisphere registration, but no one really accomplished. Could you suggest another implementation of this supposedly simple registration task?
I'm not aware of any tools that specifically support partial images I'm afraid.
Ok, I see. Your comment
It wouldn't require rewriting brainreg, but it isn't trivial. There would be a bit of work to add the necessary code (maybe a day once familiar with the codebase?), but then there may be a lot of parameter optimisation to work with the different input data.
suggests that simple masking would not work and fiddling with nifty settings would be needed. Sounds time-consuming even if one would restrict work to just the hemisphere case and exclude other possible sub-regions somewhere between (thick) slice and full brain.
I think that's correct, but as I haven't tried it I can't be sure. I would be surprised if masking only would work "out of the box".
Thanks to @JulesScholler, there is some progress on this issue. There is now some functionality to register single hemispheres. There is now an additional --brain_geometry
flag. The default is full
, but you can also choose hemisphere_l
or hemisphere_r
to specify a single brain hemisphere.
This functionality hasn't been released yet, but if anyone wants to try it out, you can install from github with pip install git+https://github.com/brainglobe/brainreg
.
I'd appreciate any user testing, there's likely to lots of further optimisation to be done.
May scrap this general issue in favour of creating workflows within napari that allow use of other registration tools with BG atlases.
However, thanks to @JulesScholler the hemisphere registration seems to work well: https://docs.brainglobe.info/brainreg/user-guide#misc-options
Closing in favour of https://github.com/brainglobe/brainglobe-registration