Skip to content

Commit

Permalink
feat(calibration): Add calibration type labels (ERMF, PROJ, USER) (#638)
Browse files Browse the repository at this point in the history
* feat(measurement): Add calibration type labels (ERMF, PROJ, USER)

* fix(measurement): Fix ERMF display

* fix(measurement): Use consistent rounding/sizing on measurements

* Fix freehand units

* api-check

* API check fix

* PR comments

* PR fixes

* API check

* Api check

* api-check

* Example calibrations

* fix: Update the image calibration to include a message

* PR requested changes

* PR changes

* Fix the calibration application so it works properly

* Fix remainder of tools

* Fix tests

* Fix tests

* PR changes

* Api check

* PR fixes

* Reverting unneeded change

* Build fixes

* Convert null to 1 spacing to prevent deleting data

* Comments

* PR requested changes

* Fix tests

* api-check

* Remove unneeded calibration event

* Remove resolutions in favour of updating resemblejs

* Fix the 1:1 and 0.5:1 aspect ratios

* Fix exception being thrown on point near tool

* PR requested changes

* Updated aspect docs as requested

* Update API

* api-check
  • Loading branch information
wayfarer3130 committed Jul 21, 2023
1 parent cbfe534 commit 0aafbc2
Show file tree
Hide file tree
Showing 37 changed files with 937 additions and 349 deletions.
50 changes: 46 additions & 4 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,24 @@ export const cache: Cache_2;
// @public (undocumented)
function calculateViewportsSpatialRegistration(viewport1: IStackViewport, viewport2: IStackViewport): void;

// @public (undocumented)
enum CalibrationTypes {
// (undocumented)
ERMF = "ERMF",
// (undocumented)
ERROR = "Error",
// (undocumented)
NOT_APPLICABLE = "",
// (undocumented)
PROJECTION = "Proj",
// (undocumented)
REGION = "Region",
// (undocumented)
UNCALIBRATED = "Uncalibrated",
// (undocumented)
USER = "User"
}

// @public (undocumented)
type CameraModifiedEvent = CustomEvent_2<CameraModifiedEventDetail>;

Expand Down Expand Up @@ -438,6 +456,7 @@ type CPUIImageData = {
scalarData: PixelDataTypedArray;
scaling: Scaling;
hasPixelSpacing?: boolean;
calibration?: IImageCalibration;
preScale?: {
scaled?: boolean;
scalingParameters?: {
Expand Down Expand Up @@ -563,6 +582,7 @@ declare namespace Enums {
export {
EVENTS as Events,
BlendModes,
CalibrationTypes,
InterpolationType,
RequestType,
ViewportType,
Expand Down Expand Up @@ -1127,8 +1147,28 @@ interface IImage {
windowWidth: number[] | number;
}

// @public (undocumented)
interface IImageCalibration {
// (undocumented)
aspect?: number;
// (undocumented)
columnPixelSpacing?: number;
// (undocumented)
rowPixelSpacing?: number;
// (undocumented)
scale?: number;
// (undocumented)
sequenceOfUltrasoundRegions?: Record<string, unknown>[];
// (undocumented)
tooltip?: string;
// (undocumented)
type: CalibrationTypes;
}

// @public (undocumented)
interface IImageData {
// (undocumented)
calibration?: IImageCalibration;
// (undocumented)
dimensions: Point3;
// (undocumented)
Expand Down Expand Up @@ -1396,8 +1436,7 @@ type ImageSpacingCalibratedEventDetail = {
viewportId: string;
renderingEngineId: string;
imageId: string;
rowScale: number;
columnScale: number;
calibration: IImageCalibration;
imageData: vtkImageData;
worldToIndex: mat4;
};
Expand Down Expand Up @@ -1915,8 +1954,8 @@ export { metaData }

// @public (undocumented)
const metadataProvider: {
add: (imageId: string, payload: CalibratedPixelValue) => void;
get: (type: string, imageId: string) => CalibratedPixelValue;
add: (imageId: string, payload: IImageCalibration) => void;
get: (type: string, imageId: string) => IImageCalibration;
};

// @public (undocumented)
Expand Down Expand Up @@ -2363,6 +2402,7 @@ declare namespace Types {
IStreamingImageVolume,
IImage,
IImageData,
IImageCalibration,
CPUIImageData,
CPUImageData,
EventTypes,
Expand Down Expand Up @@ -2503,6 +2543,8 @@ export class Viewport implements IViewport {
// (undocumented)
addActors(actors: Array<ActorEntry>, resetCameraPanAndZoom?: boolean): void;
// (undocumented)
protected calibration: IImageCalibration;
// (undocumented)
readonly canvas: HTMLCanvasElement;
// (undocumented)
canvasToWorld: (canvasPos: Point2) => Point3;
Expand Down
30 changes: 28 additions & 2 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ enum BlendModes {
MINIMUM_INTENSITY_BLEND = BlendMode.MINIMUM_INTENSITY_BLEND,
}

// @public
enum CalibrationTypes {
ERMF = 'ERMF',
ERROR = 'Error',
NOT_APPLICABLE = '',
PROJECTION = 'Proj',
REGION = 'Region',
UNCALIBRATED = 'Uncalibrated',
USER = 'User',
}

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

Expand Down Expand Up @@ -361,6 +372,8 @@ type CPUIImageData = {
scalarData: PixelDataTypedArray;
scaling: Scaling;
hasPixelSpacing?: boolean;
calibration?: IImageCalibration;

preScale?: {
scaled?: boolean;
scalingParameters?: {
Expand Down Expand Up @@ -795,8 +808,22 @@ interface IImage {
windowWidth: number[] | number;
}

// @public
interface IImageCalibration {
aspect?: number;
// (undocumented)
columnPixelSpacing?: number;
rowPixelSpacing?: number;
scale?: number;
sequenceOfUltrasoundRegions?: Record<string, unknown>[];
tooltip?: string;
type: CalibrationTypes;
}

// @public
interface IImageData {
// (undocumented)
calibration?: IImageCalibration;
dimensions: Point3;
direction: Mat3;
hasPixelSpacing?: boolean;
Expand Down Expand Up @@ -999,8 +1026,7 @@ type ImageSpacingCalibratedEventDetail = {
viewportId: string;
renderingEngineId: string;
imageId: string;
rowScale: number;
columnScale: number;
calibration: IImageCalibration;
imageData: vtkImageData;
worldToIndex: mat4;
};
Expand Down
27 changes: 23 additions & 4 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export class BrushTool extends BaseTool {
function calculateAreaOfPoints(points: Types_2.Point2[]): number;

// @public (undocumented)
function calibrateImageSpacing(imageId: string, renderingEngine: Types_2.IRenderingEngine, rowPixelSpacing: number, columnPixelSpacing: number): void;
function calibrateImageSpacing(imageId: string, renderingEngine: Types_2.IRenderingEngine, calibrationOrScale: Types_2.IImageCalibration | number): void;

// @public
type CameraModifiedEvent = CustomEvent_2<CameraModifiedEventDetail>;
Expand Down Expand Up @@ -1176,6 +1176,8 @@ type CPUIImageData = {
scalarData: PixelDataTypedArray;
scaling: Scaling;
hasPixelSpacing?: boolean;
calibration?: IImageCalibration;

preScale?: {
scaled?: boolean;
scalingParameters?: {
Expand Down Expand Up @@ -2496,8 +2498,22 @@ interface IImage {
windowWidth: number[] | number;
}

// @public
interface IImageCalibration {
aspect?: number;
// (undocumented)
columnPixelSpacing?: number;
rowPixelSpacing?: number;
scale?: number;
sequenceOfUltrasoundRegions?: Record<string, unknown>[];
tooltip?: string;
type: CalibrationTypes;
}

// @public
interface IImageData {
// (undocumented)
calibration?: IImageCalibration;
dimensions: Point3;
direction: Mat3;
hasPixelSpacing?: boolean;
Expand Down Expand Up @@ -2709,8 +2725,7 @@ type ImageSpacingCalibratedEventDetail = {
viewportId: string;
renderingEngineId: string;
imageId: string;
rowScale: number;
columnScale: number;
calibration: IImageCalibration;
imageData: vtkImageData;
worldToIndex: mat4;
};
Expand Down Expand Up @@ -4353,6 +4368,9 @@ function resetElementCursor(element: HTMLDivElement): void;
// @public
type RGB = [number, number, number];

// @public (undocumented)
function roundNumber(value: string | number, precision?: number): string;

// @public (undocumented)
interface ScaleOverlayAnnotation extends Annotation {
// (undocumented)
Expand Down Expand Up @@ -5367,7 +5385,8 @@ declare namespace utilities {
rectangleROITool,
planarFreehandROITool,
stackPrefetch,
scroll_2 as scroll
scroll_2 as scroll,
roundNumber
}
}
export { utilities }
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"postcss": "^8.4.23",
"prettier": "^2.8.8",
"puppeteer": "^13.5.0",
"resemblejs": "^4.1.0",
"resemblejs": "^5.0.0",
"rollup": "^3.21.3",
"shader-loader": "^1.3.1",
"shelljs": "^0.8.5",
Expand Down Expand Up @@ -159,5 +159,7 @@
"not ie < 11",
"not op_mini all"
],
"dependencies": {}
"dependencies": {},
"resolutions": {
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Segmentation from "./Segmentation.js";
import Segmentation from "./Segmentation";

const VTKjs = {
Segmentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import VTKjs from "./VTKjs";
const adapters = {
Cornerstone,
Cornerstone3D,
VTKjs,
VTKjs
};

export default adapters;
Loading

0 comments on commit 0aafbc2

Please sign in to comment.