AvScale output

41 views
Skip to first unread message

Marcel Falkiewicz

unread,
May 21, 2013, 8:08:31 AM5/21/13
to nipy...@googlegroups.com
Hello,
 I'm trying to use the rotation and transformation matrix, which is output by AvScale() as input for applyxfm. However, AvScale() returns a list, which applyxfm does not tolerate as in_matrix_file (which is not surprising at all). How to convert the output of AvScale to file, so I can use it as an input to applyxfm?

Cheers,
 Marcel

Satrajit Ghosh

unread,
May 23, 2013, 5:54:14 PM5/23/13
to nipy-user
hi marcel,

the easiest thing might be to add a function node with the following function

```
from nipype.interfaces.utility import Function
from nipype.pipeline.engine import Node

def matrix_to_file(matrix):
    import numpy as np
    import os
    filename = os.path.join(os.getcwd(), 'matrix.txt')
    np.savetxt(filename, matrix, fmt='%.10f', delimiter=' ')
    return filename

converter = Node(Function(input_names['matrix'], output_names['matrix_file'], 
                          function=matrix_to_file), 
                 name='avscale2txt')
```
you might need to change the savetxt function to match flirt's expected format.

cheers,

satra



--
 
---
You received this message because you are subscribed to the Google Groups "NiPy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nipy-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Marcel Falkiewicz

unread,
May 24, 2013, 4:27:35 AM5/24/13
to nipy...@googlegroups.com
Thank you Satra! This solves the problem :-)


2013/5/23 Satrajit Ghosh <sa...@mit.edu>
Reply all
Reply to author
Forward
0 new messages