Skip to content

Compute minimal regions of interest (ROIs) from line coordinate CSV files in 2D or 3D image volumes.

Notifications You must be signed in to change notification settings

avweigel/roi-finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

ROI Finder

Compute the minimal region of interest (ROI) that contains all line segments listed in one or more CSV files.
Supports both 2D and 3D image volumes, optional voxel scaling, safety margins, and clamping to known image shapes.


📦 Overview

compute_min_roi.py reads one or more CSVs containing line endpoints and returns the smallest bounding box that encloses them all.

Each CSV row should describe a line segment with endpoint coordinates, using one of these column patterns:

2D CSV headers 3D CSV headers
x1, y1, x2, y2 x1, y1, z1, x2, y2, z2
x_start, y_start, x_end, y_end x_start, y_start, z_start, x_end, y_end, z_end

If your CSV headers differ, you can map them using the --cols option.


🧮 Example usage

# Basic 2D example
python compute_min_roi.py lines.csv

# 3D example with 3-voxel margin and JSON output
python compute_min_roi.py lines3d.csv --margin 3 --out roi.json

# Multiple CSVs
python compute_min_roi.py a.csv b.csv c.csv

# Clamp to a known image shape (Z Y X for 3D, Y X for 2D)
python compute_min_roi.py lines3d.csv --shape 64 512 512 --int

# Custom headers
python compute_min_roi.py my.csv --cols x1=X_start y1=Y_start x2=X_stop y2=Y_stop

# Include voxel size to also report physical ROI
python compute_min_roi.py lines3d.csv --voxel-size 0.3 0.01 0.01

About

Compute minimal regions of interest (ROIs) from line coordinate CSV files in 2D or 3D image volumes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages