Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## v0.1.1 - [2025.11.15]

Efficiency update - only cells with overlaps are taken into consideration when calculating IoU matrices. Mask comparisons not calculated through a direct comparison, but optimized through lookup tables.

### `Added`
- `plot_target_size` parameter for plotting - inputs will be "downscaled" to match the target size for plotting efficiency

### `Fixed`
- memory issues for large input masks with many cells
- Dockerfile copies the repo to pip install instead of pointing to main

### `Removed`
- graph construction with networkx, replaced with functions
- cost matrix metric currently doesn't affect the execution - only IoU is used. To be updated soon.

## v0.1.0 - [2025.11.12]

First release of Segobe - a tool for object matching, segmentation error counting and metric evaluation.
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ USER root
# Ensure micromamba binaries are in PATH
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"

# Copy the rest of the current directory into /app inside the container
WORKDIR /app
COPY . .

RUN micromamba run -n base pip install .
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Designed for cell segmentation evaluation, it can handle large batches of sample

## Installation

Option 1. Install directory from the repository (recommended for development)
### Option 1. Install directory from the repository (recommended for development)
If you plan to develop or modify Segobe, install it in editable mode:
```bash
# Clone the repository
Expand All @@ -24,7 +24,7 @@ pip install -e .
```
> The -e flag (editable mode) means the changes to the source code are immediately reflected without reinstalling.

Option 2. Install directly from GitHub
### Option 2. Install directly from GitHub
Once the repository is made public, users can install it directly via URL:
```bash
pip install git+https://github.com/schapirolabor/segobe.git
Expand All @@ -50,7 +50,6 @@ segobe \
--iou_threshold 0.5 \
--graph_iou_threshold 0.1 \
--unmatched_cost 0.4 \
--cost_matrix_metric 'iou' \
--save_plots
```

Expand All @@ -62,8 +61,9 @@ segobe \
| | --iou_threshold | IoU threshold for cell matching (0-1, default: 0.5). Match is true if pair is selected with linear_sum_assignment and IoU above this threshold. |
| | --graph_iou_threshold | Graph IoU threshold for error detection (0-1, default: 0.1). Minimal IoU for cells to be considered 'connected'. |
| | --unmatched_cost | Cost for unmatched objects in the cost matrix (0-1, default: 0.4) |
| | --cost_matrix_metric | Specify which metric should be used for cost matrix construction (default: 'iou', other options 'dice', 'moc' - see details [here](docs/detailed_overview.md)) |
| | --cost_matrix_metric | Specify which metric should be used for cost matrix construction (default: 'iou', other options 'dice', 'moc' - see details [here](docs/detailed_overview.md)) `note that only IoU is currently supported` |
| | --save_plots | Boolean specifying whether plots (barplot grouped by category and row-specific error overview) are saved |
| | --plot_target_size | Size in pixels of the plot error types subfigures. If the inputs are larger, they will be approximately downsampled by a scale factor. If that scale factor is larger than 4, boundaries will not be drawn. (default: 600) |
| | --version | Prints tool version. |

### Input format
Expand Down Expand Up @@ -110,7 +110,6 @@ Captured metrics in the `metrics.csv` for each input CSV `row`:
* Splits: counts and dictionary of matched predictions to GTs
* Merges: counts and dictionary of matched GTs to predictions
* Catastrophes: counts and dictionary of groups of GTs and predictions involved
* IoU graph: constructed graph of cell overlaps
* True postives: counts
* False positives: counts
* False negatives: counts
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- scipy
- scikit-image
- matplotlib
- networkx
- tifffile
- git
- pip
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies = [
"pandas",
"matplotlib",
"scipy",
"networkx",
"scikit-image",
"tifffile"
]
Expand Down
14 changes: 13 additions & 1 deletion segobe/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def get_args():
help="Metric used for cost matrix calculation (default: iou)",
choices=["iou", "dice", "moc"],
)
parser.add_argument(
"--target_plot_size",
type=int,
default=600,
help="Target size to which large input images will be downsampled for error type plots.",
)
parser.add_argument(
"--save_plots",
action="store_true",
Expand All @@ -84,8 +90,12 @@ def main():

# Read input CSV
df = pd.read_csv(args.input_csv)
required_columns = {"sampleID", "ref_mask", "eval_mask", "category"}
if not required_columns.issubset(df.columns):
raise ValueError(
f"Input CSV must contain columns: {required_columns}, got {df.columns}"
)

print(args.cost_matrix_metric)
# Run batch evaluation
batch_eval = SegmentationEvaluationBatch(
df,
Expand Down Expand Up @@ -136,6 +146,8 @@ def main():
f"{args.basename}_{row['sampleID']}_{row['category']}_error_types.png",
),
suptitle=True,
legend=False,
target_size=args.target_plot_size
)


Expand Down
2 changes: 1 addition & 1 deletion segobe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .plotter import plot_error_types, plot_barplot
from .utils import filter_mask_by_ids

__version__ = "0.1.0"
__version__ = "0.1.1"
__all__ = [
"SegmentationEvaluator",
"SegmentationEvaluationBatch",
Expand Down
Loading