Skip to content

Commit

Permalink
Edit documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gurayerus committed Dec 12, 2024
1 parent d9d3f73 commit f8dc62a
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 143 deletions.
Binary file removed docs2/.installation.rst.kate-swp
Binary file not shown.
Binary file removed docs2/.usage.rst.kate-swp
Binary file not shown.
67 changes: 1 addition & 66 deletions docs2/api.rst
Original file line number Diff line number Diff line change
@@ -1,70 +1,5 @@
NiChart\_DLMUSE source code
Developers - API
===========================

Submodules
----------

DLMUSE pipeline
--------------------------------------------

.. automodule:: NiChart_DLMUSE.dlmuse_pipeline
:members:
:undoc-members:
:show-inheritance:

Calculate ROI Volume module
-----------------------------------------

.. automodule:: NiChart_DLMUSE.CalcROIVol
:members:
:undoc-members:
:show-inheritance:


Mask Image
--------------------------------

.. automodule:: NiChart_DLMUSE.MaskImage
:members:
:undoc-members:
:show-inheritance:

Relabel ROI
--------------------------------

.. automodule:: NiChart_DLMUSE.RelabelROI
:members:
:undoc-members:
:show-inheritance:

Reorient Image
------------------------------------------

.. automodule:: NiChart_DLMUSE.ReorientImage
:members:
:undoc-members:
:show-inheritance:

Segment Image
---------------------------------------------

.. automodule:: NiChart_DLMUSE.SegmentImage
:members:
:undoc-members:
:show-inheritance:

util functions
----------------------------

.. automodule:: NiChart_DLMUSE.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: NiChart_DLMUSE
:members:
:undoc-members:
:show-inheritance:
35 changes: 35 additions & 0 deletions docs2/components.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
##########
Components
##########

NiChart is designed as a framework that integrates independent image processing and analysis pipelines. The following sections describe NiChart pipelines.

*****************
Active Pipelines
*****************

These pipelines are currently active and running within the NiChart Project

------------------------------------
A1. sMRI Biomarkers of Disease and Aging
------------------------------------

Neuroimaging pipeline for computing AI biomarkers of disease and aging from T1-weighted MRI scans

----------------------
A2. WM Lesion Segmentation
----------------------

****************
Work in Progress
****************

These pipelines will be integrated into NiChart Project in the next releases

------------------------------------
B1. DTI Biomarkers of Disease and Aging
------------------------------------

------------------------------------
B2. fMRI Biomarkers of Disease and Aging
------------------------------------
2 changes: 1 addition & 1 deletion docs2/help.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Getting help
############

If you have a problem or would like to ask a question about the inner workings of **NiChart DLMUSE** you can directly
If you have a question about **NiChart Project** you can directly
message our maintaners via email.

.. note::
Expand Down
2 changes: 2 additions & 0 deletions docs2/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Contents

installation
usage
components
contributors
api
help
license
46 changes: 39 additions & 7 deletions docs2/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,48 @@
Installation
############

To install **NiChart Project** with pip, just do: ::
Users can install **NiChart Project** with pip: ::

$ pip install NiChart_Project
pip install NiChart_Project

We always have our latest stable version on PyPI, so we highly suggest you to install it this way.
Alternatively, the package can be installed from source: ::

You can manually build the package from source by running: ::
git clone https://github.com/CBICA/NiChart_Project
cd NiChart_Project && python3 -m pip install -e .

$ git clone https://github.com/CBICA/NiChart_Project
We release our latest stable version on PyPI; accordingly, **we strongly recommend pip installation**.

.. warning::
PyTorch and NumPy have known compatibility issues across different platforms. To avoid potential conflicts, please follow the installation instructions below.

- After installing all other necessary packages, uninstall any existing Torch installations:

$ pip uninstall torch

- Reinstall PyTorch:

- **Linux:** PyTorch version 2.3.1
- **Windows:** PyTorch version 2.5.1

- Users can select the correct index URL for their CUDA version based on the `PyTorch getting started page <https://pytorch.org/get-started/locally>`

**Example on a Linux x86 system:**

$ pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cu121

*************************
Managing your environment
*************************

We recommend installing NiChart Project within a dedicated environment. Users can create an environment using Mamba (please see `Mamba Installation Guide <https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html>`).

**Example on a Linux x86 system:** ::

wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
bash Mambaforge-Linux-x86_64.sh
mamba create -c conda-forge -c bioconda -n NCP_env python=3.12
mamba activate NCP_env
git clone https://github.com/CBICA/NiChart_Project.git
pip install -r requirements.txt

$ cd NiChart_Project && python3 -m pip install -e .

We **do not** recomment installing the package directly from source as the repository is under development and this can cause crashes and bugs.
5 changes: 5 additions & 0 deletions docs2/license.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#######
License
#######

NiChart application, web site, the content and the logo of NiChart are intellectual property of CBICA, UPENN. For details, please see `the licence <https://github.com/CBICA/NiChart_Project/blob/main/LICENSE>`.
6 changes: 3 additions & 3 deletions docs2/modules.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NiChart_DLMUSE
NiChart_Project
==============

.. toctree::
:maxdepth: 4
:maxdepth: 2

NiChart_DLMUSE
NiChart_Project
85 changes: 19 additions & 66 deletions docs2/usage.rst
Original file line number Diff line number Diff line change
@@ -1,74 +1,27 @@
#####
Usage
#####

Pre-trained nnUNet models for the skull-stripping can be found in `HuggingFace nichart/DLICV <https://huggingface.co/nichart/DLICV/tree/main>`_ and
segmentation tasks can be found in `HuggingFace nichart/DLMUSE <https://huggingface.co/nichart/DLMUSE/tree/main>`_. Feel free to use it under the package's license.

*********
Using CLI
*********

Our CLI is simply to use as it just takes 2 required parameters: ::

$ NiChart_DLMUSE -i <input path> -o <output path>

By default, our CLI runs on CPU. You can run it on GPU with CUDA or MPS just by specifying the device: ::
###########
Quick Start
###########

$ NiChart_DLMUSE -i <input path> -o <output path> -d cuda
*******
Desktop
*******

The following steps describe how to run NiChart after installation: ::

$ cd src/viewer
$ streamlit run NiChartProject.py
.. note::
The app will start running at http://localhost:8501. If your browser doesn't automatically open, please copy and paste this address into your browser.

**MPS** Can be used if your chip supports 3d convolution(M1 chips do not support 3d convolution, thus, you can't use MPS with M1 macbooks)


We use batch splitting and paralellization to accelerate the procedure. By default, we split the input data into
4 subfolders. You can specify the number of subfolders with the ``-c`` or ``--cores`` option: ::

$ NiChart_DLMUSE ... -c 6

This will create 6 subfolders instead of the default 4.

We also support ``BIDS`` I/O in our latest stable release. In order to run NiChart DLMUSE with a BIDS folder as the input you
need to have one T1 image under the anat subfolder. After the run NiChart DLMUSE will return the segmented images in the same
subfolders. If you have a `BIDS` input folder you have to specify it at the CLI command: ::
*****
Cloud
*****

$ NiChart_DLMUSE ... --bids 1
The cloud app can be launched at https://cloud.neuroimagingchart.com . Users need to create an account to access the cloud app.

For further explanation please refer to the complete CLI documentation: ::

$ NiChart_DLMUSE -h


**************************
Using the docker container
**************************

Using the file structure explained above, an example command using the `docker container <https://hub.docker.com/r/cbica/nichart_dlmuse/tags>`_
is the following: ::

# For GPU
$ CUDA_VERSION=11.8 docker pull cbica/nichart_dlmuse:1.0.1-cuda${CUDA_VERSION}

# For CPU
docker pull cbica/nichart_dlmuse:1.0.4-default

$ # Run the container with proper mounts, GPU enabled
# Place input in /path/to/input/on/host.
# Replace "-d cuda" with "-d mps" or "-d cpu" as needed...
# or don't pass at all to automatically use CPU.
# Each "/path/to/.../on/host" is a placeholder, use your actual paths!
docker run -it --name DLMUSE_inference --rm
--mount type=bind,source=/path/to/input/on/host,target=/input,readonly
--mount type=bind,source=/path/to/output/on/host,target=/output
--gpus all cbica/nichart_dlmuse -d cuda


*******************************
Using the singularity container
*******************************

We do not recommend using the singularity container as is currently outdated and not maintaned: ::
*****
Usage
*****

$ singularity run --nv --containall --bind /path/to/.\:/workspace/ nichart_dlmuse.simg NiChart_DLMUSE -i /workspace/temp/nnUNet_raw_data_base/nnUNet_raw_data/ -o /workspace/temp/nnUNet_out -p structural --derived_ROI_mappings_file /NiChart_DLMUSE/shared/dicts/MUSE_mapping_derived_rois.csv --MUSE_ROI_mappings_file /NiChart_DLMUSE/shared/dicts/MUSE_mapping_consecutive_indices.csv --nnUNet_raw_data_base /workspace/temp/nnUNet_raw_data_base/ --nnUNet_preprocessed /workspace/temp/nnUNet_preprocessed/ --model_folder /workspace/temp/nnUNet_model/ --all_in_gpu True --mode fastest --disable_tta
After launching the application, users can select a pipeline and apply it to their data. For detailed instructions on each pipeline, please refer to the **Overview** and **Tutorial** pages accessible from the left-hand menu.

0 comments on commit f8dc62a

Please sign in to comment.