Skip to content

Commit 755f444

Browse files
committed
catch cases where the track is outside the atlas region volume and remove these coordinates
1 parent 1b58231 commit 755f444

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ibllib/pipes/ephys_alignment.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ def __init__(self, xyz_picks, chn_depths=None, track_prev=None,
3535
self.xyz_samples = histology.interpolate_along_track(self.xyz_track,
3636
self.sampling_trk -
3737
self.sampling_trk[0])
38+
# ensure none of the track is outside the y or x lim of atlas
39+
xlim = np.bitwise_and(self.xyz_samples[:, 0] > self.brain_atlas.bc.xlim[0],
40+
self.xyz_samples[:, 0] < self.brain_atlas.bc.xlim[1])
41+
ylim = np.bitwise_and(self.xyz_samples[:, 1] < self.brain_atlas.bc.ylim[0],
42+
self.xyz_samples[:, 1] > self.brain_atlas.bc.ylim[1])
43+
rem = np.bitwise_and(xlim, ylim)
44+
self.xyz_samples = self.xyz_samples[rem]
3845

3946
self.region, self.region_label, self.region_colour, self.region_id\
4047
= self.get_histology_regions(self.xyz_samples, self.sampling_trk, self.brain_atlas)

0 commit comments

Comments
 (0)