8000 Should coordmap composition check coordinate system names? · Issue #247 · nipy/nipy · GitHub
[go: up one dir, main page]

Skip to content

Should coordmap composition check coordinate system names? #247

Open

Description

@matthew-brett

At the moment, this gives an error:

import numpy as np

from nipy.core.api import CoordinateSystem, AffineTransform, compose

ijk = CoordinateSystem('ijk', 'voxel')
xyz = CoordinateSystem('xyz', 'world')
ijk_to_xyz = AffineTransform(ijk, xyz, np.eye(4))

pqr = CoordinateSystem('pqr', 'crazy')
ijk2 = CoordinateSystem('ijk', 'another_name')
pqr_to_ijk = AffineTransform(pqr, ijk2, np.eye(4))

pqr_to_xyz = compose(ijk_to_xyz, pqr_to_ijk)

The error is:

ValueError                                Traceback (most recent call last)
<ipython-input-23-42effb708f95> in <module>()
----> 1 pqr_to_xyz = compose(ijk_to_xyz, pqr_to_ijk)

/Users/mb312/usr/local/lib/python2.6/site-packages/nipy/core/reference/coordinate_map.pyc in compose(*cmaps)
1085     allaffine = np.all([isinstance(cmap, AffineTransform) for cmap in cmaps])
1086     if allaffine:
-> 1087         return _compose_affines(*cmaps)
1088     else:
1089         warnings.warn("composition of non-affine CoordinateMaps is "

/Users/mb312/usr/local/lib/python2.6/site-packages/nipy/core/reference/coordinate_map.pyc in _compose_affines(*affines)
1584                                   np.dot(cmap.affine, cur.affine))
1585         else:
-> 1586             raise ValueError("domains and ranges don't match up correctly")
1587     return cur
1588 

ValueError: domains and ranges don't match up correctly

That is because the 'ijk' and 'ijk2' coordinate systems have the same axis names, but different coordinate names. I think we should probably only check the coordinate axis names, not the coordinate system name....

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      0