Purpose

The module CSOLiveWireProcessor allows for a semi-interactive segmentation of structures with edge features in images.

Usage

Attach this module to a SoView2DCSOEditor’s processor input.

Optionally, attach a cost image to the module’s input (for a use in OrthoViewers, have a look at the example network to learn how an input cost image needs to be connected).

Details

Internally, the module generates a graph representation of the image to work on.

The graph’s nodes represent image pixels and edges represent neighboring relations of pixels. The edges are weighted on base of the cost function, which could also be an image (gradient image). If a starting and an ending point are defined on such a graph, the shortest path between them can be computed using Dijkstra’s well-known algorithm. In order to find a closed contour around some object in an image, at least three points need to be defined.

Interaction

A contour can be drawn by consecutively placing seed points into an image. The module will find a path between those seed point on base of the shortest path algorithm as stated above. If a seed point is placed, the mouse pointer can be moved around and the path is updated in real time between the last set point and the current position of the mouse cursor. If the according mouse button is pressed again, the last path is fixed and another one spawns from this last point to the mouse pointer.

A contour is closed if either the last point is placed in the vicinity of the first point or if the mouse button is double-clicked.

If the mouse button is held down and the mouse is moved, a continuous freehand contour is drawn from the last set seed point to a seed point that is placed where the mouse button has then been released again.

If a contour is finished (closed), each seed point can be selected and be moved by dragging it. The paths to both sides will be updated and computed according to the shortest path algorithm. If a path of a finished live wire contour is clicked, a new seed point is inserted there, and the paths to both sides are updated. If a seed point is selected and DEL is pressed, the seed point is removed and the remaining path is updated (by the shortest path algorithm).

If a contour is not yet finished and a seed point has been placed, the pressing of DEL deletes the last set seed point. A multiple pressing of DEL removes the seed points in reverse order in which they were set. If the last seed point (the first set seed point) is removed in such way, the whole CSO is removed.

Windows

Default Panel

../../../Modules/Inventor/SoCSO/mhelp/Images/Screenshots/CSOLiveWireProcessor._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

outProcessorData

name: outProcessorData, type: CSOProcessorData(MLBase)

Parameter Fields

Visible Fields

Is Processing

name: isProcessing, type: Bool, persistent: no

Shows whether the module is processing which is when the user interacts.

Use input image

name: useInputImage, type: Bool, default: FALSE

If checked, the optional input image is evaluated as a cost image.

If unchecked or if no input image is attached, the currently visible image slice is used.

Use costs from input image directly

name: useCostValuesFromInputImageDirectly, type: Bool, default: FALSE

If checked, the module computes the weights of the graph edges as a difference between the image’s values.

Generate closed CSO

name: generateClosedCSO, type: Bool, default: TRUE

If checked, the module generates closed CSOs and the closing mode depends of the option below.

Otherwise the generated CSOs are left open if a double click is performed.

Mode (finishingMode)

name: finishingMode, type: Enum, default: OnDistance

Defines the closing mode.

Values:

Title Name Description
Double Click OnDoubleClick Finishes the currently edited contour by double-clicking. A path between the current and the first seed point is generated.
Distance OnDistance If the last seed point is placed in the vicinity of the first seed point (distance can be adjusted by Distance), the contour is closed.

Distance

name: finishingDistance, type: Float, default: 12

Sets the minimal distance of the last and the first seed points if the Mode is set to OnDistance.

Drag. Tolerance

name: draggingTolerance, type: Integer, default: 32, minimum: 0

Sets the distance in pixel that the mouse can be moved with the mouse button held down after placing a seed point before the module switches from the live wire mode to the freehand mode.

Gradient Feature Weight

name: gradientWeight, type: Float, default: 0.43000001, minimum: 0, maximum: 1

Sets the weight of the gradient feature in cost calculation.

Laplacian Feature Weight

name: laplacianWeight, type: Float, default: 0.43000001, minimum: 0, maximum: 1

Sets the weight of the laplacian feature in cost calculation.

Directional Feature Weight

name: directionalWeight, type: Float, default: 0.14, minimum: 0, maximum: 1

Sets the weight of the directional feature in cost calculation.

Mode (smoothingMode)

name: smoothingMode, type: Enum, default: SplineApproximation

Defines the smoothing mode for the generated CSO.

Values:

Title Name Description
None None No smoothing at all.
Spline Approximation SplineApproximation Smoothing by a spline approximation (smoothest).
Spline Interpolation SplineInterpolation Smoothing by spline interpolation.

Amount

name: smoothingAmount, type: Integer, default: 2, minimum: 1

Sets that every nth computed path point is taken into account in the spline approximation smoothing. A higher value results in a smoother, yet more inaccurate contour.

Neigh. Mode

name: neighborhoodMode, type: Enum, default: 8 Neighborhood

Defines the neighborhood mode for the constructed graph.

Values:

Title Name Description
4 Neighborhood 4 Neighborhood Only edges to the direct neighbors of a pixel are being constructed and weighted.
8 Neighborhood 8 Neighborhood All neighbors, even the diagonal neighbors of a pixel are being considered and edges are being constructed to them for the internal graph.

Hidden Fields

updateMode

name: updateMode, type: Enum, default: AutoClear

Values:

Title Name
Off Off
Auto Update AutoUpdate
Auto Clear AutoClear

autoApply

name: autoApply, type: Bool, default: FALSE

apply

name: apply, type: Trigger

done

name: done, type: Trigger, persistent: no

emptyGroupBeforeGeneration

name: emptyGroupBeforeGeneration, type: Bool, default: FALSE

addCSOToGroupMode

name: addCSOToGroupMode, type: Enum, default: AddToGroupByLabel

Values:

Title Name
None AddToGroupNone
By Label AddToGroupByLabel
By Id AddToGroupById

addCSOToGroupWithLabel

name: addCSOToGroupWithLabel, type: String

addCSOToGroupWithId

name: addCSOToGroupWithId, type: Integer, default: -1

id

name: id, type: Integer, default: 0

multipleSliceCSOErrorHandling

name: multipleSliceCSOErrorHandling, type: Enum, default: PrintWarning

Sets the behavior of the module when the user changes the current slice while generating a CSO.

This needs to be handled, because the underlying graph is only generated for the current slice. On changing the slice, the graph is undefined.

Values:

Title Name Description
Remove CSO RemoveCSO Removes the last (currently edited) CSO.
Remove Last Seed Point RemoveLastSeedPoint Removes the last seed point (that is the one that is on another slice than the rest of the currently edited CSO’s points).
Print Warning PrintWarning

The module does not remove anything but only prints a warning to the console.

Note that the currently edited CSO is not in-plane and that the module might even cause a crash.

isCurrentlyGenerating

name: isCurrentlyGenerating, type: Bool, default: FALSE

If a CSO is currently being generated, this flag is set to true from inside the module.

This field can not be edited by the user.