1010import ibllib .atlas as atlas
1111from ibllib .ephys .spikes import probes_description as extract_probes
1212from ibllib .dsp .utils import fcn_cosine
13- from ibllib .ephys .neuropixel import TIP_SIZE_UM
13+ from ibllib .ephys .neuropixel import TIP_SIZE_UM , trace_header
1414from ibllib .qc import base
1515
1616
@@ -168,7 +168,7 @@ def interpolate_along_track(xyz_track, depths):
168168 return xyz_channels
169169
170170
171- def get_brain_regions (xyz , channels_positions = SITES_COORDINATES , brain_atlas = brain_atlas ):
171+ def get_brain_regions (xyz , channels_positions = None , brain_atlas = brain_atlas ):
172172 """
173173 :param xyz: numpy array of 3D coordinates corresponding to a picked track or a trajectory
174174 the deepest point is assumed to be the tip.
@@ -182,6 +182,11 @@ def get_brain_regions(xyz, channels_positions=SITES_COORDINATES, brain_atlas=bra
182182 this is the depth along the probe (from the first point which is the deepest labeled point)
183183 Due to the blockiness, depths may not be unique along the track so it has to be prepared
184184 """
185+
186+ if channels_positions is None :
187+ geometry = trace_header (version = 1 )
188+ channels_positions = np .c_ [geometry ['x' ], geometry ['y' ]]
189+
185190 xyz = xyz [np .argsort (xyz [:, 2 ]), :]
186191 d = atlas .cart2sph (xyz [:, 0 ] - xyz [0 , 0 ], xyz [:, 1 ] - xyz [0 , 1 ], xyz [:, 2 ] - xyz [0 , 2 ])[0 ]
187192 indsort = np .argsort (d )
@@ -278,8 +283,9 @@ def register_aligned_track(probe_id, xyz_channels, chn_coords=None, one=None, ov
278283 2) Channel locations are set to the trajectory
279284 """
280285 assert one
281- if not np .any (chn_coords ):
282- chn_coords = SITES_COORDINATES
286+ if chn_coords is None :
287+ geometry = trace_header (version = 1 )
288+ chn_coords = np .c_ [geometry ['x' ], geometry ['y' ]]
283289
284290 insertion = atlas .Insertion .from_track (xyz_channels , brain_atlas )
285291 tdict = create_trajectory_dict (probe_id , insertion , provenance = 'Ephys aligned histology track' )
0 commit comments