File tree Expand file tree Collapse file tree 4 files changed +42
-26
lines changed Expand file tree Collapse file tree 4 files changed +42
-26
lines changed Original file line number Diff line number Diff line change 1616.project
1717.pydevproject
1818* .py.orig
19+ .DS_Store
1920
2021# Not sure what the next one is for
2122* .kpf
Original file line number Diff line number Diff line change 1010''' Print nifti diagnostics for header files '''
1111from __future__ import division , print_function , absolute_import
1212
13- import sys
14-
15- from optparse import OptionParser
16-
17- import nibabel as nib
18-
19-
20- def main ():
21- """ Go go team """
22- parser = OptionParser (
23- usage = "%s [FILE ...]\n \n " % sys .argv [0 ] + __doc__ ,
24- version = "%prog " + nib .__version__ )
25- (opts , files ) = parser .parse_args ()
26-
27- for fname in files :
28- with nib .openers .ImageOpener (fname ) as fobj :
29- hdr = fobj .read (nib .nifti1 .header_dtype .itemsize )
30- result = nib .Nifti1Header .diagnose_binaryblock (hdr )
31- if len (result ):
32- print ('Picky header check output for "%s"\n ' % fname )
33- print (result + '\n ' )
34- else :
35- print ('Header for "%s" is clean' % fname )
36-
13+ from nibabel .cmdline .nifti_dx import main
3714
3815if __name__ == '__main__' :
3916 main ()
Original file line number Diff line number Diff line change @@ -153,11 +153,11 @@ def proc_file(f, opts):
153153 return row
154154
155155
156- def main ():
156+ def main (args = None ):
157157 """Show must go on"""
158158
159159 parser = get_opt_parser ()
160- (opts , files ) = parser .parse_args ()
160+ (opts , files ) = parser .parse_args (args = args )
161161
162162 nibabel .cmdline .utils .verbose_level = opts .verbose
163163
Original file line number Diff line number Diff line change 1+ #!python
2+ # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
3+ # vi: set ft=python sts=4 ts=4 sw=4 et:
4+ ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
5+ #
6+ # See COPYING file distributed along with the NiBabel package for the
7+ # copyright and license terms.
8+ #
9+ ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
10+ ''' Print nifti diagnostics for header files '''
11+
12+ import sys
13+ from optparse import OptionParser
14+
15+ import nibabel as nib
16+
17+ __author__ = 'Matthew Brett, Yaroslav Halchenko and Christopher Cheng'
18+ __copyright__ = 'Copyright (c) 2018 Matthew Brett ' \
19+ 'and NiBabel contributors'
20+ __license__ = 'MIT'
21+
22+
23+ def main (args = None ):
24+ """ Go go team """
25+ parser = OptionParser (
26+ usage = "%s [FILE ...]\n \n " % sys .argv [0 ] + __doc__ ,
27+ version = "%prog " + nib .__version__ )
28+ (opts , files ) = parser .parse_args (args = args )
29+
30+ for fname in files :
31+ with nib .openers .ImageOpener (fname ) as fobj :
32+ hdr = fobj .read (nib .nifti1 .header_dtype .itemsize )
33+ result = nib .Nifti1Header .diagnose_binaryblock (hdr )
34+ if len (result ):
35+ print ('Picky header check output for "%s"\n ' % fname )
36+ print (result + '\n ' )
37+ else :
38+ print ('Header for "%s" is clean' % fname )
You can’t perform that action at this time.
0 commit comments