Skip to content

Commit

Permalink
feat(4D): added support for 4D data rendering (#438)
Browse files Browse the repository at this point in the history
* feat(4D): added support for 4D datasets + examples

* feat(4D): PR feedback

* feat(4D): fixed unit tests

* update examples

* update examples

* feat(4D): update-API

* feat(4D): updated cornerstone-wado-image-loader@4.10.0

* feat(4D): fixed synchronizerManager unit test

* feat(4D): performance improvements

* feat(4D): update-API

* feat(4D): code review
  • Loading branch information
lscoder authored Feb 28, 2023
1 parent 5287ac1 commit 975e596
Show file tree
Hide file tree
Showing 43 changed files with 2,789 additions and 870 deletions.
47 changes: 41 additions & 6 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,17 @@ interface IContourSet {
readonly sizeInBytes: number;
}

// @public (undocumented)
interface IDynamicImageVolume extends IImageVolume {
// (undocumented)
getScalarDataArrays(): VolumeScalarData[];
// (undocumented)
get numTimePoints(): number;
// (undocumented)
get timePointIndex(): number;
set timePointIndex(newTimePointIndex: number);
}

// @public (undocumented)
interface IEnabledElement {
// (undocumented)
Expand Down Expand Up @@ -1066,15 +1077,25 @@ interface IImageVolume {
// (undocumented)
convertToCornerstoneImage?: (imageId: string, imageIdIndex: number) => IImageLoadObject;
// (undocumented)
destroy(): void;
// (undocumented)
dimensions: Point3;
// (undocumented)
direction: Mat3;
// (undocumented)
getImageIdIndex(imageId: string): number;
// (undocumented)
getImageURIIndex(imageURI: string): number;
// (undocumented)
getScalarData(): VolumeScalarData;
// (undocumented)
hasPixelSpacing: boolean;
// (undocumented)
imageData?: vtkImageData;
// (undocumented)
imageIds?: Array<string>;
imageIds: Array<string>;
// (undocumented)
isDynamicVolume(): boolean;
// (undocumented)
isPrescaled: boolean;
// (undocumented)
Expand All @@ -1088,8 +1109,6 @@ interface IImageVolume {
// (undocumented)
referencedVolumeId?: string;
// (undocumented)
scalarData: any;
// (undocumented)
scaling?: {
PET?: {
SUVlbmFactor?: number;
Expand Down Expand Up @@ -1238,15 +1257,26 @@ export class ImageVolume implements IImageVolume {
// (undocumented)
cancelLoading: () => void;
// (undocumented)
destroy(): void;
// (undocumented)
dimensions: Point3;
// (undocumented)
direction: Mat3;
// (undocumented)
getImageIdIndex(imageId: string): number;
// (undocumented)
getImageURIIndex(imageURI: string): number;
// (undocumented)
getScalarData(): VolumeScalarData;
// (undocumented)
hasPixelSpacing: boolean;
// (undocumented)
imageData?: any;
// (undocumented)
imageIds?: Array<string>;
get imageIds(): Array<string>;
set imageIds(newImageIds: Array<string>);
// (undocumented)
isDynamicVolume(): boolean;
// (undocumented)
isPrescaled: boolean;
// (undocumented)
Expand All @@ -1260,7 +1290,7 @@ export class ImageVolume implements IImageVolume {
// (undocumented)
referencedVolumeId?: string;
// (undocumented)
scalarData: Float32Array | Uint8Array;
protected scalarData: VolumeScalarData | Array<VolumeScalarData>;
// (undocumented)
scaling?: {
PET?: {
Expand Down Expand Up @@ -1561,7 +1591,7 @@ interface IVolume {
// (undocumented)
referencedVolumeId?: string;
// (undocumented)
scalarData: Float32Array | Uint8Array;
scalarData: VolumeScalarData | Array<VolumeScalarData>;
// (undocumented)
scaling?: {
PET?: {
Expand Down Expand Up @@ -2123,8 +2153,10 @@ declare namespace Types {
IEnabledElement,
ICache,
IVolume,
VolumeScalarData,
IViewportId,
IImageVolume,
IDynamicImageVolume,
IRenderingEngine,
ScalingParameters,
PTScaling,
Expand Down Expand Up @@ -2522,6 +2554,9 @@ type VolumeNewImageEventDetail = {
renderingEngineId: string;
};

// @public (undocumented)
type VolumeScalarData = Float32Array | Uint8Array;

// @public (undocumented)
export class VolumeViewport extends BaseVolumeViewport {
constructor(props: ViewportInput);
Expand Down
57 changes: 40 additions & 17 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
```ts

import { default as default_2 } from 'packages/core/dist/esm/enums/RequestType';
import type { mat4 } from 'gl-matrix';
import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
import type { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData';
Expand Down Expand Up @@ -75,6 +76,11 @@ enum ContourType {
OPEN_PLANAR = 'OPEN_PLANAR',
}

// @public (undocumented)
export function cornerstoneStreamingDynamicImageVolumeLoader(volumeId: string, options: {
imageIds: string[];
}): IVolumeLoader_2;

// @public (undocumented)
export function cornerstoneStreamingImageVolumeLoader(volumeId: string, options: {
imageIds: string[];
Expand Down Expand Up @@ -612,6 +618,14 @@ interface IContourSet {
readonly sizeInBytes: number;
}

// @public
interface IDynamicImageVolume extends IImageVolume {
getScalarDataArrays(): VolumeScalarData[];
get numTimePoints(): number;
get timePointIndex(): number;
set timePointIndex(newTimePointIndex: number);
}

// @public
interface IEnabledElement {
FrameOfReferenceUID: string;
Expand Down Expand Up @@ -750,18 +764,22 @@ interface IImageVolume {
imageId: string,
imageIdIndex: number
) => IImageLoadObject;
destroy(): void;
dimensions: Point3;
direction: Mat3;
getImageIdIndex(imageId: string): number;
getImageURIIndex(imageURI: string): number;
getScalarData(): VolumeScalarData;
hasPixelSpacing: boolean;
imageData?: vtkImageData;
imageIds?: Array<string>;
imageIds: Array<string>;
isDynamicVolume(): boolean;
isPrescaled: boolean;
loadStatus?: Record<string, any>;
metadata: Metadata;
numVoxels: number;
origin: Point3;
referencedVolumeId?: string;
scalarData: any;
scaling?: {
PET?: {
SUVlbmFactor?: number;
Expand Down Expand Up @@ -985,6 +1003,7 @@ interface IStreamingImageVolume extends ImageVolume {
// @public (undocumented)
interface IStreamingVolumeProperties {
imageIds: Array<string>;

loadStatus: {
loaded: boolean;
loading: boolean;
Expand Down Expand Up @@ -1056,7 +1075,7 @@ interface IVolume {
metadata: Metadata;
origin: Point3;
referencedVolumeId?: string;
scalarData: Float32Array | Uint8Array;
scalarData: VolumeScalarData | Array<VolumeScalarData>;
scaling?: {
PET?: {
// @TODO: Do these values exist?
Expand Down Expand Up @@ -1318,16 +1337,24 @@ type StackViewportScrollEventDetail = {
};

// @public (undocumented)
export class StreamingImageVolume extends ImageVolume {
export class StreamingDynamicImageVolume extends BaseStreamingImageVolume implements Types.IDynamicImageVolume {
constructor(imageVolumeProperties: Types.IVolume, streamingProperties: Types.IStreamingVolumeProperties);
// (undocumented)
cancelLoading: () => void;
getImageLoadRequests: (priority: number) => any[];
// (undocumented)
clearLoadCallbacks(): void;
getScalarData(): Types.VolumeScalarData;
// (undocumented)
convertToCornerstoneImage(imageId: string, imageIdIndex: number): Types.IImageLoadObject;
isDynamicVolume(): boolean;
// (undocumented)
decache(completelyRemove?: boolean): void;
get numTimePoints(): number;
// (undocumented)
get timePointIndex(): number;
set timePointIndex(newTimePointIndex: number);
}

// @public (undocumented)
export class StreamingImageVolume extends BaseStreamingImageVolume {
constructor(imageVolumeProperties: Types.IVolume, streamingProperties: Types.IStreamingVolumeProperties);
// (undocumented)
getImageLoadRequests: (priority: number) => {
callLoadImage: (imageId: any, imageIdIndex: any, options: any) => Promise<void>;
Expand All @@ -1347,20 +1374,13 @@ export class StreamingImageVolume extends ImageVolume {
};
};
priority: number;
requestType: Enums.RequestType;
requestType: default_2;
additionalDetails: {
volumeId: string;
};
}[];
// (undocumented)
load: (callback: (...args: unknown[]) => void, priority?: number) => void;
// (undocumented)
loadStatus: {
loaded: boolean;
loading: boolean;
cachedFrames: Array<boolean>;
callbacks: Array<(...args: unknown[]) => void>;
};
getScalarData(): Types.VolumeScalarData;
}

// @public
Expand Down Expand Up @@ -1504,6 +1524,9 @@ type VolumeNewImageEventDetail = {
renderingEngineId: string;
};

// @public (undocumented)
type VolumeScalarData = Float32Array | Uint8Array;

// @public
type VolumeViewportProperties = {
voiRange?: VOIRange;
Expand Down
22 changes: 19 additions & 3 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,14 @@ type IDistance = {
world: number;
};

// @public
interface IDynamicImageVolume extends IImageVolume {
getScalarDataArrays(): VolumeScalarData[];
get numTimePoints(): number;
get timePointIndex(): number;
set timePointIndex(newTimePointIndex: number);
}

// @public
interface IEnabledElement {
FrameOfReferenceUID: string;
Expand Down Expand Up @@ -2323,18 +2331,22 @@ interface IImageVolume {
imageId: string,
imageIdIndex: number
) => IImageLoadObject;
destroy(): void;
dimensions: Point3;
direction: Mat3;
getImageIdIndex(imageId: string): number;
getImageURIIndex(imageURI: string): number;
getScalarData(): VolumeScalarData;
hasPixelSpacing: boolean;
imageData?: vtkImageData;
imageIds?: Array<string>;
imageIds: Array<string>;
isDynamicVolume(): boolean;
isPrescaled: boolean;
loadStatus?: Record<string, any>;
metadata: Metadata;
numVoxels: number;
origin: Point3;
referencedVolumeId?: string;
scalarData: any;
scaling?: {
PET?: {
SUVlbmFactor?: number;
Expand Down Expand Up @@ -2609,6 +2621,7 @@ interface IStreamingImageVolume extends ImageVolume {
// @public (undocumented)
interface IStreamingVolumeProperties {
imageIds: Array<string>;

loadStatus: {
loaded: boolean;
loading: boolean;
Expand Down Expand Up @@ -2785,7 +2798,7 @@ interface IVolume {
metadata: Metadata;
origin: Point3;
referencedVolumeId?: string;
scalarData: Float32Array | Uint8Array;
scalarData: VolumeScalarData | Array<VolumeScalarData>;
scaling?: {
PET?: {
// @TODO: Do these values exist?
Expand Down Expand Up @@ -5212,6 +5225,9 @@ export class VolumeRotateMouseWheelTool extends BaseTool {
static toolName: any;
}

// @public (undocumented)
type VolumeScalarData = Float32Array | Uint8Array;

// @public
type VolumeViewportProperties = {
voiRange?: VOIRange;
Expand Down
Loading

0 comments on commit 975e596

Please sign in to comment.