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

feat(voi): added support for sigmoid voiLUTFunction for StackViewport and VolumeViewport #224

Merged
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
38 changes: 34 additions & 4 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { mat4 } from 'gl-matrix';
import { vec3 } from 'gl-matrix';
import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera';
import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
import type { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData';
import vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice';
import type { vtkObject } from '@kitware/vtk.js/interfaces';
Expand Down Expand Up @@ -69,6 +70,8 @@ export abstract class BaseVolumeViewport extends Viewport implements IVolumeView
// (undocumented)
getIntensityFromWorld(point: Point3): number;
// (undocumented)
getProperties: () => VolumeViewportProperties;
// (undocumented)
getSlabThickness(): number;
// (undocumented)
hasImageURI: (imageURI: string) => boolean;
Expand All @@ -85,7 +88,7 @@ export abstract class BaseVolumeViewport extends Viewport implements IVolumeView
// (undocumented)
setOrientation(orientation: OrientationAxis, immediate?: boolean): void;
// (undocumented)
setProperties({ voiRange }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
setProperties({ voiRange, VOILUTFunction }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
// (undocumented)
setSlabThickness(slabThickness: number, filterActorUIDs?: string[]): void;
// (undocumented)
Expand Down Expand Up @@ -461,9 +464,15 @@ function createAndCacheVolume(volumeId: string, options: VolumeLoaderOptions): P
// @public (undocumented)
function createFloat32SharedArray(length: number): Float32Array;

// @public (undocumented)
function createLinearRGBTransferFunction(voiRange: VOIRange): vtkColorTransferFunction;

// @public (undocumented)
function createLocalVolume(options: LocalVolumeOptions, volumeId: string, preventCache?: boolean): ImageVolume;

// @public (undocumented)
function createSigmoidRGBTransferFunction(voiRange: VOIRange, approximationNodes?: number): vtkColorTransferFunction;

// @public (undocumented)
function createUint8SharedArray(length: number): Uint8Array;

Expand Down Expand Up @@ -511,7 +520,8 @@ declare namespace Enums {
OrientationAxis,
SharedArrayBufferModes,
GeometryType,
ContourType
ContourType,
VOILUTFunctionType
}
}
export { Enums }
Expand Down Expand Up @@ -710,6 +720,9 @@ function getViewportsWithImageURI(imageURI: string, renderingEngineId?: string):
// @public (undocumented)
function getViewportsWithVolumeId(volumeId: string, renderingEngineId?: string): Array<IVolumeViewport>;

// @public (undocumented)
function getVoiFromSigmoidRGBTransferFunction(cfun: vtkColorTransferFunction): [number, number];

// @public (undocumented)
function getVolumeActorCorners(volumeActor: any): Array<Point3>;

Expand Down Expand Up @@ -993,6 +1006,8 @@ interface IImage {
// (undocumented)
voiLUT?: CPUFallbackLUT;
// (undocumented)
voiLUTFunction: string;
// (undocumented)
width: number;
// (undocumented)
windowCenter: number[] | number;
Expand Down Expand Up @@ -1611,7 +1626,7 @@ interface IVolumeViewport extends IViewport {
// (undocumented)
getIntensityFromWorld(point: Point3): number;
// (undocumented)
getProperties: () => any;
getProperties: () => VolumeViewportProperties;
// (undocumented)
getSlabThickness(): number;
// (undocumented)
Expand Down Expand Up @@ -1685,6 +1700,7 @@ type Metadata = {
Columns: number;
Rows: number;
voiLut: Array<VOI>;
VOILUTFunction: string;
};

declare namespace metaData {
Expand Down Expand Up @@ -2033,7 +2049,7 @@ export class StackViewport extends Viewport implements IStackViewport {
// (undocumented)
setImageIdIndex(imageIdIndex: number): Promise<string>;
// (undocumented)
setProperties({ voiRange, invert, interpolationType, rotation, }?: StackViewportProperties, suppressEvents?: boolean): void;
setProperties({ voiRange, VOILUTFunction, invert, interpolationType, rotation, }?: StackViewportProperties, suppressEvents?: boolean): void;
// (undocumented)
setStack(imageIds: Array<string>, currentImageIdIndex?: number): Promise<string>;
// (undocumented)
Expand All @@ -2058,6 +2074,7 @@ type StackViewportNewStackEventDetail = {
// @public (undocumented)
type StackViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
Expand Down Expand Up @@ -2179,6 +2196,9 @@ function unregisterAllImageLoaders(): void;
declare namespace utilities {
export {
invertRgbTransferFunction,
createSigmoidRGBTransferFunction,
getVoiFromSigmoidRGBTransferFunction,
createLinearRGBTransferFunction,
scaleRGBTransferFunction as scaleRgbTransferFunction,
triggerEvent,
imageIdToURI,
Expand Down Expand Up @@ -2405,6 +2425,14 @@ type VOI = {
windowCenter: number;
};

// @public (undocumented)
enum VOILUTFunctionType {
// (undocumented)
LINEAR = "LINEAR",
// (undocumented)
SAMPLED_SIGMOID = "SIGMOID"
}

// @public (undocumented)
type VoiModifiedEvent = CustomEvent_2<VoiModifiedEventDetail>;

Expand All @@ -2413,6 +2441,7 @@ type VoiModifiedEventDetail = {
viewportId: string;
range: VOIRange;
volumeId?: string;
VOILUTFunction?: VOILUTFunctionType;
};

// @public (undocumented)
Expand Down Expand Up @@ -2523,6 +2552,7 @@ export class VolumeViewport extends BaseVolumeViewport {
// @public (undocumented)
type VolumeViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
};

declare namespace windowLevel {
Expand Down
17 changes: 15 additions & 2 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ interface IImage {
lastRenderTime?: number;
};
voiLUT?: CPUFallbackLUT;
voiLUTFunction: string;
width: number;
windowCenter: number[] | number;
windowWidth: number[] | number;
Expand Down Expand Up @@ -1115,8 +1116,7 @@ interface IVolumeViewport extends IViewport {
getFrameOfReferenceUID: () => string;
getImageData(volumeId?: string): IImageData | undefined;
getIntensityFromWorld(point: Point3): number;
// (undocumented)
getProperties: () => any;
getProperties: () => VolumeViewportProperties;
getSlabThickness(): number;
hasImageURI: (imageURI: string) => boolean;
hasVolumeId: (volumeId: string) => boolean;
Expand Down Expand Up @@ -1181,6 +1181,7 @@ type Metadata = {
Columns: number;
Rows: number;
voiLut: Array<VOI>;
VOILUTFunction: string;
};

// @public (undocumented)
Expand Down Expand Up @@ -1299,6 +1300,7 @@ type StackViewportNewStackEventDetail = {
// @public
type StackViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
Expand Down Expand Up @@ -1411,6 +1413,15 @@ type VOI = {
windowCenter: number;
};

// @public
enum VOILUTFunctionType {
// (undocumented)
LINEAR = 'LINEAR',
// (undocumented)
SAMPLED_SIGMOID = 'SIGMOID', // SIGMOID is sampled in 1024 even steps so we call it SAMPLED_SIGMOID
// EXACT_LINEAR = 'EXACT_LINEAR', TODO: Add EXACT_LINEAR option from DICOM NEMA
}

// @public
type VoiModifiedEvent = CustomEvent_2<VoiModifiedEventDetail>;

Expand All @@ -1419,6 +1430,7 @@ type VoiModifiedEventDetail = {
viewportId: string;
range: VOIRange;
volumeId?: string;
VOILUTFunction?: VOILUTFunctionType;
};

// @public (undocumented)
Expand Down Expand Up @@ -1495,6 +1507,7 @@ type VolumeNewImageEventDetail = {
// @public
type VolumeViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
};

// (No @packageDocumentation comment for this package)
Expand Down
8 changes: 6 additions & 2 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,7 @@ interface IImage {
lastRenderTime?: number;
};
voiLUT?: CPUFallbackLUT;
voiLUTFunction: string;
width: number;
windowCenter: number[] | number;
windowWidth: number[] | number;
Expand Down Expand Up @@ -2844,8 +2845,7 @@ interface IVolumeViewport extends IViewport {
getFrameOfReferenceUID: () => string;
getImageData(volumeId?: string): IImageData | undefined;
getIntensityFromWorld(point: Point3): number;
// (undocumented)
getProperties: () => any;
getProperties: () => VolumeViewportProperties;
getSlabThickness(): number;
hasImageURI: (imageURI: string) => boolean;
hasVolumeId: (volumeId: string) => boolean;
Expand Down Expand Up @@ -3146,6 +3146,7 @@ type Metadata = {
Columns: number;
Rows: number;
voiLut: Array<VOI>;
VOILUTFunction: string;
};

// @public (undocumented)
Expand Down Expand Up @@ -4498,6 +4499,7 @@ type StackViewportNewStackEventDetail = {
// @public
type StackViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
Expand Down Expand Up @@ -5122,6 +5124,7 @@ type VoiModifiedEventDetail = {
viewportId: string;
range: VOIRange;
volumeId?: string;
VOILUTFunction?: VOILUTFunctionType;
};

// @public (undocumented)
Expand Down Expand Up @@ -5209,6 +5212,7 @@ export class VolumeRotateMouseWheelTool extends BaseTool {
// @public
type VolumeViewportProperties = {
voiRange?: VOIRange;
VOILUTFunction?: VOILUTFunctionType;
};

// @public (undocumented)
Expand Down
Loading