Skip to main content

segmentation

Index

Namespaces

activeSegmentation

activeSegmentation:

getActiveSegmentationRepresentation

  • Get the active segmentation representation for the tool group with the given toolGroupId.


    Parameters

    • toolGroupId: string

      The Id of the tool group

    Returns ToolGroupSpecificRepresentation

    The active segmentation representation for the tool group.

setActiveSegmentationRepresentation

  • setActiveSegmentationRepresentation(toolGroupId: string, segmentationRepresentationUID: string): void
  • 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

config:

color

color:

addColorLUT

  • addColorLUT(colorLUT: ColorLUT, colorLUTIndex: number): void
  • 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

  • getColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): Color
  • 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.

setColorLUT

  • setColorLUT(toolGroupId: string, segmentationRepresentationUID: string, colorLUTIndex: number): void
  • 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

visibility:

getSegmentationVisibility

  • getSegmentationVisibility(toolGroupId: string, segmentationRepresentationUID: string): boolean | undefined
  • 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

setSegmentationVisibility

  • setSegmentationVisibility(toolGroupId: string, segmentationRepresentationUID: string, visibility: boolean): void
  • Set the visibility of a segmentation representation for a given tool group. It fires a SEGMENTATION_REPRESENTATION_MODIFIED event.

    @triggers

    SEGMENTATION_REPRESENTATION_MODIFIED


    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

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: Labelmap

      The type of representation to query

    Returns RepresentationConfig[LABELMAP]

    A representation configuration object.

getToolGroupSpecificConfig

  • Get the toolGroup specific segmentation config


    Parameters

    • toolGroupId: string

      The Id of the tool group

    Returns SegmentationRepresentationConfig

    A SegmentationConfig object.

setGlobalConfig

setGlobalRepresentationConfig

  • setGlobalRepresentationConfig(representationType: Labelmap, config: LabelmapConfig): void
  • Set the global configuration for a given representation type. It fires a SEGMENTATION_MODIFIED event.

    @triggers

    SEGMENTATION_MODIFIED


    Parameters

    • representationType: Labelmap

      The type of representation to set config for

    • config: LabelmapConfig

      The configuration for the representation.

    Returns void

setToolGroupSpecificConfig

segmentIndex

segmentIndex:

getActiveSegmentIndex

  • getActiveSegmentIndex(segmentationId: string): number | undefined
  • 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

  • setActiveSegmentIndex(segmentationId: string, segmentIndex: number): void
  • Set the active segment index for a segmentation Id. It fires a global state modified event.

    @triggers

    SEGMENTATION_MODIFIED


    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

segmentLocking:

getLockedSegments

  • getLockedSegments(segmentationId: string): number[] | []
  • 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

  • isSegmentIndexLocked(segmentationId: string, segmentIndex: number): boolean
  • 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

  • setSegmentIndexLocked(segmentationId: string, segmentIndex: number, locked?: boolean): void
  • 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

state:

addColorLUT

  • addColorLUT(colorLUT: ColorLUT, index: number): void
  • 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

  • addSegmentation(segmentationInput: SegmentationPublicInput, suppressEvents?: boolean): void
  • 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.

    @triggers

    SEGMENTATION_REPRESENTATION_MODIFIED


    Parameters

    Returns void

getColorLUT

  • getColorLUT(index: number): ColorLUT | undefined
  • 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

  • getDefaultSegmentationStateManager(): default
  • 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.

getSegmentation

  • getSegmentation(segmentationId: string): Segmentation | undefined
  • 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.

getSegmentationRepresentations

  • getSegmentationRepresentations(toolGroupId: string): ToolGroupSpecificRepresentations | []
  • 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

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.

getToolGroupsWithSegmentation

  • getToolGroupsWithSegmentation(segmentationId: string): string[]
  • 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.

removeSegmentation

  • removeSegmentation(segmentationId: string): void
  • It removes the segmentation from the segmentation state manager

    @triggers

    SEGMENTATION_REMOVED


    Parameters

    • segmentationId: string

      The id of the segmentation

    Returns void

removeSegmentationRepresentation

  • removeSegmentationRepresentation(toolGroupId: string, segmentationRepresentationUID: string): void
  • Remove a segmentation representation from the segmentation state manager for a toolGroup. It fires SEGMENTATION_REPRESENTATION_MODIFIED event.

    @triggers

    SEGMENTATION_REPRESENTATION_REMOVED


    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.

    @triggers

    SEGMENTATION_MODIFIED


    Parameters

    • config: SegmentationRepresentationConfig

      The new global segmentation config.

    • optionalsuppressEvents: boolean

      If true, the segmentationGlobalStateModified event will not be triggered.

    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.

    @triggers

    SEGMENTATION_REPRESENTATION_MODIFIED


    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

triggerSegmentationEvents:

triggerSegmentationDataModified

  • triggerSegmentationDataModified(segmentationId: string, modifiedSlicesToUse?: number[]): void
  • Trigger an event that a segmentation data has been modified


    Parameters

    • segmentationId: string

      The Id of segmentation

    • optionalmodifiedSlicesToUse: number[]

    Returns void

triggerSegmentationModified

  • triggerSegmentationModified(segmentationId?: string): void
  • 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

  • triggerSegmentationRemoved(segmentationId: string): void
  • Trigger an event that a segmentation is removed


    Parameters

    • segmentationId: string

      The Id of segmentation

    Returns void

triggerSegmentationRepresentationModified

  • triggerSegmentationRepresentationModified(toolGroupId: string, segmentationRepresentationUID?: string): void
  • 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

  • triggerSegmentationRepresentationRemoved(toolGroupId: string, segmentationRepresentationUID: string): void
  • 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

  • addSegmentations(segmentationInputArray: SegmentationPublicInput[]): void
  • 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

  • removeSegmentationsFromToolGroup(toolGroupId: string, segmentationRepresentationUIDs?: string[]): void
  • 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.

    Returns void