Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generalize (deprecate?) get_xyzt_units #1116

Open
@effigies

Description

Nifti1Header.get_xyzt_units is entirely based on the bitfield as it is implemented in nifti1.h. Attempting to generalize it to Minc (#1098) requires reducing the available information, specifically raising a ValueError if the spatial axes have different units.

I think it makes sense to keep this interface which will be mostly useful, but we could start by generalizing, e.g.,

class HasUnits:
 def get_units(self)
 ...

And keep the old behavior:

 def get_xyzt_units(self):
 all_units = self.get_units()
 spatial_units = ...
 temporal_units = ...
 if len(set(spatial_units)) > 1:
 raise ValueError
 if len(set(temporal_units)) > 1:
 raise ValueError
 return spatial_units[0], temporal_units[0]

OTOH, maybe with get_units(), get_xyzt_units() is redundant and can be deprecated.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /