Skip to content

Commit

Permalink
fix: cleanup exports, add docs and more tutorials (#39)
Browse files Browse the repository at this point in the history
* finish the stack tutorial

* add voliume tutorial

* add images to tutorials

* add manipulation tools docs

* add segmentation tutorial

* finish examples page

* fix petCT crosshairs by adding initial camera sync

* fix mobile

* fix api page footer margin

* update api doc

* add namespaces for enums and constants

* fix various exports and docs for core

* fix exports for tools

* initial effort for changing colorLut to ColorLUT

* update api

* fix the navbar highlight color

* edit overview

* edit scope

* edit related libraries
  • Loading branch information
sedghi authored Apr 1, 2022
1 parent 779c730 commit 743dea8
Show file tree
Hide file tree
Showing 66 changed files with 1,862 additions and 334 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// @typescript-eslint/eslint-plugin
// - @typescript-eslint
//
//
// eslint-plugin-import
// - import
"plugins": [
Expand Down
78 changes: 65 additions & 13 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ function addProvider(provider: (type: string, imageId: string) => {
// @public (undocumented)
export function addVolumesToViewports(renderingEngine: IRenderingEngine, volumeInputs: Array<IVolumeInput>, viewportIds: Array<string>, immediateRender?: boolean): Promise<void>;

// @public (undocumented)
enum BlendModes {
// (undocumented)
AVERAGE_INTENSITY_BLEND,
// (undocumented)
COMPOSITE,
// (undocumented)
MAXIMUM_INTENSITY_BLEND,
// (undocumented)
MINIMUM_INTENSITY_BLEND
}

// @public (undocumented)
export const cache: Cache_2;

Expand All @@ -51,10 +63,15 @@ function cancelLoadImage(imageId: string): void;
function cancelLoadImages(imageIds: Array<string>): void;

// @public (undocumented)
export const CONSTANTS: {
ORIENTATION: Record<string, Types.Orientation>;
CPU_COLORMAPS: Types.CPUFallbackColormapsData;
};
const colormapsData: CPUFallbackColormapsData;

declare namespace CONSTANTS {
export {
ORIENTATION,
colormapsData as CPU_COLORMAPS
}
}
export { CONSTANTS }

// @public (undocumented)
interface CPUFallbackColormap {
Expand Down Expand Up @@ -230,7 +247,7 @@ type CPUFallbackRenderingTools = {
putImageData: (renderCanvasData: unknown, dx: number, dy: number) => unknown;
};
colormapId?: string;
colorLut?: CPUFallbackLookupTable;
colorLUT?: CPUFallbackLookupTable;
renderCanvasData?: {
data: Uint8ClampedArray;
};
Expand Down Expand Up @@ -371,14 +388,16 @@ type ElementEnabledEventDetail = {
renderingEngineId: string;
};

// @public (undocumented)
export const Enums: {
Events: typeof EVENTS;
ViewportType: typeof ViewportType;
InterpolationType: typeof InterpolationType;
RequestType: typeof RequestType;
BlendModes: typeof BlendModes;
};
declare namespace Enums {
export {
EVENTS as Events,
BlendModes,
InterpolationType,
RequestType,
ViewportType
}
}
export { Enums }

// @public (undocumented)
export enum EVENTS {
Expand Down Expand Up @@ -941,6 +960,16 @@ function indexWithinDimensions(index: Point3, dimensions: Point3): boolean;
// @public (undocumented)
export function init(defaultConfiguration?: {}): Promise<boolean>;

// @public (undocumented)
enum InterpolationType {
// (undocumented)
FAST_LINEAR = 2,
// (undocumented)
LINEAR = 1,
// (undocumented)
NEAREST = 0
}

// @public (undocumented)
function invertRgbTransferFunction(rgbTransferFunction: any): void;

Expand Down Expand Up @@ -1302,6 +1331,9 @@ const metadataProvider: {
get: (type: string, imageId: string) => [number, number];
};

// @public (undocumented)
const ORIENTATION: Record<string, Orientation>;

// @public (undocumented)
type Orientation = {
sliceNormal: Point3;
Expand Down Expand Up @@ -1413,6 +1445,16 @@ export class RenderingEngine implements IRenderingEngine {
// @public (undocumented)
export function renderToCanvas(imageId: string, canvas: HTMLCanvasElement, renderingEngineId?: any, suppressEvents?: boolean): Promise<string>;

// @public (undocumented)
enum RequestType {
// (undocumented)
Interaction = "interaction",
// (undocumented)
Prefetch = "prefetch",
// (undocumented)
Thumbnail = "thumbnail"
}

// @public (undocumented)
export function resetUseCPURendering(): void;

Expand Down Expand Up @@ -1792,6 +1834,16 @@ type ViewportInputOptions = {
suppressEvents?: boolean;
};

// @public (undocumented)
enum ViewportType {
// (undocumented)
ORTHOGRAPHIC = "orthographic",
// (undocumented)
PERSPECTIVE = "perspective",
// (undocumented)
STACK = "stack"
}

// @public (undocumented)
type VOI = {
windowWidth: number;
Expand Down
62 changes: 59 additions & 3 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
```ts

import { default as default_2 } from 'packages/core/dist/esm/enums/RequestType';
import type { mat4 } from 'gl-matrix';
import type { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData';
import type { vtkVolume } from '@kitware/vtk.js/Rendering/Core/Volume';
Expand All @@ -16,6 +15,14 @@ type ActorEntry = {
slabThickness?: number;
};

// @public
enum BlendModes {
AVERAGE_INTENSITY_BLEND = BlendMode.AVERAGE_INTENSITY_BLEND,
COMPOSITE = BlendMode.COMPOSITE,
MAXIMUM_INTENSITY_BLEND = BlendMode.MAXIMUM_INTENSITY_BLEND,
MINIMUM_INTENSITY_BLEND = BlendMode.MINIMUM_INTENSITY_BLEND,
}

// @public
type CameraModifiedEvent = CustomEvent_2<CameraModifiedEventDetail>;

Expand Down Expand Up @@ -210,7 +217,7 @@ type CPUFallbackRenderingTools = {
) => unknown;
};
colormapId?: string;
colorLut?: CPUFallbackLookupTable;
colorLUT?: CPUFallbackLookupTable;
renderCanvasData?: {
data: Uint8ClampedArray;
};
Expand Down Expand Up @@ -332,6 +339,33 @@ type ElementEnabledEventDetail = {
renderingEngineId: string;
};

// @public
enum Events {
CACHE_SIZE_EXCEEDED = 'CACHE_SIZE_EXCEEDED',
CAMERA_MODIFIED = 'CORNERSTONE_CAMERA_MODIFIED',

ELEMENT_DISABLED = 'CORNERSTONE_ELEMENT_DISABLED',
ELEMENT_ENABLED = 'CORNERSTONE_ELEMENT_ENABLED',
IMAGE_CACHE_IMAGE_ADDED = 'CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED',
IMAGE_CACHE_IMAGE_REMOVED = 'CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED',
IMAGE_LOAD_ERROR = 'IMAGE_LOAD_ERROR',
IMAGE_LOAD_FAILED = 'CORNERSTONE_IMAGE_LOAD_FAILED',
IMAGE_LOAD_PROGRESS = 'CORNERSTONE_IMAGE_LOAD_PROGRESS',
IMAGE_LOADED = 'CORNERSTONE_IMAGE_LOADED',
IMAGE_RENDERED = 'CORNERSTONE_IMAGE_RENDERED',
IMAGE_SPACING_CALIBRATED = 'CORNERSTONE_IMAGE_SPACING_CALIBRATED',
IMAGE_VOLUME_MODIFIED = 'CORNERSTONE_IMAGE_VOLUME_MODIFIED',
STACK_NEW_IMAGE = 'CORNERSTONE_STACK_NEW_IMAGE',
VOI_MODIFIED = 'CORNERSTONE_VOI_MODIFIED',
VOLUME_CACHE_VOLUME_ADDED = 'CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED',
VOLUME_CACHE_VOLUME_REMOVED = 'CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED',
VOLUME_LOADED = 'CORNERSTONE_VOLUME_LOADED',
VOLUME_LOADED_FAILED = 'CORNERSTONE_VOLUME_LOADED_FAILED',
// IMAGE_CACHE_FULL = 'CORNERSTONE_IMAGE_CACHE_FULL',
// PRE_RENDER = 'CORNERSTONE_PRE_RENDER',
// ELEMENT_RESIZED = 'CORNERSTONE_ELEMENT_RESIZED',
}

declare namespace EventTypes {
export {
CameraModifiedEventDetail,
Expand Down Expand Up @@ -655,6 +689,14 @@ type ImageVolumeModifiedEventDetail = {
FrameOfReferenceUID: string;
};

// @public
enum InterpolationType {
// (undocumented)
FAST_LINEAR,
LINEAR,
NEAREST,
}

// @public
interface IRegisterImageLoader {
// (undocumented)
Expand Down Expand Up @@ -944,6 +986,13 @@ type PublicViewportInput = {
defaultOptions?: ViewportInputOptions;
};

// @public
enum RequestType {
Interaction = 'interaction',
Prefetch = 'prefetch',
Thumbnail = 'thumbnail',
}

// @public (undocumented)
type Scaling = {
PET?: PTScaling;
Expand Down Expand Up @@ -1014,7 +1063,7 @@ export class StreamingImageVolume extends ImageVolume {
};
};
priority: number;
requestType: default_2;
requestType: Enums.RequestType;
additionalDetails: {
volumeId: string;
};
Expand All @@ -1040,6 +1089,13 @@ type ViewportInputOptions = {
suppressEvents?: boolean;
};

// @public
enum ViewportType {
ORTHOGRAPHIC = 'orthographic',
PERSPECTIVE = 'perspective',
STACK = 'stack',
}

// @public (undocumented)
type VOI = {
windowWidth: number;
Expand Down
46 changes: 28 additions & 18 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type ActorEntry = {
function addAnnotation(element: HTMLDivElement, annotation: Annotation): void;

// @public (undocumented)
function addColorLUT(colorLut: ColorLut, index: number): void;
function addColorLUT(colorLUT: ColorLUT, index: number): void;

// @public (undocumented)
function addColorLUT_2(colorLUT: ColorLut, colorLUTIndex: number): void;
function addColorLUT_2(colorLUT: ColorLUT, colorLUTIndex: number): void;

// @public (undocumented)
function addSegmentation(segmentationInput: SegmentationPublicInput, suppressEvents?: boolean): void;
Expand Down Expand Up @@ -418,7 +418,7 @@ declare namespace color {
}

// @public (undocumented)
type ColorLut = Array<Color>;
type ColorLUT = Array<Color>;

declare namespace config {
export {
Expand Down Expand Up @@ -631,7 +631,7 @@ type CPUFallbackRenderingTools = {
) => unknown;
};
colormapId?: string;
colorLut?: CPUFallbackLookupTable;
colorLUT?: CPUFallbackLookupTable;
renderCanvasData?: {
data: Uint8ClampedArray;
};
Expand Down Expand Up @@ -1094,14 +1094,17 @@ export class EllipticalROITool extends AnnotationTool {
touchDragCallback: any;
}

// @public (undocumented)
export const Enums: {
MouseBindings: typeof MouseBindings;
KeyboardBindings: typeof KeyboardBindings;
ToolModes: typeof ToolModes;
Events: typeof Events;
SegmentationRepresentations: typeof SegmentationRepresentations;
};
declare namespace Enums {
export {
MouseBindings,
KeyboardBindings,
ToolModes,
AnnotationStyleStates,
Events,
SegmentationRepresentations
}
}
export { Enums }

// @public (undocumented)
enum Events {
Expand Down Expand Up @@ -1318,7 +1321,7 @@ function getCanvasEllipseCorners(ellipseCanvasPoints: canvasCoordinates): Array<
function getColorForSegmentIndex(toolGroupId: string, segmentationRepresentationUID: string, segmentIndex: number): Color;

// @public (undocumented)
function getColorLut(index: number): ColorLut | undefined;
function getColorLUT(index: number): ColorLUT | undefined;

// @public (undocumented)
function getDefaultAnnotationManager(): FrameOfReferenceSpecificAnnotationManager;
Expand Down Expand Up @@ -2856,6 +2859,12 @@ type RepresentationConfig = {
LABELMAP?: LabelmapConfig;
};

// @public (undocumented)
type RepresentationPublicInput = {
segmentationId: string;
type: Enums.SegmentationRepresentations;
};

// @public (undocumented)
function resetElementCursor(element: HTMLDivElement): void;

Expand All @@ -2880,7 +2889,7 @@ function scrollThroughStack(evt: MouseWheelEventType | MouseDragEventType, delta
// @public (undocumented)
type Segmentation = {
segmentationId: string;
type: Enums_2.SegmentationRepresentations;
type: Enums.SegmentationRepresentations;
label: string;
activeSegmentIndex: number;
segmentsLocked: Set<number>;
Expand Down Expand Up @@ -2995,7 +3004,7 @@ enum SegmentationRepresentations {

// @public (undocumented)
type SegmentationState = {
colorLut: ColorLut[];
colorLUT: ColorLUT[];
segmentations: Segmentation[];
globalConfig: SegmentationRepresentationConfig;
toolGroups: {
Expand Down Expand Up @@ -3218,7 +3227,7 @@ declare namespace state_2 {
getToolGroupsWithSegmentation,
getSegmentationRepresentationByUID,
addColorLUT,
getColorLut
getColorLUT
}
}

Expand Down Expand Up @@ -3338,7 +3347,7 @@ type ToolGroupSpecificRepresentation = ToolGroupSpecificLabelmapRepresentation;
type ToolGroupSpecificRepresentationState = {
segmentationRepresentationUID: string;
segmentationId: string;
type: Enums_2.SegmentationRepresentations;
type: Enums.SegmentationRepresentations;
active: boolean;
segmentsHidden: Set<number>;
visibility: boolean;
Expand Down Expand Up @@ -3455,8 +3464,9 @@ declare namespace Types {
ToolGroupSpecificRepresentationState,
ToolGroupSpecificLabelmapRepresentation,
ToolGroupSpecificRepresentation,
RepresentationPublicInput,
Color,
ColorLut,
ColorLUT,
LabelmapTypes,
SVGCursorDescriptor,
SVGPoint_2 as SVGPoint
Expand Down
Loading

0 comments on commit 743dea8

Please sign in to comment.