Thanks to visit codestin.com
Credit goes to github.com

Skip to content

morphonets/pysnt

Repository files navigation

SNT

PySNT

Python wrapper for SNT, the ImageJ framework for Neuroanatomy

Technical Features

  • Complete Java Bridge: Full programmatic access to SNT's neuroanatomy toolkit from Python (via JPype and ScyJava), enabling integration of advanced tracing, analysis, and visualization capabilities into Python workflows

  • Consistent API: 1:1 correspondence with SNT's Java API while maintaining Python conventions, allowing developers familiar with either language to work efficiently

  • Full Type Annotation: Type hints for all methods and classes, enabling static type checking with mypy and improved code reliability

  • IDE Integration: Autocomplete, inline documentation, and parameter hints in VS Code, PyCharm, Spyder, and Jupyter notebooks through type stubs and docstrings

  • Performant: Lazy class loading minimizes initialization overhead, loading only required SNT components on demand

  • Native Python Converters: Automatic conversion between SNT objects and Python-native types (SNTChart → matplotlib figures; SNTTable → pandas DataFrames; ImageJ ImagePlus → NumPy arrays; Java Collections → Python lists/dicts, etc.)

Limitations

  • Bleeding Edge: Requires building SNT from the main branch (stable release integration planned for SNT v5.0)

  • Early Stage Software: Limited test coverage and community validation: Expect potential bugs and breaking API changes

Getting Started for Developers

Environment Setup

# 1. Clone the repository
git clone https://github.com/morphonets/pysnt.git
cd pysnt

# 2. Set up conda/mamba (if not already configured)
mamba config append channels conda-forge
mamba config set channel_priority strict

# 3. Create and activate the development environment
mamba env create -f environment-dev.yml
mamba activate pysnt-dev

# 4. Install PySNT in development mode
pip install -e .[dev]

# 5. Verify the setup
python -c "import pysnt; print('PySNT imported successfully!')"

# 6. Have a look at ./dev/README.md for common workflows

IDE Configuration

PyCharm

  1. Open this folder as a project in PyCharm
  2. Go to File → Settings → Project → Python Interpreter
  3. Select the 'pysnt' conda environment

VS Code

  1. Open this folder in VS Code
  2. Install recommended extensions when prompted
  3. Select the 'pysnt' Python interpreter when prompted

Spyder

  1. Make sure Spyder is installed in the 'pysnt' environment:
     conda activate pysnt
     conda install spyder
  2. Launch Spyder from the activated environment
  3. Open this folder as a project: File → Open Project

Project Structure

pysnt/
├── src/pysnt/          # Main package source
├── tests/              # Test suite
├── scripts/            # Development scripts
├── docs/               # Documentation source
├── dev/                # Development utilities and templates
├── environment.yml     # Environment specification (runtime)
└── environment-dev.yml # Environment specification (development)

Dependencies

Core Dependencies (Required)

  • install-jdk - Java management
  • matplotlib - Used extensively for plotting and figure creation
  • numpy - Used throughout for array operations
  • pyimagej - ImageJ integration
  • scyjava - Core Java integration
  • xarray - Dataset operations
  • pyobjc-core; sys_platform == 'darwin' - macOS support

Optional Dependencies (Display/Conversion Features)

  • cairosvg - SNTChart SVG to matplotlib conversion
  • PyMuPDF - SNTChart PDF to matplotlib conversion
  • pandas - DataFrame operations and SNTTable conversion
  • pandasgui - Interactive DataFrame display

Need Help?

Releases

No releases published

Packages

No packages published

Languages