Skip to content

Commit

Permalink
Merge branch 'main' into heudiconv
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpron authored Jul 22, 2024
2 parents ac64c3e + 6fa3b89 commit d98a8bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ conda update --all
conda install -c conda-forge heudiconv git-annex=*=alldep* datalad
```
## Usage

## How to download Shanoir datasets ?

There are three scripts to download datasets from a Shanoir instance:
Expand Down Expand Up @@ -58,9 +59,11 @@ See `python shanoir_downloader_check.py --help` for more information.

You might want to skip the anonymization process and the encryption process with the `--skip_anonymization` and `--skip_encryption` arguments respectively (or `-sa` and `-se`).


### `shanoir2bids.py`

A `.json` configuration file must be provided to transform a Shanoir dataset into a BIDS dataset.

```
-----------------------------[.json configuration file information]-------------------------------
This file will tell the script what Shanoir datasets should be downloaded and how the data will be organised.
Expand All @@ -71,23 +74,29 @@ The dictionary in the json file must have four keys :
"data_to_bids": list of dict, each dictionary specifies datasets to download and BIDS format with the following keys :
-> "datasetName": str, Shanoir name for the sequence to search
-> "bidsDir" : str, BIDS subdirectory sequence name (eg : "anat", "func" or "dwi", ...)
-> "bidsName" : str, BIDS sequence name (eg: "t1w", "acq-b0_dir-AP", ...)
```
Please refer to the [BIDS starter kit](https://bids-standard.github.io/bids-starter-kit/folders_and_files/files.html)
for exhaustive templates of filenames. A BIDS compatible example is provided in the file `s2b_example_config.json`.


To download longitudinal data, a key `session` and a new entry `bidsSession` in `data_to_bids` dictionaries should be defined in the JSON configuration files. Of note, only one session can be downloaded at once. Then, the key `session` is just a string, not a list as for subjects.



### Download Examples
#### Raw download

To download datasets, verify the content of them, anonymize them and / or encrypt them you can use a command like:

`python shanoir_downloader_check.py -u username -d shanoir.irisa.fr -ids path/to/datasets_to_download.csv -of path/to/output/folder/ -se -lf path/to/downloads.log`

The `example_input_check.csv` file in this repository is an example input file (the format of the `datasets_to_download.csv` file should be the same).


#### Solr search download

You can also download datasets from a [SolR search](https://shanoir.irisa.fr/shanoir-ng/solr-search) as on the website:

`python shanoir_downloader.py -u amasson -d shanoir.irisa.fr -of /data/amasson/test/shanoir_test4 --search_text "FLAIR" -p 1 -s 2 `
Expand All @@ -99,6 +108,7 @@ where `--search_text` is the string you would use on [the SolR search page](http

## About Solr Search


The `--search_text` and `--expert_mode` arguments work as on the [Shanoir search page](https://shanoir.irisa.fr/shanoir-ng/solr-search).

Without expert mode, shanoir will return all datasets containing one of the search term in one of their field.
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ readme = "README.md"
license = {file = "LICENSE"}
keywords = ["Shanoir", "DICOM", "NIFTI", "BIDS"]
classifiers = [

"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"

]

[project.urls]
Expand Down

0 comments on commit d98a8bb

Please sign in to comment.