Metadata-Version: 2.4
Name: trk_to_annotation
Version: 0.0.2
Summary: Utilities for converting .trk tractography files into Neuroglancer precomputed annotation format, and serving them locally with HTTP requests.
Author-email: James Scherick <james_scherick@outlook.com>
License-Expression: Apache-2.0
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.3.5
Requires-Dist: nibabel>=5.3.2
Requires-Dist: cloud-volume>=12.8.0
Requires-Dist: rangehttpserver>=1.4.0
Dynamic: license-file

# trk_to_annotation
This repository provides utilities for converting .trk tractography files into Neuroglancer precomputed annotation format, and serving them locally with HTTP requests.

## Install
```
python -m build
pip install .
```

## Usage
```
python -m trk_to_annotation <trk_file> \
    --annotation_output_dir ./precomputed_annotations \
    --segmentation_output_dir ./precomputed_segmentations \
    --grid_densities 1 2 4 8 16
```

Arguments
| Argument | Required | Default | Description |
| :---:   | :---: | :---: | :---: |
| trk_file | ✅ | — | Path to the input .trk file |
| --annotation_output_dir | ❌ | ./precomputed_annotations | Output directory for precomputed annotations |
| --segmentation_output_dir | ❌ | ./precomputed_annotations/precomputed_segmentations | Output directory for precomputed segmentations |
| --grid_densities | ❌ | [1, 2, 4, 8, 16] |Grid densities (powers of two, ascending order) |

## Running server for neuroglancer

Run the following command in the directory with your outputted folders
```
python -m trk_to_annotation.http_server
```

You should now be able to access the annotation and segmentation layers on neuroglancer via http://localhost:8000/
