Simple python tools for plant-seg https://github.com/hci-unihd/plant-seg
- Install PlantSeg Tools
- Segmentation to Meshes
- Proofreading tool
- Automated Segmentation Proofread from seeds
- Evaluation
- Install
plant-seg
from https://github.com/hci-unihd/plant-seg - activate
plant-seg
environment using:
conda activate plant-seg
- clone this repository locally on our machine, in the terminal navigate to the desired install location and execute:
git clone https://github.com/hci-unihd/plant-seg-tools.git
- install
plant-seg-tools
:
cd plant-seg-tools
pip install .
While having your conda environment activated:
- In oder to use
seg2mesh
conda activate plant-seg
pip install -U "ray[default]"
conda install conda-forge::vtk
- In order to use the
trimesh
backend ofplantsegtools/meshes
, you will need to installtrimesh
using:
conda install -c conda-forge trimesh
- In order to use the training configurator wizard you need to install
PyInquirer
pip install PyInquirer
- create a new conda environment (at the moment plant-seg and the proofreading tools are not compatible). On a fresh terminal execute:
conda create -n plant-seg-proofreading -c conda-forge python numpy numba scipy matplotlib scikit-image pyaml h5py tqdm napari pyqt=5.12.3
conda activate plant-seg-proofreading
- clone this repository locally on our machine, in the terminal navigate to the desired install location and execute:
git clone https://github.com/hci-unihd/plant-seg-tools.git
- install
plant-seg-tools
:
cd plant-seg-tools
pip install .
From the project root (plant-seg-tools
) run the seg2mesh
script using:
python useful-scripts/seg2mesh.py --path 'PATHTOSEGMENTATIONSTACK'
--new-base
: optional custom saving directory. If not given the ply will be saved in the same dir as the source.--h5-dataset
: h5 internal dataset name. Default: segmentation.--labels
: List of labels to process. By default, the script will process all labels.--step-size
: Step size for the marching cube algorithm, larger steps yield a coarser but faster result. Default 2.--crop
: Crop the dataset, takes as input a bounding box. eg --crop 10, 0, 0 15, -1, -1.--voxel-size
: Voxel size [Z, Y, X] of the segmentation stack. By default, voxel size is read from the source file, if this is not possible voxel-size is set to [1, 1, 1].--min-size
: Minimum cell size. Default 50.--max-size
: Maximum cell size. Default inf.--relabel
: If this argument is passed the pipeline will relabel the segmentation. This will ensure the contiguity of each segment but will change the labels.--check-cc
: If this argument is passed the pipeline will check if each label is has a single connected component (cc). If multiple cc are present only the largest will be processed.--ignore-labels
: List of labels to ignore. By default, only background (label 0) is ignored.--reduction
: If reduction > 0 a decimation filter is applied.MaxValue: 1.0 (100%reduction).--smoothing
: To apply a Laplacian smoothing filter.--use-ray
: If you use ray flag is used the multiprocessing flag is managed by ray.--multiprocessing
: Define the number of cores to use for parallel processing. Default value (-1) will try to parallelize over all available processors.
From the project root (plant-seg-tools
) run the proofreading tool using:
- if the stack is coming from PlantSeg
python useful-scripts/proofreading.py --path-raw 'PATHTORAWSTACK' --path-seg 'PATHTOSEGMENTATIONSTACK' --dataset-seg segmentation
or in short
python useful-scripts/proofreading.py --r 'PATHTORAWSTACK' -s 'PATHTOSEGMENTATIONSTACK' -ds segmentation
- if you want to continue working on a stack exported with the proofreading tool (or if segmentation and raw images are together in the same h5 file):
python useful-scripts/proofreading.py -r 'PATHTORAWSTACK (convetional name *_proofreading.h5')'
alias proofreading="[user-dir-location]/miniconda3/envs/plant-seg-proofreading/bin/python [plant-seg-tools-location]/plant-seg-tools/useful-scripts/proofreading.py"
s
: Save stackn
: Merge or split from seedsctrl+n
: Undo merge or split from seedsc
: Clean seedso
: Mark/un-mark correct segmentationb
: show/un-show correct segmentation layerj
: Update boundaries from segmentationk
: Update segmentation from boundaries
ctrl + arrows
: to move the field of viewalt + down/up arrows
: to increase or decrease the field of view
-dr
or--dataset-raw
: name of the dataset containing the raw boundary image. Only used if raw boundary image is inh5
format. defaultraw
.-ds
or--dataset-seg
: name of the dataset containing the cell segmentation. Only used if segmentation is inh5
format. defaultlabel
.-xy
or--xy-size
: field of view size along the xy-plane. Larger field of view might slow down the tool.-z
or--z-size
: field of view size along z. Only for 3D. Larger field of view might slow down the tool.
python useful-scripts/fix_over_under_from_nuclei.py --seg-path 'PATHTOSEGMENTATIONSTACK' --nuclei-seg-path 'PATHTONUCLEISEGMENTATIONSTACK'
--t-merge
: Overlap merging threshold, between 0-1.--t-split
: Overlap split threshold, between 0-1.--quantiles
: Nuclei size below and above the defined quantiles will be ignored.--scaling
: Scaling factor for the segmentation.--export-h5
: In order to export the segmentation as h5.--boundaries-path
: path to boundaries predictions file.
python useful-scripts/evaluation_segmentation.py -s PATHTOSEG -g PATHTOGT
-ds
or--dataset-seg
: if h5 contains dataset name to segmentation-
-dg
or--dataset-gt
: if h5 contains dataset name to ground-truth