Cuts plugin

A plugin for generating a plot of the values along a line or path.

Plugin Type: Local

Cuts is a local plugin, which means it is associated with a channel. An instance can be opened for each channel.


Cuts plots a simple graph of pixel values vs. index for a line drawn through the image. Multiple cuts can be plotted.

There are four kinds of cuts available: line, path, freepath and beziercurve:

  • The “line” cut is a straight line between two points.

  • The “path” cut is drawn like an open polygon, with straight segments in-between.

  • The “freepath” cut is like a path cut, but drawn using a free-form stroke following the cursor movement.

  • The “beziercurve” path is a cubic Bezier curve.

If a new image is added to the channel while the plugin is active, it will update with the new calculated cuts on the new image.

If the “enable slit” setting is enabled, this plugin will also allow slit image functionality (for multidimensional images) via a “Slit” tab. In the tab UI, select one axis from the “Axes” list and draw a line. This will create a 2D image that assumes the first two axes are spatial and index the data along the selected axis. Much like Cuts, you can view the other slit images using the cut selection drop down box.

Drawing Cuts

The “New Cut Type” menu let you choose what kind of cut you are going to draw.

Choose “New Cut” from the “Cut” dropdown menu if you want to draw a new cut. Otherwise, if a particular named cut is selected then that will be replaced by any newly drawn cut.

While drawing a path or beziercurve cut, press ‘v’ to add a vertex, or ‘z’ to remove the last vertex added.

Keyboard Shortcuts

While hovering the cursor, press ‘h’ for a full horizontal cut and ‘j’ for a full vertical cut.

Deleting Cuts

To delete a cut, select its name from the “Cut” dropdown and click the “Delete” button. To delete all cuts, press “Delete All”.

Editing Cuts

Using the edit canvas function, it is possible to add new vertices to an existing path and to move vertices around. Click the “Edit” radio button to put the canvas in edit mode. If a cut is not automatically selected, you can now select the line, path, or curve by clicking on it, which should enable the control points at the ends or vertices – you can drag these around. To add a new vertex to a path, hover the cursor carefully on the line where you want the new vertex and press ‘v’. To get rid of a vertex, hover the cursor over it and press ‘z’.

You will notice one extra control point for most objects, which has a center of a different color – this is a movement control point for moving the entire object around the image when in edit mode.

You can also select “Move” to just move a cut unchanged.

Changing Width of Cuts

The width of ‘line’ cuts can be changed using the “Width Type” menu:

  • “none” indicates a cut of zero radius; i.e., only showing the pixel values along the line

  • “x” will plot the sum of values along the X axis orthogonal to the cut.

  • “y” will plot the sum of values along the Y axis orthogonal to the cut.

  • “perpendicular” will plot the sum of values along an axis perpendicular to the cut.

The “Width radius” controls the width of the orthogonal summation by an amount on either side of the cut – 1 would be 3 pixels, 2 would be 5 pixels, etc.

Saving Cuts

Use the “Save” button to save the Cuts plot as as image and data as a Numpy compressed archive.

Copying Cuts

To copy a cut, select its name from the “Cut” dropdown and click the “Copy Cut” button. A new cut will be created from it. You can then manipulate the new cut independently.

User Configuration

It is customizable using ~/.ginga/plugin_Cuts.cfg, where ~ is your HOME directory:

# Cuts plugin preferences file
# Place this in file under ~/.ginga with the name "plugin_Cuts.cfg"

# If set to True will always select a cut after drawing it
select_new_cut = True

# If set to True will automatically change to "move" mode after draw
draw_then_move = True

# If set to True will label cuts with a text annotation
label_cuts = True

# If set to True will add a legend to the cuts plot
show_cuts_legend = False

# If set to True will add Slit tab
enable_slit = False

# Default cut colors
colors = ['magenta', 'skyblue2', 'chartreuse2', 'cyan', 'pink', 'burlywood2', 'yellow3', 'turquoise', 'coral1', 'mediumpurple2']

# If set to True, will update graph continuously as cursor is dragged
# around image
drag_update = False