Skip to content

jilei-hao/segmentation-propagation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

segmentation-propagation

The function propagation.m is used to transform a segmentation in one frame to other frames within an image series. Deformable registration between frames is performed with the "greedy" tool.

Prerequisites

Greedy

Download greedy from https://sourceforge.net/projects/greedy-reg/

c3d

Download c3d from https://sourceforge.net/projects/c3d/

cmrep (vtklevelset)

Download cmrep from https://sourceforge.net/projects/cmrep/files/cmrep/

Python dependencies

  • Python 3.9 and above. If using Python version earlier than Python 3.9 is mandatory and vtk9 cannot be installed. Set disablePythonMesh to true to avoid any exceptions
  • pip3 install vtk
  • pip3 install nibabel
  • pip3 install SimpleITK

Example

Run in a python script

  • Examples for running in python scripts, see examples/run.py

Run in commandline interface or in a batch script

Compile a csv file with following columns:

  • Tag: for uniquely identifying each run
  • Image: absolute path of the 4D image
  • Segmentation: absolute path of the reference segmentation image
  • Reference Time Point: the time point (or frame) that reference segmentation image belongs to
  • Target Time Points: a semicolon separated list contains all the time points (or frames) to propagate to

Warning:

  • Don't include header in the .csv file
  • Don't wrap values with double quotes

Modify the config.json to setup local environment and execution settings

Following is a sample command. Modify the argument with local environment settings

/segmentation-propagation/scripts/batch_run.sh \
"/Absolute/Path/To/file_list.csv" \
"/Absolute/Path/To/ProjectDir/segmentation-propagation" \
"/Absolute/Path/To/ConfigFile/segmentation-propagation/config.json" \
"/Absolute/Path/To/OutputDir"

# arg1: filelist.csv location
# arg2: project directory. i.e. the folder contains propagation.py
# arg3: config file location
# arg4: output directory

The result will be saved to folders in the output directory, nameed by tags. Execution log will also be saved in the tag named folders

Version History

Version 1.0

  • First usable version

Version 1.1

  • Modfied to adopt latest greedy and vtkleveset

Version 1.2

  • Reorganizes mesh output files into a dedicated mesh folder with new naming convention
  • Added mesh point data renaming logic; Added multiple options for configure greedy.
  • Added Mesh Warping feature; Added run mode that can warp multiple meshes using existing registration matrices without running registration again.

Version 1.2.1

  • Added flag to control smoothing for added mesh to warp

Version 1.3.0

  • Added c3d location option
  • Added support for windows paths

Version 1.4.0

  • Added command line interface
  • Added batch_run script for running multiple propagations
  • Added multiple configuration for server deployment and troubleshooting

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • MATLAB 55.9%
  • Python 42.3%
  • Shell 1.8%