How to export a track from brainreg-segment
This guide shows you how to turn a track traced with
brainreg-segment into
xyz_picks.json.
Prerequisites
The histology registered to the Allen atlas with brainreg.
iblatlas, which is installed with the GUI.
Steps
Trace the track in brainreg-segment, following its tutorial, with these settings:
Setting
Value
Tracing space
Registered atlas space, not the original sample space
Spline points
Fewer than 100 when fitting the track
Click To brainrender to save the track as a
.npyfile. It is written to thesegmentation/atlas_space/tracksfolder of the brainreg output, named after the track.Convert it to IBL coordinates and save it:
import json from pathlib import Path import numpy as np from iblatlas.atlas import AllenAtlas atlas = AllenAtlas(25) picks_path = Path('/path/to/picks') # brainreg track: CCF coordinates in µm, ordered AP, DV, ML xyz_apdvml = np.load('/path/to/brainreg/output/segmentation/atlas_space/tracks/track_0.npy') # IBL coordinates: ML, AP, DV relative to bregma, converted from m to µm xyz_mlapdv = atlas.ccf2xyz(xyz_apdvml, ccf_order='apdvml') * 1e6 with open(picks_path / 'xyz_picks.json', 'w') as f: json.dump({'xyz_picks': xyz_mlapdv.tolist()}, f, indent=2)
For a multi-shank probe, trace each shank and save each as
xyz_picks_shank<N>.json, counting from 1.In the session YAML, use
picks_pathas thepicksfolder (see How to write a session YAML for one probe).