Skip to content

Commit

Permalink
feat: expand api documentation and document legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 21, 2024
1 parent 5a9ae4f commit 32e6159
Show file tree
Hide file tree
Showing 16 changed files with 177 additions and 12 deletions.
107 changes: 107 additions & 0 deletions docs/chapters/plantseg_legacy/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Installation

## Prerequisites for Conda package

* Linux, Windows, macOS (not all features are available on macOS)
* (Optional) Nvidia GPU with official Nvidia drivers installed for GPU acceleration

## Install Mamba

The easiest way to install PlantSeg is by using the [conda (Anaconda)](https://www.anaconda.com/) or
[mamba (Miniforge)](https://mamba.readthedocs.io/en/latest/index.html) package manager. We recommend using `mamba` because it is faster and usually more consistent than `conda`.

=== "Linux"

To download Miniforge open a terminal and type:

```bash
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
```

Then install by typing:

```bash
bash Miniforge3-$(uname)-$(uname -m).sh
```

and follow the installation instructions.
Please refer to the [Miniforge repo](https://github.com/conda-forge/miniforge) for more information, troubleshooting and uninstallation instructions.
The miniforge installation file `Miniforge3-*.sh` can be deleted now.

=== "Windows/macOS"
The first step required to use the pipeline is installing mamba. The installation can be done by downloading the installer from the [Miniforge repo](https://github.com/conda-forge/miniforge). There you can find the download links for the latest version of Miniforge, troubleshooting and uninstallation instructions.

## Install PlantSeg using Mamba

PlantSeg can be installed directly by executing in the terminal (or PowerShell on Windows). For `conda` users, the command is identical, just replace `mamba` with `conda`.

=== "Linux"

* NVIDIA GPU version, CUDA=12.x

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch pytorch-cuda=12.1 plant-seg=1.8.1 --no-channel-priority
```

* NVIDIA GPU version, CUDA=11.x

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch pytorch-cuda=11.8 plant-seg=1.8.1 --no-channel-priority
```

* CPU version

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch cpuonly plant-seg=1.8.1 --no-channel-priority
```

=== "Windows"

* NVIDIA GPU version, CUDA=12.x

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch pytorch-cuda=12.1 nifty=1.2.1=*_4 plant-seg=1.8.1 --no-channel-priority
```

* NVIDIA GPU version, CUDA=11.x

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch pytorch-cuda=11.8 nifty=1.2.1=*_4 plant-seg=1.8.1 --no-channel-priority
```

* CPU version

```bash
mamba create -n plant-seg -c pytorch -c nvidia -c conda-forge pytorch cpuonly nifty=1.2.1=*_4 plant-seg=1.8.1 --no-channel-priority
```

=== "macOS"

* Apple silicon version

```bash
mamba create -n plant-seg -c pytorch -c conda-forge python=3.11 pytorch::pytorch plant-seg=1.8.1 --no-channel-priority
```

If you used older versions of PlantSeg, please delete the old config files in `~/.plantseg_models/configs/` after installing new PlantSeg.

The above command will create new conda environment `plant-seg` together with all required dependencies.

Please refer to the [PyTorch](https://pytorch.org/get-started/locally/) website for more information on the available versions of PyTorch and the required CUDA version. The GPU version of Pytorch will also work on CPU only machines but has a much larger installation on disk.

## Optional dependencies

Certain compressed TIFF files (e.g., Zlib, ZSTD, LZMA formats) require additional codecs to be processed correctly by PlantSeg. To handle such files, install the `imagecodecs` package:

```bash
conda activate plant-seg
pip install imagecodecs
```

If you plan to use SimpleITK-based watershed segmentation, you will need to install `SimpleITK` as an additional dependency:

```bash
conda activate plant-seg
pip install SimpleITK
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions docs/chapters/python_api/tasks/dataprocessing_tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Import and export tasks

## Gaussian smoothing task

::: plantseg.tasks.dataprocessing_tasks.gaussian_smoothing_task

## Image cropping task

::: plantseg.tasks.dataprocessing_tasks.image_cropping_task


## Image rescale to shape task

::: plantseg.tasks.dataprocessing_tasks.image_rescale_to_shape_task


## Image rescale to voxel size task

::: plantseg.tasks.dataprocessing_tasks.image_rescale_to_voxel_size_task

## Set image voxel size task

::: plantseg.tasks.dataprocessing_tasks.set_voxel_size_task

## Label Postprocessing

## Remove false positives task

::: plantseg.tasks.dataprocessing_tasks.remove_false_positives_by_foreground_probability_task

## Fix Over/Under segmentation task

::: plantseg.tasks.dataprocessing_tasks.fix_over_under_segmentation_from_nuclei_task

## Set biggest object as background task

::: plantseg.tasks.dataprocessing_tasks.set_biggest_instance_to_zero_task

## Relabel task

::: plantseg.tasks.dataprocessing_tasks.relabel_segmentation_task
9 changes: 9 additions & 0 deletions docs/chapters/python_api/tasks/io_tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Import and export tasks

## Import task

::: plantseg.tasks.io_tasks.import_image_task

## Export task

::: plantseg.tasks.io_tasks.export_image_task
5 changes: 5 additions & 0 deletions docs/chapters/python_api/tasks/prediction_tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Neural network prediction tasks

## UNet prediction task

::: plantseg.tasks.prediction_tasks.unet_prediction_task
13 changes: 13 additions & 0 deletions docs/chapters/python_api/tasks/segmentation_tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Segmentation tasks

## Distance transform watershed task

::: plantseg.tasks.segmentation_tasks.dt_watershed_task

## Cluster segmentation task

::: plantseg.tasks.segmentation_tasks.clustering_segmentation_task

## Lifted Multicut task

::: plantseg.tasks.segmentation_tasks.lmc_segmentation_task
14 changes: 2 additions & 12 deletions plantseg/tasks/io_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ def import_image_task(
input_path (Path): path to the image file
semantic_type (str): semantic type of the image (raw, segmentation, prediction)
stack_layout (str): stack layout of the image (3D, 2D, 2D_time)
image_name (str | Noinput_path = inputs[input_schema["name"]]
input_paths = parse_import_image_task(input_path)
list_inputs.extend(input_paths)ne): name of the image (if None, the file name will be used)
key (str | None):"export_directory": RunTimeInput(
allowed_types=['str'],
description="Output directory path where the image will be saved",
headless_default=None,
user_input_required=True,
),
"name_pattern": RunTimeInput(
allowed_types=['str'], description="Output file name", headless_default=None, user_input_required=False
), key for the image (used only for h5 and zarr formats)
image_name (str): name of the image, if None the name will be the same as the file name
key (str | None): key for the image (used only for h5 and zarr formats)
m_slicing (str | None): m_slicing of the image (None, time, z, y, x)
"""

Expand Down

0 comments on commit 32e6159

Please sign in to comment.