Skip to content

Commit 1a688f5

Browse files
committed
RF: refactor, rename nifti diagnostic script
Script didn't have any usage, help, etc. Stolen from nib-ls. Renamed to nib-nifti-dx to fit with our new naming scheme.
1 parent 97f2e82 commit 1a688f5

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

bin/nib-nifti-dx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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()

bin/nifti1_diagnose.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)