Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should coordmap composition check coordinate system names? #247

Open
matthew-brett opened this issue Jan 15, 2013 · 0 comments
Open

Should coordmap composition check coordinate system names? #247

matthew-brett opened this issue Jan 15, 2013 · 0 comments

Comments

@matthew-brett
Copy link
Member

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant