Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs updated #423

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions imaging/tools/custom/gspsUtils/LUTUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { ImageParameters } from "../../types";
import { setLUT } from "./genericMathUtils";

/**
* Applies the Modality LUT or rescale operation to map stored pixel values
* to meaningful output values using DICOM attributes (x00283000, x00281052, x00281053).
* Handles both LUT Sequence and linear rescale.
* Applies the Modality LUT or rescale operation to map stored pixel values
to meaningful output values using DICOM attributes (x00283000, x00281052, x00281053).
Handles both LUT Sequence and linear rescale.
* @name applyModalityLUT
* @protected
* @param {MetaData} metadata //ps metadata
* @param {ImageParameters} image //image parameters
* @param {Viewport} viewport //viewport data
*
* @returns {void}
*/
export function applyModalityLUT(
metadata: MetaData,
Expand All @@ -33,11 +40,16 @@ export function applyModalityLUT(
}

// SOFTCOPY LUT

/**
* Applies the Softcopy VOI LUT (Window Width and Window Center) to the viewport
* based on the DICOM metadata (attributes: x00281050, x00281051, x00283010).
* Handles both explicit VOI LUT Sequence and window settings.
based on the DICOM metadata (attributes: x00281050, x00281051, x00283010).
Handles both explicit VOI LUT Sequence and window settings.
* @name applySoftcopyLUT
* @protected
* @param {MetaData} metadata //ps metadata
* @param {Viewport} viewport //viewport data
*
* @returns {void}
*/
export function applySoftcopyLUT(metadata: MetaData, viewport: Viewport) {
const voiLutMetadata = metadata.x00283110; // VOI LUT Sequence
Expand Down Expand Up @@ -66,8 +78,14 @@ export function applySoftcopyLUT(metadata: MetaData, viewport: Viewport) {
//SOFTCOPY PRESENTATION LUT
/**
* Applies the Presentation LUT Sequence or shape to the viewport,
* modifying the display output as per DICOM attributes (x20500010, x20500020).
* Supports both LUT application and inversion logic.
modifying the display output as per DICOM attributes (x20500010, x20500020).
Supports both LUT application and inversion logic.
* @name applySoftcopyPresentationLUT
* @protected
* @param {MetaData} metadata //ps metadata
* @param {Viewport} viewport //viewport data
*
* @returns {void}
*/
export function applySoftcopyPresentationLUT(
metadata: MetaData,
Expand Down
23 changes: 19 additions & 4 deletions imaging/tools/custom/gspsUtils/maskUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ const getNewContext = csTools.importInternal("drawing/getNewContext");

//SHUTTER

/*
This function retrieves and applies a display shutter based on DICOM metadata,
supporting rectangular, circular, and polygonal shutters (shape x00181600).
/**
* This function retrieves and applies a display shutter based on DICOM metadata,
supporting rectangular, circular, and polygonal shutters (shape x00181600).
* @name retrieveDisplayShutter
* @protected
* @param {MetaData} metadata //ps metadata
* @param {HTMLElement} element //HTML element associated with the image display
* @param {Image} image //the dicom image
* @param {HTMLCanvasElement} canvas //canvas where the shutter effect will be applied
* @param {ViewportComplete} viewport //viewport settings
*
* @returns {void}
*/
export function retrieveDisplayShutter(
metadata: MetaData,
Expand Down Expand Up @@ -95,7 +104,13 @@ export function retrieveDisplayShutter(

/**
* Enables and updates the Digital Subtraction Angiography (DSA) mask on
* multi-frame series, ensuring the appropriate frame is displayed.
multi-frame series, ensuring the appropriate frame is displayed.
* @name applyMask
* @protected
* @param {Series} serie //the original series data
* @param {HTMLElement} element //the html div id used for rendering or its DOM HTMLElement
*
* @returns {void}
*/
export function applyMask(serie: Series, element: HTMLElement) {
if (serie.isMultiframe) {
Expand Down
44 changes: 39 additions & 5 deletions imaging/tools/custom/gspsUtils/spatialTransformationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ import { DisplayAreaVisualizations, ViewportComplete } from "../../types";

/**
* Applies spatial transformations like rotation and flipping to the viewport
* using the DICOM Graphic Layer Module (x00700041, x00700042).
* Considers initial rotation and flip settings.
using the DICOM Graphic Layer Module (x00700041, x00700042).
Considers initial rotation and flip settings.
* @name applySpatialTransformation
* @protected
* @param {MetaData} metadata //ps metadata
* @param {ViewportComplete} viewport //viewport object containing display settings
*
* @returns {void}
*/
export function applySpatialTransformation(
metadata: MetaData,
Expand All @@ -32,9 +38,16 @@ export function applySpatialTransformation(

/**
* Applies zoom and pan transformations to the viewport based on the
* DICOM Displayed Area Selection Sequence (x0070005a). Handles pixel
* origin interpretation, top-left/bottom-right coordinates, pixel spacing,
* and magnification.
DICOM Displayed Area Selection Sequence (x0070005a). Handles pixel
origin interpretation, top-left/bottom-right coordinates, pixel spacing,
and magnification.
* @name applyZoomPan
* @protected
* @param {MetaData} metadata //ps metadata
* @param {ViewportComplete} viewport //viewport properties
* @param {HTMLElement} element //
*
* @returns {void}
*/
export function applyZoomPan(
metadata: MetaData,
Expand Down Expand Up @@ -124,6 +137,17 @@ export function applyZoomPan(
}
}

/**
* Sets the viewport's row and column pixel spacing
based on the presentation size mode
* @name handlePixelSpacing
* @protected
* @param {ViewportComplete} viewport //viewport object containing display settings
* @param {[number, number]} spacing //pixel spacing values
* @param {[number, number]} defaultSpacing //default pixel spacing values
*
* @returns {void}
*/
function handlePixelSpacing(
viewport: ViewportComplete,
spacing: [number, number],
Expand All @@ -143,6 +167,16 @@ function handlePixelSpacing(
}
}

/**
* Sets the row and column pixel spacing of the viewport's displayed area
based on the provided aspect ratio.
* @name handleAspectRatio
* @protected
* @param {ViewportComplete} viewport //viewport object containing display settings
* @param {[number, number]} aspectRatio //tuple representing the aspect ratio
*
* @returns {void}
*/
function handleAspectRatio(
viewport: ViewportComplete,
aspectRatio: [number, number]
Expand Down