File tree Expand file tree Collapse file tree 2 files changed +39
-21
lines changed Expand file tree Collapse file tree 2 files changed +39
-21
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env 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
+
14
+ from optparse import OptionParser
15
+
16
+ import nibabel as nib
17
+
18
+
19
+ def main ():
20
+ """ Go go team """
21
+ parser = OptionParser (
22
+ usage = "%s [FILE ...]\n \n " % sys .argv [0 ] + __doc__ ,
23
+ version = "%prog " + nib .__version__ )
24
+ (opts , files ) = parser .parse_args ()
25
+
26
+ for fname in files :
27
+ fobj = nib .volumeutils .allopen (fname )
28
+ hdr = fobj .read (nib .nifti1 .header_dtype .itemsize )
29
+ result = nib .Nifti1Header .diagnose_binaryblock (hdr )
30
+ if len (result ):
31
+ print 'Picky header check output for "%s"\n ' % fname
32
+ print result
33
+ print
34
+ else :
35
+ print 'Header for "%s" is clean' % fname
36
+
37
+
38
+ if __name__ == '__main__' :
39
+ main ()
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments