darsia.CropAssistant#

class CropAssistant(img, **kwargs)[source]#

Bases: PointSelectionAssistant

Graphical assistant for cropping images as part of CurvatureCorrection.

Constructor.

Based on PointSelectionAssistant configured to use points in Voxel format.

Parameters:
imgdarsia.Image

Input image.

Methods

from_image(color, width, height)

Run the assistant in automatic mode.

Attributes

pts

Selected corners to define box after cropping (voxels in matrix indexing).

corners

Named corners as {top_left, bottom_left, bottom_right, top_right}.

finalized_prompt_input

Flag controlling whether the user has entered the width and height.

width

Identified width of the box.

height

Identified height of the box.

name

Name of assistant / short version of instructions.

return_coordinates

Flag controlling whether to return coordinates or voxels.

labels

Labels for the image.

img

Image to be analyzed.

background

Background image for plotting.

fig

Figure for analysis.

ax

Axes for analysis.

block

Flag controlling whether figure is blocking.

plot_grid

Flag controlling whether grid is plotted (in 2d).

threshold

Threshold for active voxels (in 3d).

relative

Flag controlling whether threshold is relative (in 3d).

scaling

Scaling of points (in 3d).

scatter

Flag controlling whether scatter plot is used (in 3d).

use_coordinates

Flag controlling whether plots use physical coordinates.

verbosity

Flag controlling verbosity.

cmap

Colormap for plotting.

from_image(color, width, height)[source]#

Run the assistant in automatic mode.

Detect marks and define a box based on them.

Parameters:
colorUnion[list[float], np.ndarray]

Color of the marks.

widthfloat

Width of the box.

heightfloat

Height of the box.

Returns:
dict

Configuration for the ‘crop’ option of CurvatureCorrection.

corners#

Named corners as {top_left, bottom_left, bottom_right, top_right}.

finalized_prompt_input#

Flag controlling whether the user has entered the width and height.

height#

Identified height of the box.

pts#

Selected corners to define box after cropping (voxels in matrix indexing).

width#

Identified width of the box.