File: tff_simple_compare.py

package info (click to toggle)
python-trx-python 0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 408 kB
  • sloc: python: 3,394; makefile: 66
file content (36 lines) | stat: -rwxr-xr-x 1,127 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python

""" Simple comparison of tractogram by subtracting the coordinates' data.
Does not account for shuffling of streamlines. Simple A-B operations.

Differences below 1e^3 are expected for affine with large rotation/scaling.
Difference below 1e^6 are expected for isotropic data with small rotation.
"""

import argparse

from trx.workflows import tractogram_simple_compare


def _build_arg_parser():
    p = argparse.ArgumentParser(description=__doc__,
                                formatter_class=argparse.RawTextHelpFormatter)

    p.add_argument('in_tractograms', nargs=2, metavar='IN_TRACTOGRAM',
                   help='Tractogram filename. Format must be one of \n'
                        'trk, tck, vtk, fib, dpy, trx.')
    p.add_argument('--reference', metavar='REFERENCE',
                   help='Reference anatomy for tck/vtk/fib/dpy file\n'
                   'support (.nii or .nii.gz).')
    return p


def main():
    parser = _build_arg_parser()
    args = parser.parse_args()

    tractogram_simple_compare(args.in_tractograms, args.reference)


if __name__ == "__main__":
    main()