Napari Draw Line

Hello,

I have points in X,Y,T and I want to draw a line from Xs,Ys,Ts to Xe,Ye,Te. I could not find tutorial for this in Napari and I have N number of such lines to draw. How can I do this using the shapes_layer with line as a shape?

My guess would be to do this in a loop first:

line_locations.append([[tcenter, ystart, xstart], [tcenter, yend, xend]])

followed by

self.viewer.add_shapes(np.asarray(line_locations), name = event_name + 'angle',shape_type='line', face_color = [0]*4, edge_color = "red", edge_width = 1)

Just testing it now.

2 Likes

Yeah that works :slight_smile: I solved it with a guess! :joy:

2 Likes

Thx! Had almost the same issue and your solution helped :grinning:

2 Likes