forked from rordenlab/dcm2niix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'v1.0.20200427-207-g66a4fd0' into debian
* commit 'v1.0.20200427-207-g66a4fd0': (76 commits) Philips ASL in temporal order (rordenlab#533) Optional compilation to disable kludge for issue 532, e.g. "make CFLAGS=-DmyDisableGEPEPolarFlip" (rordenlab#532) 0020,9157 if dcuncat, use 0020,0013 if 0019,10A2; 0020,0100; 2005,1063; 2005,1413 do not vary (rordenlab#529) Add BIDS ArterialSpinLabelingType field Diagnostics for issue 529 (rordenlab#529) Flip row order for kGE_EPI_PEPOLAR_REV Detect and correct GE epi_pepolar sequence (rordenlab#532) More CT meta data, detect manufacturer MEDISO Philips ASL volume order (rordenlab#529) ensureSequentialSlicePositions verbosity Handle Philips images where 2005,1063 is set to zero for all volumes, see Magdeburg_2014 from dcm_qa_philips Philips MR 51.0 @baxpr kludge (rordenlab#529) Remove redundancy Kludge for Philips random instance numbers (rordenlab#529) BUG: Fix preprocessor conflict. Support ancient Linux, tested on holy-build-box (rordenlab#531) undefine DT_NONE (https://neurostars.org/t/adjusting-for-negative-mosaicrefacqtimes-issue-271-warning-but-with-normal-slice-times/19866/3) UIH new TotalReadoutTIme formula (rordenlab#531) UIH uodates Allow acquisition number (0020,0012) in filename (rordenlab#526) ...
- Loading branch information
Showing
17 changed files
with
13,543 additions
and
12,450 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python | ||
"""extract_units.py - extract BIDS/README.md's units as json | ||
Usage: | ||
extract_units.py [-e EXISTING -o OUT] [MD] | ||
extract_units.py (-h|--help|--version) | ||
Arguments: | ||
MD: A Markdown input file including tables with Field and Unit as the | ||
first two columns. | ||
[default: README.md] | ||
Options: | ||
-h --help Show this message and exit. | ||
--version Show version and exit. | ||
-e EXISTING --ex=EXISTING Extract units for all the fields, and only the | ||
fields in EXISTING, a BIDS file, and write the | ||
output to | ||
EXISTING.replace('.json', '_units.json') | ||
instead of stdout. | ||
-o OUT --out=OUT If given, save the output to this filename. | ||
(Overrides the implicit destination of -e.) | ||
""" | ||
from __future__ import print_function | ||
try: | ||
import json_tricks as json | ||
except ImportError: | ||
try: | ||
import simplejson as json | ||
except ImportError: | ||
# Not really compatible with json_tricks because it does not support | ||
# primitives=True | ||
import json | ||
import sys | ||
|
||
# Please use semantic versioning (API.feature.bugfix), http://semver.org/ | ||
__version__ = '0.0.0' | ||
|
||
|
||
def extract_units(mdfn): | ||
units = {} | ||
intable = False | ||
with open(mdfn) as md: | ||
for line in md: | ||
if line.startswith('|'): | ||
parts = [s.strip() for s in line.split('|')[1:-1]] | ||
if parts[:2] == ['Field', 'Unit']: | ||
intable = True | ||
elif intable and parts[1] and not parts[1].startswith('-'): | ||
units[parts[0]] = parts[1] | ||
else: | ||
intable = False | ||
return units | ||
|
||
|
||
def main(mdfn, existing=None, outfn=None): | ||
units = extract_units(mdfn) | ||
if existing: | ||
with open(existing) as f: # Can't count on having json_tricks. | ||
used = json.load(f) | ||
units = {k: v for k, v in units.items() if k in used} | ||
if not outfn: | ||
outfn = existing.replace('.json', '_units.json') | ||
outtext = json.dumps(units, indent=2, sort_keys=True, | ||
separators=(', ', ': ')) | ||
if outfn: | ||
with open(outfn, 'w') as outf: | ||
outf.write(outtext + "\n") | ||
else: | ||
print(outtext) | ||
return units | ||
|
||
|
||
if __name__ == '__main__': | ||
from docopt import docopt | ||
|
||
args = docopt(__doc__, version=__version__) | ||
|
||
# https://github.com/docopt/docopt/issues/214 has been open for | ||
# almost 7 years, so it looks like docopt isn't getting default | ||
# positional args. | ||
output = main(args['MD'] or 'README.md', | ||
args.get('--ex'), args.get('--out')) | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#### Introduction | ||
|
||
dcm2niix is a community effort | ||
|
||
Like the [Brain Imaging Data Structure](https://bids.neuroimaging.io/get_involved.html), which it supports, dcm2niix is developed by the community for the community and everybody can become a part of the community. | ||
|
||
The easiest way to contribute to dcm2niix is to ask questions you have by [generating Github issues](https://github.com/rordenlab/dcm2niix/issues) or [asking a question on the NITRC forum](https://www.nitrc.org/forum/?group_id=880). | ||
|
||
The code is open source, and you can share your improvements by [creating a pull request](https://github.com/rordenlab/dcm2niix/pulls). | ||
dcm2niix is a community project that has benefitted from many [contrbutors](https://github.com/rordenlab/dcm2niix/graphs/contributors). | ||
|
||
The INCF suggests indicating who is responsible for maintaining software for [stability and support](https://incf.org/incf-standards-review-criteria-v20). Therefore, below we indicate several active contributors and their primary domain of expertise. However, this list is not comprehensive, and it is noted that the project has been supported by contributions from many users. This list does not reflect magnitude of prior contributions, rather it is a non-exhaustive list of members who are actively maintaining the project. | ||
|
||
- Jon Clayden: (@jonclayden): [R Deployment](https://github.com/jonclayden/divest) | ||
- Ningfei Li : (@ningfei) CMake, AppVeyor, Travis | ||
- Yaroslav O. Halchenko: (@yarikoptic) Debian distributions | ||
- Taylor Hanayik (@hanayik): FSL integration | ||
- Michael Harms (@mharms): Advanced modalities | ||
- Roger D Newman-Norlund (@rogiedodgie): User support | ||
- Rob Reid (@captainnova): Clinical modalities | ||
- Chris Rorden (@neurolabusc): General development, user support | ||
|
||
#### Style Guide | ||
|
||
dcm2niix is written in C. Different programmers prefer different styles of indentation. Feel free to contribute code without being concerned about matching the style of the rest of the code. Once in a while, the code base will be automatically reformatted to make it appear more consistent for all users. This is done automatically with clang-format: | ||
|
||
``` | ||
clang-format -i -style="{BasedOnStyle: LLVM, IndentWidth: 4, IndentCaseLabels: false, TabWidth: 4, UseTab: Always, ColumnLimit: 0}" *.cpp *.h | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.