src.imagedata.apps.Siemens package
Submodules
src.imagedata.apps.Siemens.ROI module
src.imagedata.apps.Siemens.draw_antialiased module
Library to draw an antialiased line. http://stackoverflow.com/questions/3122049/drawing-an-anti-aliased-line-with-thepython-imaging-library https://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm
https://yellowsplash.wordpress.com/2009/10/23/fast-antialiased-circles-and-ellipses-from-xiaolin-wus-concepts/ https://stackoverflow.com/questions/37589165/drawing-an-antialiased-circle-as-described-by-xaolin-wu#37714284
- src.imagedata.apps.Siemens.draw_antialiased.boundary_fill4(canvas, start_x, start_y, boundary_value, fill_value)[source]
- src.imagedata.apps.Siemens.draw_antialiased.draw_circle_mask(canvas, center_x, center_y, outer_radius, colour, threshold, fill=True)[source]
Draw circle mask on NumPy array.
Apply algorithm for drawing anti-aliased circle. Draw points only when the alpha blending is above a set threshold. Only given _colour value is drawn. Intended usage is as a mask index.
Optionally, fill the circle with the same _colour.
- Parameters:
canvas – numpy array
center_x – center of circle in array coordinates (int)
center_y – center of circle in array coordinates (int)
outer_radius – radius of circle in array dimension (float)
colour – _colour to draw (mask index) (int)
threshold – only pixels with an alpha > threshold will be drawn (float, 0.0-1.0)
fill – whether to fill the circle (boolean)
- src.imagedata.apps.Siemens.draw_antialiased.draw_ellipse_mask(canvas, center_x, center_y, outer_radius, colour, threshold, fill=True)[source]
Draw ellipse mask on NumPy array.
Apply algorithm for drawing anti-aliased ellipse. Draw points only when the alpha blending is above a set threshold. Only given _colour value is drawn. Intended usage is as a mask index.
Optionally, fill the ellipse with the same _colour.
- Reference:
https://yellowsplash.wordpress.com/2009/10/23/fast-antialiased-circles-and-ellipses-from-xiaolin-wus-concepts/ https://stackoverflow.com/questions/37589165/drawing-an-antialiased-circle-as-described-by-xaolin-wu#37714284
- Parameters:
canvas – numpy array
center_x – center of ellipse in array coordinates (int)
center_y – center of ellipse in array coordinates (int)
outer_radius – radius of circle in array dimension (float)
colour – colour to draw (mask index) (int)
threshold – only pixels with an alpha > threshold will be drawn (float, 0.0-1.0)
fill – whether to fill the circle (boolean)
- src.imagedata.apps.Siemens.draw_antialiased.draw_line_mask(canvas, x1, y1, x2, y2, colour, threshold)[source]
Draw line mask on NumPy array.
Apply the Xialon Wu anti-aliasing algorithm for drawing line. Draw points only when the alpha blending is above a set threshold. Only given colour value is drawn. Intended usage is as a mask index.
- Parameters:
canvas – numpy array (2D)
(x1 (x2,y2) – line end points (float)
y1) (x2,y2) – line end points (float)
:param : line end points (float) :type : x2,y2 :param colour: colour to draw (mask index) (int) :param threshold: only pixels with an alpha > threshold will be drawn (float, 0.0-1.0)
- src.imagedata.apps.Siemens.draw_antialiased.draw_polygon_mask(canvas, points, colour, threshold, fill=True)[source]
Make a 2D mask [ny,nx] on canvas
Optionally, fill the polygon with the same colour.
- Parameters:
canvas – numpy array
points – polygon points (list of tuples (x,y)) (float)
colour – colour to draw (mask index) (int)
threshold – only pixels with an alpha > threshold will be drawn (float, 0.0-1.0)
fill – whether to fill the circle (boolean)
- src.imagedata.apps.Siemens.draw_antialiased.flood_fill4(canvas, start_x, start_y, old_value, fill_value)[source]