-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from jjjermiah/development
Development
- Loading branch information
Showing
33 changed files
with
703 additions
and
173 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,3 +157,5 @@ src/nbiatoolkit/.DS_Store | |
.vscode | ||
download.ipynb | ||
driver*.py | ||
logs | ||
logdir |
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
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,77 @@ | ||
Download Series | ||
^^^^^^^^^^^^^^ | ||
|
||
|
||
The :meth:`downloadSeries` method is used to download an entire SeriesInstanceUID | ||
from the NBIA Database. | ||
|
||
One of the features provided by the `nbiatoolkit` is the ability to configure | ||
the folder structure of the downloaded files. This functionality is handled internally | ||
by the `DICOMSorter` class. | ||
|
||
Configuration of the folder structure is done by passing a **`filePattern`** argument to the | ||
:meth:`downloadSeries` method. The **`filePattern`** argument is a string constructed from | ||
tags in the DICOM header. Tags are enclosed in `%` characters. For example, the following | ||
**`filePattern`** string: | ||
|
||
.. code-block:: python | ||
filePattern = '%PatientID/%StudyInstanceUID/%SeriesInstanceUID/%InstanceNumber.dcm' | ||
will create a folder structure that looks like this: | ||
|
||
.. code-block:: bash | ||
PatientID | ||
├── StudyInstanceUID | ||
│ └── SeriesInstanceUID | ||
│ ├── 1.dcm | ||
│ ├── 2.dcm | ||
│ └── ... | ||
├── StudyInstanceUID | ||
│ └── SeriesInstanceUID | ||
│ ├── 1.dcm | ||
│ ├── 2.dcm | ||
│ └── ... | ||
└── ... | ||
The **`filePattern`** string can be constructed from any DICOM tag. The following tags are | ||
good candidates for constructing a **`filePattern`** string: | ||
|
||
- PatientID | ||
- BodyPartExamined | ||
- Modality | ||
- StudyInstanceUID | ||
- SeriesInstanceUID | ||
- InstanceNumber | ||
- SOPInstanceUID | ||
|
||
|
||
To download a SeriesInstanceUID from the NBIA Database, use the :meth:`downloadSeries` method. | ||
|
||
.. automethod:: nbiatoolkit.NBIAClient.downloadSeries | ||
|
||
|
||
.. tabs:: | ||
.. tab:: Python | ||
.. exec_code:: | ||
|
||
# --- hide: start --- | ||
from nbiatoolkit import NBIAClient | ||
# --- hide: stop --- | ||
|
||
filePattern = '%PatientID/%StudyInstanceUID/%SeriesInstanceUID/%InstanceNumber.dcm' | ||
downloadDir = './NBIA-Download' | ||
nParallel = 5 | ||
|
||
with NBIAClient(return_type="dataframe") as client: | ||
series = client.getSeries( | ||
PatientID='TCGA-G2-A2EK' | ||
) | ||
|
||
client.downloadSeries( | ||
series.SeriesInstanceUID, | ||
downloadDir, | ||
filePattern, | ||
nParallel | ||
) |
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,40 @@ | ||
Installation | ||
____________ | ||
|
||
`nbiatoolkit` is currently under development and is not guaranteed to be stable. | ||
Please refer to the `1.0.0 Stable Release Milestone <https://github.com/jjjermiah/nbia-toolkit/milestone/1>`_ | ||
for the roadmap to the first stable release. | ||
|
||
PyPi Installation | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
The easiest way to install `nbiatoolkit` is to use `pip` to install it from the | ||
`Python Package Index (PyPi) <https://pypi.org/project/nbiatoolkit/>`_. | ||
|
||
.. code-block:: console | ||
$ pip install nbiatoolkit | ||
***NOTE: It is recommended that you install the package in a conda or virtual environment.*** | ||
|
||
Conda Installation | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
Though the package is not available on conda, you can create a conda environment and install the package using pip: | ||
|
||
.. code-block:: console | ||
$ conda create -n nbia python=3.12 | ||
$ conda activate nbia | ||
$ pip install nbiatoolkit | ||
Virtual Environment Installation | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If you prefer to use a virtual environment, you can create one and install the package using pip: | ||
|
||
.. code-block:: console | ||
$ python3 -m venv nbia | ||
$ source nbia/bin/activate | ||
$ pip install nbiatoolkit |
File renamed without changes.
File renamed without changes.
This file was deleted.
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,43 @@ | ||
.. include:: ../README.md | ||
:parser: myst_parser.sphinx_ | ||
|
||
.. toctree:: | ||
:caption: Getting started | ||
:name: getting-started | ||
:hidden: | ||
:maxdepth: 2 | ||
|
||
getting_started/NBIA.md | ||
getting_started/Installation.rst | ||
getting_started/InitializeClient.rst | ||
getting_started/logger.rst | ||
|
||
.. toctree:: | ||
:caption: Querying API | ||
:name: querying-api | ||
:hidden: | ||
:maxdepth: 2 | ||
|
||
querying_api/ExploringCollections.rst | ||
querying_api/ExploringModalities.rst | ||
querying_api/ExploringPatients.rst | ||
querying_api/ExploringStudies.rst | ||
querying_api/ExploringSeries.rst | ||
|
||
.. toctree:: | ||
:caption: Downloading API | ||
:name: downloading-api | ||
:hidden: | ||
:maxdepth: 2 | ||
|
||
download_api/DownloadSeries.rst | ||
|
||
.. toctree:: | ||
:caption: Project Info | ||
:name: project-info | ||
:hidden: | ||
:maxdepth: 2 | ||
|
||
project_info/CONTRIBUTING.md | ||
project_info/CHANGELOG.md | ||
project_info/CONDUCT.md |
Oops, something went wrong.