templateflow / python-client

A python client to query TemplateFlow via pyBIDS
https://templateflow.org/python-client/
Apache License 2.0
8 stars 10 forks source link

On-the-fly atlas combination #100

Open oesteban opened 1 year ago

oesteban commented 1 year ago

I have recently found out that atlas combinations are not so weird. Looking through papers, I found one that used the Schaeffer atlas in combination with the Melbourne subcortical atlas (https://github.com/yetianmed/subcortex),

The idea, @wiheto is that, instead of creating the Smörgåsbord atlas on the fly, the client would compose it for you, provided the atlases you are combining from do not clash (or maybe establishing some simple heuristics).

WDYT?

wiheto commented 1 year ago

Definitely not uncommon. The one thing that was a little more uncommon with the smörgåsbord that I did a few years back was that I was only taking parts of some atlases (I think there were four atlases in total). So for example, I removed the amygdala from the OH atlas and added multiple amygdala ROIs from another amygdala-based atlas.

The smörgågbord functionality I was thinking of was envisioning when we have previously talked about this is exactly as you write now, that you specify atlases and the functionality will create it for you. So something like:

templateflow.smorgasbord(template=xxx, atlas=['Schaeffer, 'Melbourne'])

Should return a image that merges the two atlases (it does not need to be called smorgasbord, merge_atlases is probably better).

However, it can get a little tricky when you get to the "simple heuristics". Sometimes the voxels may overlap between atlases. This is definitely more common in the suborbital regions.The two easiest ways that this can be dealt with is either:

  1. Drop all overlapping voxels.
  2. The order of the atlas last is the priority if there is any overlap.

The benefits of 1 is that it is easier to implement.

The benefits of 2 is that, with a little more work, it will allow you to replace parts of an atlas if you really wanted (e.g. the amygdala example I said above), So:

templateflow.smorgasbord(template=xxx, atlas=['DetailedAmydalaAtlas', 'Schaeffer, 'Melbourne'])

Could prioritize the DetailedAmygdalaAtlas over Melbourne. You would also need to add someway to either automatically delete the amygdala ROI in Melbourne (e.g. if more than 50% is already covered) or allow the user to manually flag they want some ROIs removed. But such use cases may be very niche and unnecessary to implement?