Larvitar Documentation
Home
Guide
API
GitHub
Home
Guide
API
GitHub
  • API

    • Initializing
    • Parsing
    • Loading
    • Rendering
    • Interacting
    • Testing
    • Modules

      • Logger
      • Store
      • Managers

        • Image Manager
        • GSPS Manager
        • File Manager
      • Parsers

        • PDF Parser
        • NRRD Parser
        • ECG Parser
      • Loaders
        • DICOM Loader
        • MultiFrame Loader
        • SingleFrame Loader
        • DSA Image Loader
        • File Loader
        • Nrrd Loader
      • Interaction Tools

        • Initialize and manage Tools
        • Default and Custom Tools
        • Segmentation Tools
        • DvTools
      • Utilities

        • DICOM Anonymization
        • DICOM Customization
        • Tags
        • Utils
        • Memory
      • Post Processing

        • DSA
      • Visualizations

        • Layers
        • ECG
        • Color Maps
        • Greyscale Presentation States
      • Testing
Larvitar

Digital Subtraction Algorithm (DSA)

The Digital Subtraction Algorithm (DSA) is used in X-ray angiography (XA) to subtract a reference mask (e.g., pre-contrast image) from a contrast image to highlight the contrast agent (e.g., for vascular visualization). The DSA operation enhances the image for better analysis by removing the background.

This module implements various subtraction methods as per the DICOM standard for XA images.

DSA Methods Supported

The following DSA mask operations are supported:

  • AVG_SUB: Average Subtraction
  • TID: Time Interval Differencing
  • REV_TID: Reverse Time Interval Differencing

Related DICOM Tags

  • x00286101 - DSA Mask Operation: Specifies the mask operation to be performed (AVG_SUB, TID, REV_TID)
  • x00286110 - Frame Numbers: Specifies the frame numbers used for mask operations.
  • x00286114 - Mask Sub-pixel Shift: Specifies any fractional pixel shifts that need to be applied during mask subtraction (vertical and horizontal).
  • x00286112 - Contrast Frame Averaging: Specifies the number of contrast frames to average together before applying the subtraction.
  • x00286102 - Frame Range for Mask Operation: Defines the range of frames over which the mask operation is valid.

See Standard Dicom DSA

API Reference

applyDSA

This function checks the metadata (0028,6101) to determine the type of DSA mask operation to apply (e.g., AVG_SUB, TID, REV_TID).

Syntax

applyDSA(
  multiframeSerie: Series,
  index: number,
  inputMaskSubPixelShift: number[] //pixel shift applied to the mask
): number[]

Parameters

ParameterTypeDescription
multiFrameSerieSeriesmultiframe serie to apply DSA
indexnumberindex of the frame to apply DSA
inputMaskSubPixelShiftnumber[]pixel shift applied to the mask

Returns

number[] – Pixel data of the frame after DSA.

applyDSAShift

Applies DSA with pixel shift and updates the image to reflect the changes.

Syntax

applyDSAShift(
  elementId: string,
  multiFrameSerie: Series,
  frameId: number,
  inputMaskSubPixelShift: number[] //pixel shift applied to the mask
): void

Parameters

ParameterTypeDescription
elementIdstringelementId of the viewer
multiFrameSerieSeriesmultiframe serie to apply DSA
frameIdnumberindex of the frame to apply DSA
inputMaskSubPixelShiftnumber[]pixel shift applied to the mask

Returns

void – Triggers updateImage and redrawImage

Internal Functions

avgSubMask

Applies an average subtraction mask to the contrast frame using the specified metadata.

tidMask

Applies Time Interval Differencing (TID) to subtract a reference mask frame based on the TID offset to the current contrast frame.

revTidMask

Applies a reverse Time Interval Differencing (revTID) to subtract multiple contrast frames from the reference frame. Similar to tidMask, but the subtraction is applied across multiple frames, with the frame difference increasing for each subsequent frame. Handles pixel-wise subtraction in reverse order


D/Vision Lab
Last Updated:
Contributors: Laura Borghesi, Simone "Lateralus" Manini