This file is indexed.

/usr/bin/nipy_4dto3d is in python-nipy 0.3.0-1ubuntu2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
37
38
39
40
41
#!/usr/bin/python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
DESCRIP = 'Read 4D image file and write 3D nifti file for each volume'
EPILOG = \
'''nipy_4dto3d will generate a series of 3D nifti images for each volume a 4D
image series in any format readable by `nibabel`.
'''
from os.path import splitext, join as pjoin, split as psplit

import nibabel as nib

from nipy.externals.argparse import (ArgumentParser,
                                     RawDescriptionHelpFormatter)


def main():
    parser = ArgumentParser(description=DESCRIP,
                            epilog=EPILOG,
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument('filename', type=str,
                        help='4D image filename')
    parser.add_argument('--out-path', type=str,
                        help='path for output image files')
    args = parser.parse_args()
    out_path = args.out_path
    img = nib.load(args.filename)
    imgs = nib.four_to_three(img)
    froot, ext = splitext(args.filename)
    if ext in ('.gz', '.bz2'):
        froot, ext = splitext(froot)
    if not out_path is None:
        pth, fname = psplit(froot)
        froot = pjoin(out_path, fname)
    for i, img3d in enumerate(imgs):
        fname3d = '%s_%04d.nii' % (froot, i)
        nib.save(img3d, fname3d)


if __name__ == '__main__':
    main()