rsatoolbox.vis.icon module

icon object which can be plotted into an axis

class rsatoolbox.vis.icon.Icon(image=None, string=None, color=None, marker=None, cmap=None, border_type=None, border_width=2, make_square=False, circ_cut=None, resolution=None, marker_front=True, markeredgewidth=2, font_size=None, font_name=None, font_color=None)[source]

Bases: object

Icon object, i.e. an object which can be plotted into an axis or as an axis label.

Parameters:
  • image (np.ndarray or PIL.Image or RDMs or Icon) – the image to use as an icon arrays and images should give the image directly RDMs takes the average RDM from the object If an Icon is passed its image property is used

  • string (String) – string to place on the icon

  • color (color definition) – background / border color default: None -> no border or background

  • marker (matplotlib markertype) – sets what kind of symbol to plot

  • cmap (color map) – color map applied to the image

  • border_type (String) –

    • None : default, puts the color as a background where the alpha of the image is not 0

    • ’pad’ : pads the image with the border color -> square border

    • ’conv’ : extends the area by convolving with a circle

  • border_width (integer) – width of the border

  • make_square (bool) – if set to true the image is first reshaped into a square

  • circ_cut (flag) –

    sets how the icon is cut into circular shape:

    • None : default, no cutting

    • ’cut’ : sets alpha to 0 out of a circular aperture

    • ’cosine’ : sets alpha to a raised cosine window

    • a number between 0 and 1 : a tukey window with the flat proportion of the aperture given by the number. For 0 this corresponds to the cosine window, for 1 it corresponds to ‘cut’.

  • resolution (one or two numbers) – sets a resolution for the icon to which the image is resized prior to all processing. If only one number is provided, the image is resized to a square with that size

  • marker_front (bool) –

    switches whether the marker is plotted in front or behind the image. If True the marker is plotted unfilled in front If False the marker is plotted behind the image filled.

    default = True

  • font_size (float) – size of any annotation text

  • font_name (str) – annotation font

  • font_color (np.ndarray) – font color for annotations

property border_type
property border_width
property circ_cut
property cmap
property color
property image
property make_square
plot(x, y, ax=None, size=None)[source]

plots the icon into an axis

Parameters:
  • x (float) – x-position

  • y (float) – y-position

  • ax (matplotlib axis) – the axis to plot in

  • size – float size of the icon scaling the image

recompute_final_image()[source]

computes the icon image from the parameters

This function handles most of the image processing and must be run again if any properties are changed. If you use set to change properties this is automatically run.

property resolution
property string
x_tick_label(x, size, offset, **kwarg)[source]

uses the icon as a ticklabel at location x

Parameters:
  • x (float) – the position of the tick

  • size (float) – scaling the size of the icon

  • offset (integer) – how far the icon should be from the axis in axis units

  • ax (matplotlib axis) – the axis to put the label on

y_tick_label(y, size, offset, **kwarg)[source]

uses the icon as a ticklabel at location x

Parameters:
  • y (float) – the position of the tick

  • size (float) – scaling the size of the icon

  • offset (integer) – how far the icon should be from the axis in axis units

  • ax (matplotlib axis) – the axis to put the label on

rsatoolbox.vis.icon.icons_from_folder(folder, resolution=None, color=None, cmap=None, border_type=None, border_width=2, make_square=False, circ_cut=None)[source]

generates a dictionary of Icons for all images in a folder