Skip to main content

Class: VolumeCroppingTool

VolumeCroppingTool provides manipulatable spheres and real-time volume cropping capabilities. It renders interactive handles (spheres) at face centers and corners of a cropping box, allowing users to precisely adjust volume boundaries through direct manipulation in 3D space.

Remarks

This tool creates a complete 3D cropping interface with:

  • 6 face spheres for individual axis cropping (along volume's X, Y, Z axes)
  • 8 corner spheres for multi-axis cropping
  • 12 edge lines connecting corner spheres
  • Real-time clipping plane updates
  • Synchronization with VolumeCroppingControlTool working on the same series instance UID for cross-viewport interaction
  • Support for volumes with any orientation (including oblique/rotated volumes)

The tool automatically adapts to the volume's orientation by using the volume's direction matrix. Clipping planes are aligned with the volume's intrinsic axes (X, Y, Z) rather than world axes, ensuring proper cropping regardless of how the volume is oriented in 3D space.

Example

// Basic setup
const toolGroup = ToolGroupManager.createToolGroup('volume3D');
toolGroup.addTool(VolumeCroppingTool.toolName);

// Configure with custom settings
toolGroup.setToolConfiguration(VolumeCroppingTool.toolName, {
showCornerSpheres: true,
showHandles: true,
initialCropFactor: 0.1,
sphereColors: {
SAGITTAL: [1.0, 1.0, 0.0], // Yellow for X-axis (typically sagittal) spheres
CORONAL: [0.0, 1.0, 0.0], // Green for Y-axis (typically coronal) spheres
AXIAL: [1.0, 0.0, 0.0], // Red for Z-axis (typically axial) spheres
CORNERS: [0.0, 0.0, 1.0] // Blue for corner spheres
},
sphereRadius: 10,
grabSpherePixelDistance: 25
});

// Activate the tool
toolGroup.setToolActive(VolumeCroppingTool.toolName);

// Programmatically control visibility
const tool = toolGroup.getToolInstance(VolumeCroppingTool.toolName);
tool.setHandlesVisible(true);
tool.setClippingPlanesVisible(true);

// Toggle visibility for interactive UI
function toggleCroppingInterface() {
const handlesVisible = tool.getHandlesVisible();
const planesVisible = tool.getClippingPlanesVisible();

// Toggle handles (spheres and edge lines)
tool.setHandlesVisible(!handlesVisible);

// Toggle clipping effect
tool.setClippingPlanesVisible(!planesVisible);

}

// Common UI scenarios
// Show handles but disable cropping (for positioning)
tool.setHandlesVisible(true);
tool.setClippingPlanesVisible(false);

// Hide handles but keep cropping active (for clean view)
tool.setHandlesVisible(false);
tool.setClippingPlanesVisible(true);

VolumeCroppingTool

Configuration

Events

VOLUMECROPPING_TOOL_CHANGED - Fired when sphere positions change or clipping planes are updated. Event detail includes:

  • originalClippingPlanes: ClippingPlane[] - Array of 6 clipping planes [XMIN, XMAX, YMIN, YMAX, ZMIN, ZMAX]
  • seriesInstanceUID: string - Series instance UID for event filtering
  • viewportId?: string - Optional viewport ID
  • renderingEngineId?: string - Optional rendering engine ID VOLUMECROPPINGCONTROL_TOOL_CHANGED - Listens for changes from VolumeCroppingControlTool VOLUME_VIEWPORT_NEW_VOLUME - Listens for new volume loading to reinitialize cropping bounds TOOLGROUP_VIEWPORT_ADDED - Listens for new viewport additions to extend resize observation

Methods

  • setHandlesVisible(visible: boolean): Show/hide manipulation spheres and edge lines
  • setClippingPlanesVisible(visible: boolean): Enable/disable volume clipping planes
  • getHandlesVisible(): Get current handle visibility state
  • getClippingPlanesVisible(): Get current clipping plane visibility state
  • setRotatePlanesOnDrag(enable: boolean): Enable/disable rotating clipping planes on drag (default: false)
  • getRotatePlanesOnDrag(): Get current rotate planes on drag state

See

Extends

Constructors

new VolumeCroppingTool()

new VolumeCroppingTool(toolProps, defaultToolProps): VolumeCroppingTool

Parameters

toolProps: PublicToolProps = {}

defaultToolProps: SharedToolProp = ...

Returns

VolumeCroppingTool

Overrides

BaseTool.constructor

Defined in

tools/src/tools/VolumeCroppingTool.ts:228

Properties

_hasResolutionChanged

_hasResolutionChanged: boolean = false

Flag tracking if rendering resolution has been modified during interaction

Defined in

tools/src/tools/VolumeCroppingTool.ts:196


_resizeObservers

_resizeObservers: Map<any, any>

Map of ResizeObserver instances for viewport resize handling

Defined in

tools/src/tools/VolumeCroppingTool.ts:194


_viewportAddedListener()

_viewportAddedListener: (evt) => void

Event listener for new viewport additions

Parameters

evt: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:195


cleanUp()

cleanUp: () => void

Cleanup function for resetting tool state after interactions

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:193


configuration

configuration: Record<string, any>

The configuration for this tool. IBaseTool contains some default configuration values, and you can use configurationTyped to get the typed version of this.

Inherited from

BaseTool.configuration

Defined in

tools/src/tools/base/BaseTool.ts:47


cornerDragOffset

cornerDragOffset: [number, number, number] = null

3D offset vector for corner sphere dragging [dx, dy, dz]

Defined in

tools/src/tools/VolumeCroppingTool.ts:200


draggingSphereIndex

draggingSphereIndex: number = null

Index of currently dragged sphere, null when not dragging

Defined in

tools/src/tools/VolumeCroppingTool.ts:198


edgeLines

edgeLines: object = {}

Dictionary of edge line actors connecting corner spheres for wireframe visualization

Index Signature

[uid: string]: object

Defined in

tools/src/tools/VolumeCroppingTool.ts:219


faceDragOffset

faceDragOffset: number = null

1D offset value for face sphere dragging along single axis

Defined in

tools/src/tools/VolumeCroppingTool.ts:201


isPrimary

isPrimary: boolean = false

Primary tool - this is set to true when this tool is primary

Inherited from

BaseTool.isPrimary

Defined in

tools/src/tools/base/BaseTool.ts:57


memo

protected memo: Memo

A memo recording the starting state of a tool. This will be updated as changes are made, and reflects the fact that a memo has been created.

Inherited from

BaseTool.memo

Defined in

tools/src/tools/base/BaseTool.ts:63


mode

mode: ToolModes

Tool Mode - Active/Passive/Enabled/Disabled/

Inherited from

BaseTool.mode

Defined in

tools/src/tools/base/BaseTool.ts:55


mouseDragCallback()

mouseDragCallback: (evt) => void

Mouse drag event handler for desktop interactions

Parameters

evt: InteractionEventType

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:192


originalClippingPlanes

originalClippingPlanes: ClippingPlane[] = []

Array of clipping plane objects with origin and normal vectors

Defined in

tools/src/tools/VolumeCroppingTool.ts:197


rotatePlanesOnDrag

rotatePlanesOnDrag: boolean = false

If true, dragging rotates clipping planes instead of camera (default: false)

Defined in

tools/src/tools/VolumeCroppingTool.ts:199


seriesInstanceUID?

optional seriesInstanceUID: string

Frame of reference for the tool

Defined in

tools/src/tools/VolumeCroppingTool.ts:190


sphereStates

sphereStates: object[] = []

Array of sphere state objects containing position, VTK actors, and metadata

Defined in

tools/src/tools/VolumeCroppingTool.ts:209


supportedInteractionTypes

supportedInteractionTypes: InteractionTypes[]

Supported Interaction Types - currently only Mouse

Inherited from

BaseTool.supportedInteractionTypes

Defined in

tools/src/tools/base/BaseTool.ts:40


toolGroupId

toolGroupId: string

ToolGroup ID the tool instance belongs to

Inherited from

BaseTool.toolGroupId

Defined in

tools/src/tools/base/BaseTool.ts:53


touchDragCallback()

touchDragCallback: (evt) => void

Touch drag event handler for mobile interactions

Parameters

evt: InteractionEventType

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:191


volumeDirectionVectors

volumeDirectionVectors: object = null

xDir

xDir: Point3

yDir

yDir: Point3

zDir

zDir: Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:203


activeCursorTool

static activeCursorTool: any

Set to the tool that is currently drawing the active cursor. This will be either primary mouse button tool if no tool is currently being directly interacted with, OR the tool that is directly interacted with. This logic ensures that there is only a single tool at a time drawing, which prevents tools not getting mouse updates from over-writing the cursor.

  • If the tool bound to the primary button is a cursor drawing tool, use that tool and there is NOT a tool currently drawing directly
  • If there is a tool currently drawing directly, then that tool should display a cursor EVEN if it normally doesn't have a custom cursor
  • When a tool finishes drawing direct, it should stop being the active cursor tool unless it is also the primary tool

Inherited from

BaseTool.activeCursorTool

Defined in

tools/src/tools/base/BaseTool.ts:37


defaults

static defaults: object

Has the defaults associated with the base tool.

configuration

configuration: object

configuration.activeStrategy

activeStrategy: any = undefined

configuration.defaultStrategy

defaultStrategy: any = undefined

configuration.strategies

strategies: object = {}

configuration.strategyOptions

strategyOptions: object = {}

Inherited from

BaseTool.defaults

Defined in

tools/src/tools/base/BaseTool.ts:68


toolName

static toolName: any

Static tool identifier: 'VolumeCropping'

Overrides

BaseTool.toolName

Defined in

tools/src/tools/VolumeCroppingTool.ts:189

Accessors

configurationTyped

get configurationTyped(): ToolConfiguration

Returns

ToolConfiguration

Inherited from

BaseTool.configurationTyped

Defined in

tools/src/tools/base/BaseTool.ts:48


toolName

get toolName(): string

Newer method for getting the tool name as a property

Returns

string

Inherited from

BaseTool.toolName

Defined in

tools/src/tools/base/BaseTool.ts:138

Methods

_addSphere()

_addSphere(viewport, point, axis, position, cornerKey, adaptiveRadius): void

Parameters

viewport: VolumeViewport

point: Point3

axis: string

position: string

cornerKey: string = null

adaptiveRadius: number

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1000


_applyClippingPlanesToMapper()

_applyClippingPlanesToMapper(mapper): void

Parameters

mapper: vtkVolumeMapper

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1347


_averagePoints()

_averagePoints(points): Point3

Parameters

points: Point3[]

Returns

Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:2045


_calculateCornerFromFaces()

_calculateCornerFromFaces(faceX, faceY, faceZ, xDir, yDir, zDir): Point3

Parameters

faceX: Point3

faceY: Point3

faceZ: Point3

xDir: Point3

yDir: Point3

zDir: Point3

Returns

Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:2076


_calculateCornerFromProjection()

_calculateCornerFromProjection(faceX, faceY, faceZ, xDir, yDir, zDir): Point3

Parameters

faceX: Point3

faceY: Point3

faceZ: Point3

xDir: Point3

yDir: Point3

zDir: Point3

Returns

Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:2107


_dragCallback()

_dragCallback(evt): void

Parameters

evt: InteractionEventType

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:675


_getDirectionVectorForAxis()

_getDirectionVectorForAxis(axis): Point3

Get the direction vector for a given axis ('x', 'y', or 'z').

Parameters

axis: string

The axis identifier

Returns

Point3

The direction vector in world space

Defined in

tools/src/tools/VolumeCroppingTool.ts:1061


_getDirectionVectors()

_getDirectionVectors(): object

Returns

object

xDir

xDir: Point3

yDir

yDir: Point3

zDir

zDir: Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:1997


_getViewport()

_getViewport(): VolumeViewport

Returns

VolumeViewport

Defined in

tools/src/tools/VolumeCroppingTool.ts:1322


_getViewportAndWorldCoords()

_getViewportAndWorldCoords(evt): object

Parameters

evt: any

Returns

object

viewport

viewport: VolumeViewport

world

world: Point3

Defined in

tools/src/tools/VolumeCroppingTool.ts:1313


_getViewportsInfo()

_getViewportsInfo(): any[]

Returns

any[]

Defined in

tools/src/tools/VolumeCroppingTool.ts:995


_getVolumeActor()

_getVolumeActor(viewport?): vtkVolume

Parameters

viewport?: VolumeViewport

Returns

vtkVolume

Defined in

tools/src/tools/VolumeCroppingTool.ts:1333


_getVolumeMapper()

_getVolumeMapper(viewport?): vtkVolumeMapper

Parameters

viewport?: VolumeViewport

Returns

vtkVolumeMapper

Defined in

tools/src/tools/VolumeCroppingTool.ts:1340


_initialize3DViewports()

_initialize3DViewports(viewportsInfo): void

Parameters

viewportsInfo: IViewportId[]

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1105


_notifyClippingPlanesChanged()

_notifyClippingPlanesChanged(viewport?): void

Parameters

viewport?: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:2057


_onControlToolChange()

_onControlToolChange(evt): void

Parameters

evt: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:891


_onMouseMoveSphere()

_onMouseMoveSphere(evt): boolean

Parameters

evt: any

Returns

boolean

Defined in

tools/src/tools/VolumeCroppingTool.ts:758


_onNewVolume()

_onNewVolume(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1675


_rotateCamera()

_rotateCamera(viewport, centerWorld, axis, angle): void

Parameters

viewport: any

centerWorld: any

axis: any

angle: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:2140


_rotateClippingPlanes()

_rotateClippingPlanes(evt): void

Parameters

evt: InteractionEventType

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1713


_subscribeToViewportNewVolumeSet()

_subscribeToViewportNewVolumeSet(viewports): void

Parameters

viewports: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1698


_unsubscribeToViewportNewVolumeSet()

_unsubscribeToViewportNewVolumeSet(viewportsInfo): void

Parameters

viewportsInfo: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1683


_updateClippingPlanes()

_updateClippingPlanes(viewport): void

Parameters

viewport: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:922


_updateClippingPlanesFromFaceSpheres()

_updateClippingPlanesFromFaceSpheres(viewport): void

Parameters

viewport: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1366


_updateCornerSpheres()

_updateCornerSpheres(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1561


_updateCornerSpheresFromFaces()

_updateCornerSpheresFromFaces(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1391


_updateEdgeLines()

_updateEdgeLines(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:2126


_updateFaceSpheresFromClippingPlanes()

_updateFaceSpheresFromClippingPlanes(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:2027


_updateFaceSpheresFromCorners()

_updateFaceSpheresFromCorners(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:1502


_updateHandlesVisibility()

_updateHandlesVisibility(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:979


_updateSpherePosition()

_updateSpherePosition(sphereIndex, newPoint): void

Parameters

sphereIndex: number

newPoint: Point3

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:2018


applyActiveStrategy()

applyActiveStrategy(enabledElement, operationData): any

Applies the active strategy function to the enabled element with the specified operation data.

Parameters

enabledElement: IEnabledElement

The element that is being operated on.

operationData: unknown

The data that needs to be passed to the strategy.

Returns

any

The result of the strategy.

Inherited from

BaseTool.applyActiveStrategy

Defined in

tools/src/tools/base/BaseTool.ts:158


applyActiveStrategyCallback()

applyActiveStrategyCallback(enabledElement, operationData, callbackType, ...extraArgs): any

Applies the active strategy, with a given event type being applied. The event type function is found by indexing it on the active strategy function.

Parameters

enabledElement: IEnabledElement

The element that is being operated on.

operationData: unknown

The data that needs to be passed to the strategy.

callbackType: string

the type of the callback

• ...extraArgs: any[]

Returns

any

The result of the strategy.

Inherited from

BaseTool.applyActiveStrategyCallback

Defined in

tools/src/tools/base/BaseTool.ts:182


doneEditMemo()

doneEditMemo(): void

This clears and edit memo storage to allow for further history functions to be called. Calls the complete function if present, and pushes the memo to the history memo stack.

This should be called when a tool has finished making a change which should be separated from future/other changes in terms of the history. Usually that means on endCallback (mouse up), but some tools also make changes on the initial creation of an object or have alternate flows and the doneEditMemo has to be called on mouse down or other initiation events to ensure that new changes are correctly recorded.

If the tool has no end callback, then the doneEditMemo is called from the pre mouse down callback. See ZoomTool for an example of this usage.

Returns

void

Inherited from

BaseTool.doneEditMemo

Defined in

tools/src/tools/base/BaseTool.ts:379


getClippingPlanesVisible()

getClippingPlanesVisible(): any

Gets the current visibility state of the clipping planes.

Returns

any

Whether the clipping planes are currently visible and actively cropping the volume

Example

// Check if clipping planes are currently active
const planesVisible = volumeCroppingTool.getClippingPlanesVisible();
if (planesVisible) {
console.log('Volume is currently being cropped');
} else {
console.log('Volume is displayed in full');
}

Remarks

This method returns the configuration state that controls whether:

  • The volume rendering respects the current clipping plane boundaries
  • Parts of the volume outside the crop bounds are hidden from view
  • The cropping effect is applied to the 3D volume visualization

Defined in

tools/src/tools/VolumeCroppingTool.ts:576


getHandlesVisible()

getHandlesVisible(): any

Gets the current visibility state of the cropping handles.

Returns

any

Whether the cropping handles (spheres and edge lines) are currently visible

Example

// Check if handles are currently visible
const handlesVisible = volumeCroppingTool.getHandlesVisible();
if (handlesVisible) {
console.log('Cropping handles are currently shown');
} else {
console.log('Cropping handles are currently hidden');
}

Remarks

This method returns the configuration state, which controls the visibility of:

  • Face spheres (6 spheres for individual axis cropping)
  • Corner spheres (8 spheres for multi-axis cropping)
  • Edge lines connecting the corner spheres

Defined in

tools/src/tools/VolumeCroppingTool.ts:550


getRotatePlanesOnDrag()

getRotatePlanesOnDrag(): boolean

Gets whether dragging rotates clipping planes instead of the camera.

Returns

boolean

True if dragging rotates clipping planes, false if it rotates the camera

Example

const isRotatingPlanes = volumeCroppingTool.getRotatePlanesOnDrag();
if (isRotatingPlanes) {
console.log('Dragging will rotate clipping planes');
} else {
console.log('Dragging will rotate camera');
}

Defined in

tools/src/tools/VolumeCroppingTool.ts:641


getTargetId()

protected getTargetId(viewport, data?): string

Get the target Id for the viewport which will be used to store the cached statistics scoped to that target in the annotations. For StackViewport, targetId is usually derived from the imageId. For VolumeViewport, it's derived from the volumeId. This method allows prioritizing a specific volumeId from the tool's configuration if available in the cachedStats.

Parameters

viewport: Viewport

viewport to get the targetId for

data?

Optional: The annotation's data object, containing cachedStats.

data.cachedStats?: Record<string, unknown>

Returns

string

targetId

Inherited from

BaseTool.getTargetId

Defined in

tools/src/tools/base/BaseTool.ts:296


getTargetImageData()

protected getTargetImageData(targetId): IImageData | CPUIImageData

Get the image that is displayed for the targetId in the cachedStats which can be

  • imageId:<imageId>
  • volumeId:<volumeId>
  • videoId:<basePathForVideo>/frames/<frameSpecifier>

Parameters

targetId: string

annotation targetId stored in the cached stats

Returns

IImageData | CPUIImageData

The image data for the target.

Inherited from

BaseTool.getTargetImageData

Defined in

tools/src/tools/base/BaseTool.ts:237


getToolName()

getToolName(): string

Returns the name of the tool

Returns

string

The name of the tool.

Inherited from

BaseTool.getToolName

Defined in

tools/src/tools/base/BaseTool.ts:146


onCameraModified()

onCameraModified(evt): void

Parameters

evt: any

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:371


onSetToolActive()

onSetToolActive(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:259


onSetToolConfiguration()

onSetToolConfiguration(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:344


onSetToolDisabled()

onSetToolDisabled(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:352


onSetToolEnabled()

onSetToolEnabled(): void

Returns

void

Defined in

tools/src/tools/VolumeCroppingTool.ts:348


preMouseDownCallback()

preMouseDownCallback(evt): boolean

Parameters

evt: InteractionEventType

Returns

boolean

Defined in

tools/src/tools/VolumeCroppingTool.ts:380


redo()

redo(): void

Redo an action (undo the undo)

Returns

void

Inherited from

BaseTool.redo

Defined in

tools/src/tools/base/BaseTool.ts:335


setActiveStrategy()

setActiveStrategy(strategyName): void

Sets the active strategy for a tool. Strategies are multiple implementations of tool behavior that can be switched by tool configuration.

Parameters

strategyName: string

name of the strategy to be set as active

Returns

void

Inherited from

BaseTool.setActiveStrategy

Defined in

tools/src/tools/base/BaseTool.ts:223


setClippingPlanesVisible()

setClippingPlanesVisible(visible): void

Sets the visibility of the clipping planes to enable or disable volume cropping.

When clipping planes are visible, the volume rendering is cropped according to the current sphere positions. When disabled, the full volume is displayed without cropping. The viewport is automatically re-rendered after the change.

Parameters

visible: boolean

Whether to enable (true) or disable (false) volume clipping

Returns

void

Example

// Enable volume cropping
volumeCroppingTool.setClippingPlanesVisible(true);

// Disable volume cropping to show full volume
volumeCroppingTool.setClippingPlanesVisible(false);

Remarks

  • When enabled, parts of the volume outside the crop bounds are hidden
  • When disabled, all clipping planes are removed from the volume mapper
  • The cropping bounds are determined by the current sphere positions
  • The viewport is automatically re-rendered to reflect the change
  • This method updates the internal configuration and applies changes immediately

Defined in

tools/src/tools/VolumeCroppingTool.ts:605


setConfiguration()

setConfiguration(newConfiguration): void

merges the new configuration with the tool configuration

Parameters

newConfiguration: Record<string, any>

Returns

void

Inherited from

BaseTool.setConfiguration

Defined in

tools/src/tools/base/BaseTool.ts:209


setHandlesVisible()

setHandlesVisible(visible): void

Sets the visibility of the cropping handles (spheres and edge lines).

When handles are being shown, this method automatically synchronizes the sphere positions with the current clipping plane positions to ensure visual consistency. This includes updating face spheres, corner spheres, and edge lines to match the current crop bounds.

Parameters

visible: boolean

Whether to show or hide the cropping handles

Returns

void

Example

// Hide all cropping handles
volumeCroppingTool.setHandlesVisible(false);

// Show handles and sync with current crop state
volumeCroppingTool.setHandlesVisible(true);

Defined in

tools/src/tools/VolumeCroppingTool.ts:512


setRotatePlanesOnDrag()

setRotatePlanesOnDrag(enable): void

Sets whether dragging should rotate clipping planes instead of the camera.

When enabled, dragging the mouse will rotate the clipping planes around the volume. When disabled, dragging will rotate the camera view (default behavior).

Parameters

enable: boolean

Whether to enable (true) or disable (false) rotating planes on drag

Returns

void

Example

// Enable rotating clipping planes on drag
volumeCroppingTool.setRotatePlanesOnDrag(true);

// Disable to use default camera rotation
volumeCroppingTool.setRotatePlanesOnDrag(false);

Remarks

  • Default is false (camera rotation)
  • When enabled, the clipping planes rotate around the volume center
  • The rotation increment is controlled by rotateClippingPlanesIncrementDegrees configuration

Defined in

tools/src/tools/VolumeCroppingTool.ts:667


undo()

undo(): void

Undoes an action

Returns

void

Inherited from

BaseTool.undo

Defined in

tools/src/tools/base/BaseTool.ts:325


calculateLengthInIndex()

static calculateLengthInIndex(calibrate, indexPoints, closed): number

Calculates the length between two index coordinates using the calibrate information for scaling information.

Parameters

calibrate: any

indexPoints: any

closed: boolean = false

set to true to calculate the closed length, including the line between the first/last index

Returns

number

Inherited from

BaseTool.calculateLengthInIndex

Defined in

tools/src/tools/base/BaseTool.ts:402


createZoomPanMemo()

static createZoomPanMemo(viewport): object

Creates a zoom/pan memo that remembers the original zoom/pan position for the given viewport.

Parameters

viewport: any

Returns

object

restoreMemo()

restoreMemo: () => void

Returns

void

Inherited from

BaseTool.createZoomPanMemo

Defined in

tools/src/tools/base/BaseTool.ts:343


endGroupRecording()

static endGroupRecording(): void

Ends a group recording of history memo

Returns

void

Inherited from

BaseTool.endGroupRecording

Defined in

tools/src/tools/base/BaseTool.ts:392


isInsideVolume()

static isInsideVolume(dimensions, indexPoints): boolean

Return true if all the index points are within the dimensions provided.

Parameters

dimensions: any

indexPoints: any

Returns

boolean

Inherited from

BaseTool.isInsideVolume

Defined in

tools/src/tools/base/BaseTool.ts:424


isSpecifiedTargetId()

static isSpecifiedTargetId(desiredVolumeId): (_viewport, __namedParameters) => any

A function generator to test if the target id is the desired one. Used for deciding which set of cached stats is appropriate to display for a given viewport.

This relies on the fact that the target id contains a substring which is the desired volume id when the target is a volume. It is also possible to use series query parameters such as /series/{seriesUID}/ to generate specific series selections within a stack viewport.

Parameters

desiredVolumeId: string

Returns

Function

Parameters

_viewport: any

__namedParameters

__namedParameters.targetId: any

Returns

any

Inherited from

BaseTool.isSpecifiedTargetId

Defined in

tools/src/tools/base/BaseTool.ts:124


mergeDefaultProps()

static mergeDefaultProps(defaultProps, additionalProps?): any

Does a deep merge of property options. Allows extending the default values for a child class.

Parameters

defaultProps = {}

this is a base set of defaults to merge into

additionalProps?: any

the additional properties to merge into the default props

Returns

any

defaultProps if additional props not defined, or a merge into a new object containing additionalProps adding onto and overriding defaultProps.

Inherited from

BaseTool.mergeDefaultProps

Defined in

tools/src/tools/base/BaseTool.ts:107


startGroupRecording()

static startGroupRecording(): void

Starts a group recording of history memo, so that with a single undo you can undo multiple actions that are related to each other

Returns

void

Inherited from

BaseTool.startGroupRecording

Defined in

tools/src/tools/base/BaseTool.ts:387