viewertoolclasses¶
Supporting classes for tools in the ViewerWidget
- class tuiview.viewertoolclasses.PolygonToolInfo(*args: Any, **kwargs: Any)[source]¶
Class derived from ToolInfo that contains the poly etc but has a getDisplaySelectionMask() mask to create a mask inside poly
- class tuiview.viewertoolclasses.PolylineToolInfo(*args: Any, **kwargs: Any)[source]¶
Class derived from ToolInfo that contains the polyline etc has method for getting profile
- class tuiview.viewertoolclasses.ToolInfo(*args: Any, **kwargs: Any)[source]¶
Class derived from QPolygon that contains the poly that the user selected, but has some other methods
- tuiview.viewertoolclasses.bresenhamline(start, end, max_iter=5)[source]¶
Returns a list of points from (start, end] by ray tracing a line b/w the points. Parameters: * start: An array of start points (number of points x dimension) * end: An end points (1 x dimension) or An array of end point corresponding to each start point (number of points x dimension) * max_iter: Max points to traverse. if -1, maximum number of required points are traversed
Returns: * linevox (n x dimension) A cumulative array of all points traversed by all the lines so far.
>>> s = np.array([[3, 1, 9, 0],[0, 0, 3, 0]]) >>> bresenhamline(s, np.zeros(s.shape[1]), max_iter=-1) array([[ 3, 1, 8, 0], [ 2, 1, 7, 0], [ 2, 1, 6, 0], [ 2, 1, 5, 0], [ 1, 0, 4, 0], [ 1, 0, 3, 0], [ 1, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0], [ 0, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0], [ 0, 0, -1, 0], [ 0, 0, -2, 0], [ 0, 0, -3, 0], [ 0, 0, -4, 0], [ 0, 0, -5, 0], [ 0, 0, -6, 0]])