-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add dianne tutorials #734
Merged
Merged
Add dianne tutorials #734
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
35ad528
Copy tutorials from University of Arizona
asmacdo 481f924
Organize left-bar
asmacdo 0f25b07
codespell
asmacdo a104fa8
Update Copyright years for the project
yarikoptic 8082b36
Add a note to LICENSE about borrowed content
yarikoptic d211a62
Rename heuristic page title
asmacdo bd717de
Add links to original tutorials
asmacdo 5550deb
Minimize quickstart, format, and hand-test
asmacdo f0251cc
First pass custom heuristics tutorial
asmacdo b2f2f10
second naive pass of custom heuristic
asmacdo 40b3880
Cleanup quickstart and use install link
asmacdo 5de5e71
First pass Reproin
asmacdo 7353d34
Fix rendering of prereqs
asmacdo 050749b
Fix links
asmacdo a6486df
Add container useage instructions
asmacdo 688be6e
Document provided heuristics
asmacdo 79e0cc2
Update LICENSE
asmacdo c91ba58
Apply suggestions from code review
asmacdo e0f9ce2
Update links to our datasets
asmacdo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
============= | ||
CLI Reference | ||
============= | ||
|
||
``heudiconv`` processes DICOM files and converts the output into user defined | ||
paths. | ||
|
||
.. argparse:: | ||
:ref: heudiconv.cli.run.get_parser | ||
:prog: heudiconv | ||
:nodefault: | ||
:nodefaultconst: |
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,49 @@ | ||
============================== | ||
Using heudiconv in a Container | ||
============================== | ||
|
||
If heudiconv is :ref:`installed via container <install_container>`, you | ||
asmacdo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
can run the commands in the following format:: | ||
|
||
docker run nipy/heudiconv:latest [heudiconv options] | ||
|
||
So a user running via container would check the version with this command:: | ||
|
||
docker run nipy/heudiconv:latest --version | ||
|
||
Which is equivalent to the locally installed command:: | ||
|
||
heudiconv --version | ||
|
||
Bind mount | ||
---------- | ||
|
||
Typically, users of heudiconv will be operating on data that is on their local machine. We can give heudiconv access to that data via a ``bind mount``, which is the ``-v`` syntax. | ||
|
||
Once common pattern is to share the working directory with ``-v $PWD:$PWD``, so heudiconv will behave as though it is installed on your system. However, you should be aware of how permissions work depending on your container toolset. | ||
|
||
|
||
Docker Permissions | ||
****************** | ||
|
||
When you run a container with docker without specifying a user, it will be run as root. | ||
This isn't ideal if you are operating on data owned by your local user, so for ``Docker`` it is recommended to specify that the container will run as your user.:: | ||
|
||
docker run --user=$(id -u):$(id -g) -e "UID=$(id -u)" -e "GID=$(id -g)" --rm -t -v $PWD:$PWD nipy/heudiconv:latest --version | ||
|
||
Podman Permissions | ||
****************** | ||
|
||
When running Podman without specifying a user, the container is run as root inside the container, but your user outside of the container. | ||
This default behavior usually works for heudiconv users:: | ||
|
||
docker run -v $PWD:PWD nipy/heudiconv:latest --version | ||
|
||
Other Common Options | ||
-------------------- | ||
|
||
We typically recommend users make use of the following flags to Docker and Podman | ||
|
||
* ``-it`` Interactive terminal | ||
* ``--rm`` Remove the changes to the container when it completes | ||
|
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
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 |
---|---|---|
|
@@ -14,7 +14,9 @@ Contents | |
|
||
installation | ||
changes | ||
usage | ||
heuristics | ||
tutorials | ||
heuristics | ||
commandline | ||
container | ||
api | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
Quickstart | ||
========== | ||
|
||
This tutorial is based on `Dianne Patterson's University of Arizona tutorials <https://neuroimaging-core-docs.readthedocs.io/en/latest/pages/heudiconv.html#lesson-3-reproin-py>`_ | ||
|
||
This guide assumes you have already :ref:`installed heudiconv and dcm2niix <install_local>` and | ||
demonstrates how to use the heudiconv tool with a provided `heuristic.py` to convert DICOMS into the BIDS data structure. | ||
|
||
.. _prepare_dataset: | ||
|
||
Prepare Dataset | ||
*************** | ||
|
||
Download and unzip `sub-219_dicom.zip <https://osf.io/mqgzh/>`_. | ||
|
||
We will be working from a directory called MRIS. Under the MRIS directory is the *dicom* subdirectory: Under the subject number *219* the session *itbs* is nested. Each dicom sequence folder is nested under the session:: | ||
|
||
dicom | ||
└── 219 | ||
└── itbs | ||
├── Bzero_verify_PA_17 | ||
├── DTI_30_DIRs_AP_15 | ||
├── Localizers_1 | ||
├── MoCoSeries_19 | ||
├── MoCoSeries_31 | ||
├── Post_TMS_restingstate_30 | ||
├── T1_mprage_1mm_13 | ||
├── field_mapping_20 | ||
├── field_mapping_21 | ||
└── restingstate_18 | ||
Nifti | ||
└── code | ||
└── heuristic1.py | ||
|
||
Basic Conversion | ||
**************** | ||
|
||
Next we will use heudiconv convert DICOMS into the BIDS data structure. | ||
The example dataset includes an example heuristic file, `heuristic1.py`. | ||
Typical use of heudiconv will require the creation and editing of your :doc:`heuristics file <heuristics>`, which we will cover | ||
in a :doc:`later tutorial <custom-heuristic>`. | ||
|
||
.. note:: Heudiconv requires you to run the command from the parent | ||
directory of both the Dicom and Nifti directories, which is `MRIS` in | ||
our case. | ||
|
||
Run the following command:: | ||
|
||
heudiconv --files dicom/219/itbs/*/*.dcm -o Nifti -f Nifti/code/heuristic1.py -s 219 -ss itbs -c dcm2niix -b --minmeta --overwrite | ||
|
||
|
||
* We specify the dicom files to convert with `--files` | ||
* The heuristic file is provided with the `-f` option | ||
* We tell heudiconv to place our output in the Nifti dir with `-o` | ||
* `-b` indicates that we want to output in BIDS format | ||
* `--minmeta` guarantees that meta-information in the dcms does not get inserted into the JSON sidecar. This is good because the information is not needed but can overflow the JSON file causing some BIDS apps to crash. | ||
|
||
Output | ||
****** | ||
|
||
The *Nifti* directory will contain a bids-compliant subject directory:: | ||
|
||
|
||
└── sub-219 | ||
└── ses-itbs | ||
├── anat | ||
├── dwi | ||
├── fmap | ||
└── func | ||
|
||
The following required BIDS text files are also created in the Nifti directory. Details for filling in these skeleton text files can be found under `tabular files <https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#tabular-files>`_ in the BIDS specification:: | ||
|
||
CHANGES | ||
README | ||
dataset_description.json | ||
participants.json | ||
participants.tsv | ||
task-rest_bold.json | ||
|
||
Validation | ||
********** | ||
|
||
Ensure that everything is according to spec by using `bids validator <https://bids-standard.github.io/bids-validator/>`_ | ||
|
||
Click `Choose File` and then select the *Nifti* directory. There should be no errors (though there are a couple of warnings). | ||
|
||
.. Note:: Your files are not uploaded to the BIDS validator, so there are no privacy concerns! | ||
|
||
Next | ||
**** | ||
|
||
In the following sections, you will modify *heuristic.py* yourself so you can test different options and understand how to work with your own data. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all good, again independent of the goal of the PR