Skip to content

Conversation

@jadh4v
Copy link
Collaborator

@jadh4v jadh4v commented Nov 18, 2025

Context

Add a non-linear sigmoid grayscale colormap as an alternative to linear grayscale. This mapping is described in the DICOM standard in section C.11.2.1.3.1 SIGMOID Function and equation C.11-1. We use a normalized window_width of [-1, 1] and window_center = 0. The colormap is generated using a 16-point sampling of this function.

See: https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_c.11.2.html

There are two ways to access the sigmoid function:

  1. Developer can use the newly added sigmoid presets that already are generated on the sigmoid curve, or
  2. Use the ScalarMappingMode property on vtkColorTransferFunction to adapt any color map to sigmoid mapping. the vtkColorTransferFunction provides two ScalarMappingModes. LINEAR continues to be the default value and behavior, and SIGMOID allows to switch the scalar to color mapping to the sigmoid function. Additionally, you can control the growth rate factor using setSigmoidGrowthRate() which is usually a negative number and equal to -4 according to the DICOM standard.

Results

A comparison of linear vs sigmoid grayscale using the ImageViewer example.

npm run example ImageViewer
linear sigmoid
Screenshot 2025-11-18 at 6 49 43 PM Screenshot 2025-11-18 at 6 50 00 PM

The sampled 16-point sigmoid function plotted through matplotlib:
dicom-grayscale-sigmoid-plot

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@jadh4v jadh4v self-assigned this Nov 19, 2025
@jadh4v jadh4v requested a review from sankhesh November 19, 2025 00:17
Add a non-linear sigmoid grayscale colormap as an alternative to
linear grayscale.
This mapping is described in the DICOM standard in section
C.11.2.1.3.1 SIGMOID Function and equation C.11-1.
We use a normalized window_width of [-1, 1]
and window_center = 0.
The colormap is generated using a 16-point sampling of this function.
@jadh4v jadh4v force-pushed the ENH-add-sigmoid-interpolation-to-transfer-functions branch from 18b448d to aed71ec Compare November 19, 2025 00:18
@jadh4v
Copy link
Collaborator Author

jadh4v commented Nov 19, 2025

cc: @finetjul please also review

@jadh4v jadh4v force-pushed the ENH-add-sigmoid-interpolation-to-transfer-functions branch from e8f9a2b to 7a19880 Compare November 25, 2025 23:48
@jadh4v jadh4v force-pushed the ENH-add-sigmoid-interpolation-to-transfer-functions branch from 7a19880 to 12d5c65 Compare November 26, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants