templateflow / python-client

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

On-the-fly resampling to arbitrary resolutions #43

Open oesteban opened 4 years ago

oesteban commented 4 years ago

Summary

To make the archive more consistent and lightweight, it would be very effective to allow the user to query for arbitrary resolutions.

Implementation details

  1. The TemplateFlow Archive would only keep the highest resolution of any given template. This has two nice side-effects: i) we will not hold-up any template for not having low-resolution conversion --this is, for instance, happening in the case of the UNCInfant template--; and ii) we do not need to have conversions for any object with a conversion at a higher resolution.
  2. The template_description.json should keep the prescriptions of the original lower-resolution conversion (i.e., matrix size, zooms, and origin) so that it is still possible to generate those conversions with the exact same details they were originally designed with.
  3. Whenever the client's API is queried with a resolution: a. If the resolution is the highest, the original template files are returned. b. If the resolution identifier (following BIDS-Derivs conventions) matches one of those kept in the template_description.json file, then resampling is done to that particular resolution. c. If the resolution is some different type of object (we can think of migrating the Space object from niworkflows to here, or some such), then templateflow generates a new resampling scheme that matches whatever the user-specified. This can be just zooms, zooms + shape, and zooms + shape + origin.
  4. Atlases can be queried for just coordinates (i.e., no grid necessary).

Resampling / interpolation

Uses nitransforms with the identity transform.

Potential pitfalls / downsides

This proposal adds enormous flexibility to users, complicating a bit the responsibility to ensure the reproducibility of downstream results. There are some strategies that could help ease this problem (i.e., trying to stick with the defaults whenever possible), this is a feature that could be easily misused.

Upshots

Requesting for comments: @satra, @effigies, @yarikoptic, @wiheto, @rciric.