segmentation
Index
Namespaces
activeSegmentation
getActiveSegmentationRepresentation
Parameters
toolGroupId: string
The Id of the tool group
Returns ToolGroupSpecificRepresentation
The active segmentation representation for the tool group.
setActiveSegmentationRepresentation
Set the active segmentation for the given tool group for all its viewports
Parameters
toolGroupId: string
The Id of the tool group to set the active segmentation for.
segmentationRepresentationUID: string
The id of the segmentation representation to set as active.
Returns void
config
color
addColorLUT
addColorLUT - Adds a new color LUT to the state at the given colorLUTIndex. If no colorLUT is provided, a new color LUT is generated.
Parameters
colorLUT: ColorLUT
An array of The colorLUT to set.
colorLUTIndex: number
the index of the colorLUT in the state
Returns void
getColorForSegmentIndex
Given a tool group UID, a segmentation representationUID, and a segment index, return the color for that segment. It can be used for segmentation tools that need to display the color of their annotation.
Parameters
toolGroupId: string
The Id of the tool group that owns the segmentation representation.
segmentationRepresentationUID: string
The uid of the segmentation representation
segmentIndex: number
The index of the segment in the segmentation
Returns Color
A color.
setColorForSegmentIndex
Parameters
toolGroupId: string
segmentationRepresentationUID: string
segmentIndex: number
color: Color
Returns void
setColorLUT
It sets the toolGroup’s segmentationRepresentation to use the provided colorLUT at the given colorLUTIndex.
Parameters
toolGroupId: string
the id of the toolGroup that renders the representation
segmentationRepresentationUID: string
the representationUID for the segmentation
colorLUTIndex: number
the index of the colorLUT to use
Returns void
visibility
getSegmentationVisibility
Get the visibility of a segmentation data for a given tool group.
Parameters
toolGroupId: string
The Id of the tool group that the segmentation data belongs to.
segmentationRepresentationUID: string
The id of the segmentation data to get
Returns boolean | undefined
A boolean value that indicates whether the segmentation data is visible or not on the toolGroup
setSegmentVisibility
Parameters
toolGroupId: string
segmentationRepresentationUID: string
segmentIndex: number
visibility: boolean
Returns void
setSegmentationVisibility
Set the visibility of a segmentation representation for a given tool group. It fires a SEGMENTATION_REPRESENTATION_MODIFIED event. Visibility true will show all segments and visibility false will hide all segments”
Parameters
toolGroupId: string
The Id of the tool group that contains the segmentation.
segmentationRepresentationUID: string
The id of the segmentation representation to modify its visibility.
visibility: boolean
boolean
Returns void
setSegmentsVisibility
Set the visibility of the given segment indices to the given visibility. This is a helper to set the visibility of multiple segments at once and reduces the number of events fired.
Parameters
toolGroupId: string
The tool group id of the segmentation representation.
segmentationRepresentationUID: string
The UID of the segmentation representation.
segmentIndices: number[]
The indices of the segments to be hidden/shown.
visibility: boolean
The visibility to set the segments to.
Returns void
getGlobalConfig
It returns the global segmentation config.
Returns SegmentationRepresentationConfig
The global segmentation config containing the representations config for each representation type and renderInactiveSegmentations flag.
getGlobalRepresentationConfig
Given a representation type, return the corresponding global representation config
Parameters
representationType: SegmentationRepresentations
The type of representation to query
Returns RepresentationConfig[LABELMAP]
A representation configuration object.
getSegmentSpecificConfig
Get the segment specific configuration for the segmentation representation.
Parameters
toolGroupId: string
The tool group id where the segmentation representation belongs to.
segmentationRepresentationUID: string
The uid of the segmentation representation
segmentIndex: number
The index of the segment
Returns RepresentationConfig
- The configuration for the segment index in the segmentation representation that is shown in the toolGroup’s viewport
getSegmentationRepresentationSpecificConfig
Give the segmentation representation UID, return the corresponding config which is shared by all segments in the segmentation representation. This is an optional level of configuration that can be set by the user, by default it will fallback to the toolGroup specific config, if not set, it will fallback to the global config.
Parameters
toolGroupId: string
segmentationRepresentationUID: string
The uid of the segmentation representation
Returns RepresentationConfig
- The configuration for the representation.
getToolGroupSpecificConfig
Get the toolGroup specific segmentation config
Parameters
toolGroupId: string
The Id of the tool group
Returns SegmentationRepresentationConfig
A SegmentationConfig object.
setGlobalConfig
Set the global segmentation config
Parameters
segmentationConfig: SegmentationRepresentationConfig
SegmentationConfig
Returns void
setGlobalRepresentationConfig
Set the global configuration for a given representation type. It fires a SEGMENTATION_MODIFIED event.
Parameters
representationType: SegmentationRepresentations
The type of representation to set config for
config: LabelmapConfig
The configuration for the representation.
Returns void
setSegmentSpecificConfig
Set the segment specific configuration for the segmentation representation. This configuration, if specified, has higher priority than the segmentation representation specific config, and the toolGroup specific config. The order of priority is: segment specific config > segmentation representation specific config > toolGroup specific config > global config
Parameters
toolGroupId: string
The tool group id where the segmentation representation belongs to.
segmentationRepresentationUID: string
The uid of the segmentation representation
config: SegmentSpecificRepresentationConfig
The configuration for the representation. This is an object
Returns void
setSegmentationRepresentationSpecificConfig
Set the segmentation representation specific configuration for the segmentation representation. This will apply to all segments in the segmentation representation and has higher priority than the toolGroup specific config.
Parameters
toolGroupId: string
segmentationRepresentationUID: string
The uid of the segmentation representation
config: RepresentationConfig
The configuration for the representation. This is an object only containing the representation type as key and the config as value.
Returns void
setToolGroupSpecificConfig
Sets the tool group specific configuration for the segmentation representation. This will apply to all segmentation representations.
Parameters
toolGroupId: string
The tool group id where the segmentation representation belongs to.
segmentationRepresentationConfig: SegmentationRepresentationConfig
This is the configuration object that you will use to set the default values for the segmentation representation.
Returns void
segmentIndex
getActiveSegmentIndex
Get the active segment index for a segmentation in the global state
Parameters
segmentationId: string
The id of the segmentation to get the active segment index from.
Returns number | undefined
The active segment index for the given segmentation.
setActiveSegmentIndex
Set the active segment index for a segmentation Id. It fires a global state modified event.
Parameters
segmentationId: string
The id of the segmentation that the segment belongs to.
segmentIndex: number
The index of the segment to be activated.
Returns void
segmentLocking
getLockedSegments
Get the locked segments for a segmentation
Parameters
segmentationId: string
The id of the segmentation to get locked segments for.
Returns number[] | []
An array of locked segment indices.
isSegmentIndexLocked
Get the locked status for a segment index in a segmentation
Parameters
segmentationId: string
The id of the segmentation that the segment belongs to.
segmentIndex: number
The index of the segment
Returns boolean
A boolean value indicating whether the segment is locked or not.
setSegmentIndexLocked
Set the locked status of a segment index in a segmentation
Parameters
segmentationId: string
The id of the segmentation whose segment index is being modified.
segmentIndex: number
The index of the segment to lock/unlock.
locked: boolean = true
Returns void
state
addColorLUT
Add a color LUT to the segmentation state manager
Parameters
colorLUT: ColorLUT
The color LUT array to add.
index: number
The index of the color LUT to add.
Returns void
addSegmentation
It takes a segmentation input and adds it to the segmentation state manager
Parameters
segmentationInput: SegmentationPublicInput
The segmentation to add.
optionalsuppressEvents: boolean
If true, the event will not be triggered.
Returns void
addSegmentationRepresentation
Add the given segmentation representation data to the given tool group state. It fires SEGMENTATION_REPRESENTATION_MODIFIED event if not suppressed.
Parameters
toolGroupId: string
The Id of the tool group that the segmentation representation is for.
segmentationRepresentation: ToolGroupSpecificRepresentation
optionalsuppressEvents: boolean
boolean
Returns void
getColorLUT
Get the color lut for a given index
Parameters
index: number
The index of the color lut to retrieve.
Returns ColorLUT | undefined
A ColorLUT array.
getDefaultSegmentationStateManager
It returns the defaultSegmentationStateManager.
Returns default
getGlobalConfig
It returns the global segmentation config. Note that the toolGroup-specific configuration has higher priority than the global configuration and overwrites the global configuration for each representation.
Returns SegmentationRepresentationConfig
The global segmentation configuration for all segmentations.
getSegmentSpecificRepresentationConfig
Parameters
toolGroupId: string
segmentationRepresentationUID: string
segmentIndex: number
Returns RepresentationConfig
getSegmentation
Get the segmentation for the given segmentationId
Parameters
segmentationId: string
The Id of the segmentation
Returns Segmentation | undefined
A GlobalSegmentationData object
getSegmentationRepresentationByUID
Get the segmentation data object for a given tool group and segmentation data UID. It searches all the toolGroup specific segmentation data objects and returns the first one that matches the UID.
Parameters
toolGroupId: string
The Id of the tool group that the segmentation data belongs to.
segmentationRepresentationUID: string
The uid of the segmentation representation
Returns ToolGroupSpecificRepresentation | undefined
Segmentation Data object.
getSegmentationRepresentationSpecificConfig
It returns the segmentation representation specific config which is the same for all the segments
Parameters
toolGroupId: string
segmentationRepresentationUID: string
The unique identifier of the segmentation representation.
Returns RepresentationConfig
- The segmentation representation specific config.
getSegmentationRepresentations
Get the segmentation state for a tool group. It will return an array of segmentation representation objects.
Parameters
toolGroupId: string
The unique identifier of the tool group.
Returns ToolGroupSpecificRepresentations | []
An array of segmentation representation objects.
getSegmentations
Get the segmentations inside the state
Returns Segmentation[] | []
Segmentation array
getToolGroupIdsWithSegmentation
Get the tool group IDs that have a segmentation representation with the given segmentationId
Parameters
segmentationId: string
The id of the segmentation
Returns string[]
An array of tool group IDs.
getToolGroupSpecificConfig
Get the segmentation representations config for a given tool group
Parameters
toolGroupId: string
The Id of the tool group that the segmentation config belongs to.
Returns SegmentationRepresentationConfig
A SegmentationConfig object.
removeColorLUT
Add a color LUT to the segmentation state manager
Parameters
colorLUTIndex: number
Returns void
removeSegmentation
It removes the segmentation from the segmentation state manager
Parameters
segmentationId: string
The id of the segmentation
Returns void
removeSegmentationRepresentation
Remove a segmentation representation from the segmentation state manager for a toolGroup. It fires SEGMENTATION_REPRESENTATION_MODIFIED event.
Parameters
toolGroupId: string
The Id of the tool group that the segmentation data belongs to.
segmentationRepresentationUID: string
The uid of the segmentation representation to remove. remove.
Returns void
setGlobalConfig
Set the global segmentation configuration. It fires SEGMENTATION_MODIFIED event if not suppressed.
Parameters
config: SegmentationRepresentationConfig
The new global segmentation config.
optionalsuppressEvents: boolean
If true, the
segmentationGlobalStateModified
event will not be triggered.
Returns void
setSegmentSpecificRepresentationConfig
Parameters
toolGroupId: string
segmentationRepresentationUID: string
config: SegmentSpecificRepresentationConfig
suppressEvents: boolean = false
Returns void
setSegmentationRepresentationSpecificConfig
It sets the segmentation representation specific config for all the segments inside the segmentation.
Parameters
toolGroupId: string
segmentationRepresentationUID: string
The unique identifier of the segmentation representation.
config: RepresentationConfig
The new configuration for the segmentation representation it is an object with keys of different representation types, and values of the configuration for each representation type.
suppressEvents: boolean = false
Returns void
setToolGroupSpecificConfig
Set the segmentation representation config for the provided toolGroup. ToolGroup specific configuration overwrites the global configuration for each representation. It fires SEGMENTATION_REPRESENTATION_MODIFIED event if not suppressed.
Parameters
toolGroupId: string
The Id of the tool group that the segmentation config is being set for.
config: SegmentationRepresentationConfig
The new configuration for the tool group.
optionalsuppressEvents: boolean
If true, the event will not be triggered.
Returns void
triggerSegmentationEvents
triggerSegmentationDataModified
Trigger an event that a segmentation data has been modified
Parameters
segmentationId: string
The Id of segmentation
optionalmodifiedSlicesToUse: number[]
Returns void
triggerSegmentationModified
Triggers segmentation global state updated event, notifying all toolGroups that the global state has been updated, If a segmentationId is provided the event will only be triggered for that segmentation, otherwise it will be triggered for all segmentations.
Parameters
optionalsegmentationId: string
The id of the segmentation that has been updated
Returns void
triggerSegmentationRemoved
Trigger an event that a segmentation is removed
Parameters
segmentationId: string
The Id of segmentation
Returns void
triggerSegmentationRepresentationModified
Trigger an event on the eventTarget that the segmentation representation for toolGroupId has been updated
Parameters
toolGroupId: string
The Id of the toolGroup
optionalsegmentationRepresentationUID: string
Returns void
triggerSegmentationRepresentationRemoved
Trigger an event that a segmentation representation was removed
Parameters
toolGroupId: string
The id of the tool group that the segmentation representation was removed from.
segmentationRepresentationUID: string
The UID of the segmentation representation that was removed.
Returns void
Functions
addSegmentationRepresentations
Set the specified segmentation representations on the viewports of the specified toolGroup. It accepts a second argument which is a toolGroup specific representation configuration.
Parameters
toolGroupId: string
The Id of the toolGroup to add the segmentation representations to
representationInputArray: RepresentationPublicInput[]
An array of segmentation representations to add to the toolGroup
optionaltoolGroupSpecificRepresentationConfig: SegmentationRepresentationConfig
The toolGroup specific configuration for the segmentation representations
Returns Promise<string[]>
addSegmentations
Adds the segmentation to the cornerstone3D segmentation state. It should be noted that segmentations are not added to any toolGroup’s viewports. In order to do so, you should add a “representation” of the segmentation to the toolGroup using addSegmentationRepresentations helper. The reason for this is that there can be multiple representations of the same segmentation (e.g. Labelmap and Contour, etc. - Currently only Labelmap representations is supported).
Parameters
segmentationInputArray: SegmentationPublicInput[]
The array of segmentation input, each of which defining the segmentationId and the main representation data for the segmentation.
Returns void
removeSegmentationsFromToolGroup
Remove the segmentation representation (representation) from the viewports of the toolGroup.
Parameters
toolGroupId: string
The Id of the toolGroup to remove the segmentation from.
optionalsegmentationRepresentationUIDs: string[]
The UIDs of the segmentation representations to remove.
optionalimmediate: boolean
if True the viewport will be re-rendered immediately.
Returns void
Get the active segmentation representation for the tool group with the given toolGroupId.