ENH: Separate Space
and SpatialReferences
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Okay, after much thinking, I believe this captures the whole set of requirements.
Now there is an
Space
object that makes all the validations and sanity checks. There is still room for enhancements:We might want to implement a classmethod (something likeDONESpace.from_string
) that implements the parsing of--output-spaces
arguments (see https://www.attrs.org/en/stable/init.html).Other than that, I think the doctest examples show pretty much all the functionality.
Then, the
SpatialReferences
class is the one in charge of sorting out the available spaces. It has three convenience methods to filter out references:get_std_spaces()
returns template names (including cohort if necessary) that is of interest to the spatial normalizations that sMRIPrep will run.get_templates()
returns fullSpace
objects with the desired outputs, as set by the user.get_nonstd_spaces()
returns nonstandardSpace
s or their names (depending on theonly_names
argument)