Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create LICENSE, README, first example #47

Merged
merged 10 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 INCF-NIDASH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# nidmresults
A Python library to read and write [NIDM-Results](http://nidm.nidash.org/specs/nidm-results.html) packs.

You are free to copy, modify, and distribute nidmresults with attribution under the terms of the MIT license. See the [LICENSE file](LICENSE.md) for details.

## Install
nidmresults is distributed with [PyPI](https://pypi.org/project/nidmresults/), to install the latest relase you can use:
```
pip install nidmresults
```

To work with the current developement version we recommend cloning this repository locally and then install using
```
python setup.py install
```

## Example of usage

Examples are available in the [examples](examples) folder.

## Contributing
Thanks for your interest in contributing to nidmresults. All contributions are very welcome! If you experience difficulties using the library, please [open an issue](https://github.com/incf-nidash/nidmresults/issues/new) describing the problem. See the list of [current issues](https://github.com/incf-nidash/nidmresults/issues).


26 changes: 26 additions & 0 deletions examples/ex_read_nidm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Example: reading a NIDM pack available on NeuroVault
import os
import json
import shutil
import tempfile
import nidmresults as nidm
import urllib.request

# Download the NIDM pack locally
nidm_url = 'https://neurovault.org/collections/2210/fsl_default_130.nidm.zip'
nidmpack = "2210_fsl_default_130.nidm.zip"

if not os.path.isfile(nidmpack):
print('Downloading ' + nidmpack)
urllib.request.urlretrieve(nidm_url, nidmpack)

# Known issues with NIDM packs in collection 2210
to_replace = {
' \\ntask': '\\\\n task',
';\n nidm_coordinateVectorInVoxels: "null"^^xsd:string .':
'.'}

# Read the NIDM pack
nres = nidm.load(nidmpack, to_replace=to_replace)

print(json.dumps(nres.get_info(), indent=4))
2 changes: 2 additions & 0 deletions nidmresults/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ def load(filename, to_replace=dict()):
raise Exception('Minimal json file: not handled yet')
elif filename.endswith('.nidm.zip'):
nidm = NIDMResults.load_from_pack(filename, to_replace=to_replace)
else:
raise Exception('Unhandled format ' + filename)

return nidm
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="nidmresults",
version="2.0.0",
version="2.0.1-dev1",
author="Camille Maumet",
author_email="[email protected]",
description=(
Expand Down