Skip to content

Commit

Permalink
feat: Add key image adapters for key image point mark (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 authored Feb 27, 2025
1 parent 6edb49c commit a1fd3f9
Show file tree
Hide file tree
Showing 47 changed files with 1,269 additions and 816 deletions.
28 changes: 4 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
- run: bun install
- persist_to_workspace:
root: ~/repo
paths: .
paths:
- "."

BUILD:
<<: *defaults
Expand All @@ -64,22 +65,6 @@ jobs:
- commit.txt
- version.json

API_CHECK:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- install_bun
- run: bun install -d ajv
- run: bun run api-check
FORMAT_CHECK:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- install_bun
- run: bun run format-check

# https://circleci.com/docs/2.0/collect-test-data/#karma
TEST:
<<: *defaults
Expand Down Expand Up @@ -117,7 +102,8 @@ jobs:
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking
no\n" > ~/.ssh/config
- add_ssh_keys:
fingerprints: 7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2
fingerprints:
- "7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2"
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ohif-bot"
Expand Down Expand Up @@ -150,12 +136,6 @@ workflows:
- BUILD:
requires:
- CHECKOUT
- FORMAT_CHECK:
requires:
- BUILD
- API_CHECK:
requires:
- BUILD
- TEST:
requires:
- CHECKOUT # TODO: Also require build?
Expand Down
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@
"tsconfigRootDir": "./",
"warnOnUnsupportedTypeScriptVersion": false
},
"ignorePatterns": ["packages/docs", "dist", "**/*_test.js", "**/*_jest.js", "**/*babel*", "**/*.d.ts", "**/*_types.ts"],
"ignorePatterns": [
"packages/docs",
"dist",
"**/*_test.js",
"**/*_jest.js",
"**/*babel*",
"**/*.d.ts",
"**/*_types.ts"
],
"rules": {
"import/no-cycle": ["error", { "maxDepth": 15 }],
// Enforce consistent brace style for all control statements for readability
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Format Check

on:
pull_request:
branches: [ '*' ]
push:
branches: [ main, beta ]

jobs:
format-check:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
cache: 'npm'

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Build dependencies
run: bun run build:esm

- name: Run format check
run: bun run format-check
env:
NODE_OPTIONS: --max_old_space_size=32896
65 changes: 42 additions & 23 deletions bun.lock

Large diffs are not rendered by default.

85 changes: 48 additions & 37 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ type AnnotationLockChangeEventType = Types_2.CustomEventType<AnnotationLockChang

// @public (undocumented)
type AnnotationModifiedEventDetail = {
viewportId: string;
renderingEngineId: string;
annotation: Annotation;
changeType?: ChangeTypes;
viewportId?: string;
renderingEngineId?: string;
};

// @public (undocumented)
Expand Down Expand Up @@ -553,6 +553,20 @@ export abstract class AnnotationTool extends AnnotationDisplayTool {
// (undocumented)
protected createMemo(element: any, annotation: any, options?: any): void;
// (undocumented)
editData: {
annotation: Annotation;
viewportIdsToRender?: string[];
newAnnotation?: boolean;
handleIndex?: number;
movingTextBox?: boolean;
hasMoved?: boolean;
} | null;
// (undocumented)
protected eventDispatchDetail: {
viewportId: string;
renderingEngineId: string;
};
// (undocumented)
protected getAnnotationStyle(context: {
annotation: Annotation;
styleSpecifier: StyleSpecifier;
Expand All @@ -564,6 +578,10 @@ export abstract class AnnotationTool extends AnnotationDisplayTool {
// (undocumented)
abstract handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle, interactionType: InteractionTypes): void;
// (undocumented)
isDrawing: boolean;
// (undocumented)
isHandleOutsideImage: boolean;
// (undocumented)
abstract isPointNearTool(element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number, interactionType: string): boolean;
// (undocumented)
static isSuvScaled(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, targetId: string, imageId?: string): boolean;
Expand Down Expand Up @@ -1837,10 +1855,6 @@ export class CrosshairsTool extends AnnotationTool {
// (undocumented)
_dragCallback: (evt: EventTypes_2.InteractionEventType) => void;
// (undocumented)
editData: {
annotation: Annotation;
} | null;
// (undocumented)
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
// (undocumented)
_filterAnnotationsByUniqueViewportOrientations: (enabledElement: any, annotations: any) => any[];
Expand Down Expand Up @@ -3446,45 +3460,56 @@ type KeyDownEventDetail = {
// @public (undocumented)
type KeyDownEventType = Types_2.CustomEventType<KeyDownEventDetail>;

// @public (undocumented)
type KeyImageAnnotation = ProbeAnnotation & {
data: {
isPoint: boolean;
seriesLevel: boolean;
};
};

// @public (undocumented)
export class KeyImageTool extends AnnotationTool {
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
// (undocumented)
_activateModify: (element: HTMLDivElement) => void;
_activateModify: (element: any) => void;
// (undocumented)
addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => Annotation;
// (undocumented)
cancel(): void;
cancel(element: HTMLDivElement): string;
// (undocumented)
_deactivateModify: (element: HTMLDivElement) => void;
static dataPoint: {
data: {
isPoint: boolean;
};
};
// (undocumented)
static dataSeries: {
data: {
seriesLevel: boolean;
};
};
// (undocumented)
_deactivateModify: (element: any) => void;
// (undocumented)
_doneChangingTextCallback(element: any, annotation: any, updatedText: any): void;
// (undocumented)
doubleClickCallback: (evt: EventTypes_2.TouchTapEventType) => void;
// (undocumented)
editData: {
annotation: Annotation;
viewportIdsToRender: string[];
handleIndex?: number;
movingTextBox?: boolean;
newAnnotation?: boolean;
hasMoved?: boolean;
} | null;
_dragCallback: (evt: any) => void;
// (undocumented)
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
// (undocumented)
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle): void;
// (undocumented)
isDrawing: boolean;
// (undocumented)
isHandleOutsideImage: boolean;
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: KeyImageAnnotation): void;
// (undocumented)
_isInsideVolume(index1: any, index2: any, dimensions: any): boolean;
// (undocumented)
isPointNearTool: (element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number) => boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
static setPoint(annotation: any, isPoint?: boolean, element?: any): void;
// (undocumented)
_throttledCalculateCachedStats: Function;
// (undocumented)
static toolName: string;
Expand Down Expand Up @@ -4506,19 +4531,8 @@ export class ProbeTool extends AnnotationTool {
// (undocumented)
_dragCallback: (evt: any) => void;
// (undocumented)
editData: {
annotation: Annotation;
viewportIdsToRender: string[];
newAnnotation?: boolean;
} | null;
// (undocumented)
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
// (undocumented)
eventDispatchDetail: {
viewportId: string;
renderingEngineId: string;
};
// (undocumented)
getHandleNearImagePoint(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): ToolHandle | undefined;
// (undocumented)
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: ProbeAnnotation): void;
Expand All @@ -4527,10 +4541,6 @@ export class ProbeTool extends AnnotationTool {
annotationUID?: string;
}) => ProbeAnnotation;
// (undocumented)
isDrawing: boolean;
// (undocumented)
isHandleOutsideImage: boolean;
// (undocumented)
isPointNearTool(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): boolean;
// (undocumented)
static probeDefaults: {
Expand Down Expand Up @@ -6388,6 +6398,7 @@ declare namespace ToolSpecificAnnotationTypes {
ROICachedStats,
RectangleROIAnnotation,
ProbeAnnotation,
KeyImageAnnotation,
LengthAnnotation,
AdvancedMagnifyAnnotation,
CircleROIAnnotation,
Expand Down
8 changes: 8 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ module.exports = {
// Setup
// setupFiles: ["jest-canvas-mock/lib/index.js"],
// Coverage
transform: {
'^.+\\.(js|jsx|ts|tsx)$': [
'babel-jest',
{
plugins: ['babel-plugin-transform-import-meta'],
},
],
},
collectCoverageFrom: [
'<rootDir>/src/**/*.{js,jsx}',
// Not
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"api-check": "npx lerna run api-check",
"format-check": "npx lerna run format-check",
"format-check": "cross-env NODE_OPTIONS=--max_old_space_size=32896 npx lerna run format-check",
"build": "npx lerna run build --stream && npx lerna run build:loader",
"build:esm": "npx lerna run build:esm --stream",
"watch": "npx lerna watch -- lerna run build --scope=$LERNA_PACKAGE_NAME --include-dependents",
Expand All @@ -26,7 +26,7 @@
"build:update-api:tools": "cd packages/tools && npm run build:update-api",
"build:update-api:nifti": "cd packages/nifti-volume-loader && npm run build:update-api",
"build:update-api:dicomImageLoader": "cd packages/dicomImageLoader && npm run build:update-api",
"build:update-api": "npm run build && npm run build:update-api:ai && npm run build:update-api:core && npm run build:update-api:tools && npm run build:update-api:nifti && npm run build:update-api:dicomImageLoader && npm run build:update-api:labelmap-interpolation && npm run build:update-api:polymorphic-segmentation",
"build:update-api": "npm run build && npm run build:update-api:ai && npm run build:update-api:core && npm run build:update-api:tools && npm run build:update-api:nifti && npm run build:update-api:dicomImageLoader",
"clean": "npx lerna run clean --stream",
"clean:deep": "npx lerna run clean:deep --stream",
"example": "node ./utils/ExampleRunner/example-runner-cli.js",
Expand Down Expand Up @@ -97,6 +97,7 @@
"autoprefixer": "^10.4.14",
"babel-loader": "9.1.2",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-transform-import-meta": "2.3.2",
"chai": "^5.1.2",
"clean-webpack-plugin": "^4.0.0",
"commander": "^10.0.1",
Expand Down
9 changes: 0 additions & 9 deletions packages/adapters/.babelrc

This file was deleted.

Loading

0 comments on commit a1fd3f9

Please sign in to comment.