Skip to content

JINcloud6/TriSAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

TriSAM

TriSAM is a 3D segmentation pipeline built around the Segment Anything Model (SAM). This repository contains a single entry point (model/main.py) that loads a 3D HDF5 volume, generates initial seeds, computes SAM embeddings, and produces 3D segmentations.

Requirements

  • Python 3.9+
  • CUDA-capable GPU (recommended)

Install dependencies with pip (use a virtual environment or conda if desired):

pip install numpy h5py torch scipy scikit-image opencv-python cc3d
pip install git+https://github.com/facebookresearch/segment-anything.git

If you already have SAM installed, you can skip the second line.

Data & Checkpoints

Set the following environment variables so the script can find your data and SAM checkpoint:

export TRISAM_DATA_ROOT=/path/to/data
export TRISAM_SAM_CHECKPOINT=/path/to/checkpoints/sam_vit_h_4b8939.pth
export TRISAM_OUTPUT_DIR=/path/to/output

Defaults (if not set):

  • TRISAM_DATA_ROOT: ./data
  • TRISAM_SAM_CHECKPOINT: ./checkpoints/sam_vit_h_4b8939.pth
  • TRISAM_OUTPUT_DIR: ./outputs

Place the macaque dataset at:

${TRISAM_DATA_ROOT}/macaque_mpi_176-240nm.h5

The HDF5 file is expected to contain a dataset named main.

Running the Example (macaque)

From the repo root:

python model/main.py macaque 0.98 0.8 "point+bbox" 0

Arguments:

  1. dataset: one of macaque, mouse_border, mouse_patch
  2. eta: initial segmentation threshold (float)
  3. tau: SAM probability threshold (float)
  4. prompt: prompt type, e.g. point, box, or point+bbox
  5. plane: plane index used for mouse_border (ignored for macaque)

Outputs are written under TRISAM_OUTPUT_DIR (default: ./outputs).

Notes

  • CUDA_VISIBLE_DEVICES defaults to 0; override it if you want to target a different GPU.
  • Large volumes can take a long time to process; consider running on a dedicated GPU server.

About

3d blood vessel segmentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages