Skip to content

Commit a1fd3f9

Browse files
authored
feat: Add key image adapters for key image point mark (#1754)
1 parent 6edb49c commit a1fd3f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1269
-816
lines changed

.circleci/config.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ jobs:
4040
- run: bun install
4141
- persist_to_workspace:
4242
root: ~/repo
43-
paths: .
43+
paths:
44+
- "."
4445

4546
BUILD:
4647
<<: *defaults
@@ -64,22 +65,6 @@ jobs:
6465
- commit.txt
6566
- version.json
6667

67-
API_CHECK:
68-
<<: *defaults
69-
steps:
70-
- attach_workspace:
71-
at: ~/repo
72-
- install_bun
73-
- run: bun install -d ajv
74-
- run: bun run api-check
75-
FORMAT_CHECK:
76-
<<: *defaults
77-
steps:
78-
- attach_workspace:
79-
at: ~/repo
80-
- install_bun
81-
- run: bun run format-check
82-
8368
# https://circleci.com/docs/2.0/collect-test-data/#karma
8469
TEST:
8570
<<: *defaults
@@ -117,7 +102,8 @@ jobs:
117102
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking
118103
no\n" > ~/.ssh/config
119104
- add_ssh_keys:
120-
fingerprints: 7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2
105+
fingerprints:
106+
- "7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2"
121107
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
122108
- run: git config --global user.email "[email protected]"
123109
- run: git config --global user.name "ohif-bot"
@@ -150,12 +136,6 @@ workflows:
150136
- BUILD:
151137
requires:
152138
- CHECKOUT
153-
- FORMAT_CHECK:
154-
requires:
155-
- BUILD
156-
- API_CHECK:
157-
requires:
158-
- BUILD
159139
- TEST:
160140
requires:
161141
- CHECKOUT # TODO: Also require build?

.eslintrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@
5555
"tsconfigRootDir": "./",
5656
"warnOnUnsupportedTypeScriptVersion": false
5757
},
58-
"ignorePatterns": ["packages/docs", "dist", "**/*_test.js", "**/*_jest.js", "**/*babel*", "**/*.d.ts", "**/*_types.ts"],
58+
"ignorePatterns": [
59+
"packages/docs",
60+
"dist",
61+
"**/*_test.js",
62+
"**/*_jest.js",
63+
"**/*babel*",
64+
"**/*.d.ts",
65+
"**/*_types.ts"
66+
],
5967
"rules": {
6068
"import/no-cycle": ["error", { "maxDepth": 15 }],
6169
// Enforce consistent brace style for all control statements for readability

.github/workflows/format-check.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Format Check
2+
3+
on:
4+
pull_request:
5+
branches: [ '*' ]
6+
push:
7+
branches: [ main, beta ]
8+
9+
jobs:
10+
format-check:
11+
timeout-minutes: 30
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20.18.1'
22+
cache: 'npm'
23+
24+
- name: Setup Bun
25+
uses: oven-sh/setup-bun@v2
26+
with:
27+
bun-version: latest
28+
29+
- name: Install dependencies
30+
run: bun install
31+
32+
- name: Build dependencies
33+
run: bun run build:esm
34+
35+
- name: Run format check
36+
run: bun run format-check
37+
env:
38+
NODE_OPTIONS: --max_old_space_size=32896

bun.lock

Lines changed: 42 additions & 23 deletions
Large diffs are not rendered by default.

common/reviews/api/tools.api.md

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,10 @@ type AnnotationLockChangeEventType = Types_2.CustomEventType<AnnotationLockChang
405405

406406
// @public (undocumented)
407407
type AnnotationModifiedEventDetail = {
408-
viewportId: string;
409-
renderingEngineId: string;
410408
annotation: Annotation;
411409
changeType?: ChangeTypes;
410+
viewportId?: string;
411+
renderingEngineId?: string;
412412
};
413413

414414
// @public (undocumented)
@@ -553,6 +553,20 @@ export abstract class AnnotationTool extends AnnotationDisplayTool {
553553
// (undocumented)
554554
protected createMemo(element: any, annotation: any, options?: any): void;
555555
// (undocumented)
556+
editData: {
557+
annotation: Annotation;
558+
viewportIdsToRender?: string[];
559+
newAnnotation?: boolean;
560+
handleIndex?: number;
561+
movingTextBox?: boolean;
562+
hasMoved?: boolean;
563+
} | null;
564+
// (undocumented)
565+
protected eventDispatchDetail: {
566+
viewportId: string;
567+
renderingEngineId: string;
568+
};
569+
// (undocumented)
556570
protected getAnnotationStyle(context: {
557571
annotation: Annotation;
558572
styleSpecifier: StyleSpecifier;
@@ -564,6 +578,10 @@ export abstract class AnnotationTool extends AnnotationDisplayTool {
564578
// (undocumented)
565579
abstract handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle, interactionType: InteractionTypes): void;
566580
// (undocumented)
581+
isDrawing: boolean;
582+
// (undocumented)
583+
isHandleOutsideImage: boolean;
584+
// (undocumented)
567585
abstract isPointNearTool(element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number, interactionType: string): boolean;
568586
// (undocumented)
569587
static isSuvScaled(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, targetId: string, imageId?: string): boolean;
@@ -1837,10 +1855,6 @@ export class CrosshairsTool extends AnnotationTool {
18371855
// (undocumented)
18381856
_dragCallback: (evt: EventTypes_2.InteractionEventType) => void;
18391857
// (undocumented)
1840-
editData: {
1841-
annotation: Annotation;
1842-
} | null;
1843-
// (undocumented)
18441858
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
18451859
// (undocumented)
18461860
_filterAnnotationsByUniqueViewportOrientations: (enabledElement: any, annotations: any) => any[];
@@ -3446,45 +3460,56 @@ type KeyDownEventDetail = {
34463460
// @public (undocumented)
34473461
type KeyDownEventType = Types_2.CustomEventType<KeyDownEventDetail>;
34483462

3463+
// @public (undocumented)
3464+
type KeyImageAnnotation = ProbeAnnotation & {
3465+
data: {
3466+
isPoint: boolean;
3467+
seriesLevel: boolean;
3468+
};
3469+
};
3470+
34493471
// @public (undocumented)
34503472
export class KeyImageTool extends AnnotationTool {
34513473
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
34523474
// (undocumented)
3453-
_activateModify: (element: HTMLDivElement) => void;
3475+
_activateModify: (element: any) => void;
34543476
// (undocumented)
34553477
addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => Annotation;
34563478
// (undocumented)
3457-
cancel(): void;
3479+
cancel(element: HTMLDivElement): string;
34583480
// (undocumented)
3459-
_deactivateModify: (element: HTMLDivElement) => void;
3481+
static dataPoint: {
3482+
data: {
3483+
isPoint: boolean;
3484+
};
3485+
};
3486+
// (undocumented)
3487+
static dataSeries: {
3488+
data: {
3489+
seriesLevel: boolean;
3490+
};
3491+
};
3492+
// (undocumented)
3493+
_deactivateModify: (element: any) => void;
34603494
// (undocumented)
34613495
_doneChangingTextCallback(element: any, annotation: any, updatedText: any): void;
34623496
// (undocumented)
34633497
doubleClickCallback: (evt: EventTypes_2.TouchTapEventType) => void;
34643498
// (undocumented)
3465-
editData: {
3466-
annotation: Annotation;
3467-
viewportIdsToRender: string[];
3468-
handleIndex?: number;
3469-
movingTextBox?: boolean;
3470-
newAnnotation?: boolean;
3471-
hasMoved?: boolean;
3472-
} | null;
3499+
_dragCallback: (evt: any) => void;
34733500
// (undocumented)
34743501
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
34753502
// (undocumented)
3476-
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle): void;
3477-
// (undocumented)
3478-
isDrawing: boolean;
3479-
// (undocumented)
3480-
isHandleOutsideImage: boolean;
3503+
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: KeyImageAnnotation): void;
34813504
// (undocumented)
34823505
_isInsideVolume(index1: any, index2: any, dimensions: any): boolean;
34833506
// (undocumented)
34843507
isPointNearTool: (element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number) => boolean;
34853508
// (undocumented)
34863509
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
34873510
// (undocumented)
3511+
static setPoint(annotation: any, isPoint?: boolean, element?: any): void;
3512+
// (undocumented)
34883513
_throttledCalculateCachedStats: Function;
34893514
// (undocumented)
34903515
static toolName: string;
@@ -4506,19 +4531,8 @@ export class ProbeTool extends AnnotationTool {
45064531
// (undocumented)
45074532
_dragCallback: (evt: any) => void;
45084533
// (undocumented)
4509-
editData: {
4510-
annotation: Annotation;
4511-
viewportIdsToRender: string[];
4512-
newAnnotation?: boolean;
4513-
} | null;
4514-
// (undocumented)
45154534
_endCallback: (evt: EventTypes_2.InteractionEventType) => void;
45164535
// (undocumented)
4517-
eventDispatchDetail: {
4518-
viewportId: string;
4519-
renderingEngineId: string;
4520-
};
4521-
// (undocumented)
45224536
getHandleNearImagePoint(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): ToolHandle | undefined;
45234537
// (undocumented)
45244538
handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: ProbeAnnotation): void;
@@ -4527,10 +4541,6 @@ export class ProbeTool extends AnnotationTool {
45274541
annotationUID?: string;
45284542
}) => ProbeAnnotation;
45294543
// (undocumented)
4530-
isDrawing: boolean;
4531-
// (undocumented)
4532-
isHandleOutsideImage: boolean;
4533-
// (undocumented)
45344544
isPointNearTool(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): boolean;
45354545
// (undocumented)
45364546
static probeDefaults: {
@@ -6388,6 +6398,7 @@ declare namespace ToolSpecificAnnotationTypes {
63886398
ROICachedStats,
63896399
RectangleROIAnnotation,
63906400
ProbeAnnotation,
6401+
KeyImageAnnotation,
63916402
LengthAnnotation,
63926403
AdvancedMagnifyAnnotation,
63936404
CircleROIAnnotation,

jest.config.base.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ module.exports = {
1818
// Setup
1919
// setupFiles: ["jest-canvas-mock/lib/index.js"],
2020
// Coverage
21+
transform: {
22+
'^.+\\.(js|jsx|ts|tsx)$': [
23+
'babel-jest',
24+
{
25+
plugins: ['babel-plugin-transform-import-meta'],
26+
},
27+
],
28+
},
2129
collectCoverageFrom: [
2230
'<rootDir>/src/**/*.{js,jsx}',
2331
// Not

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"scripts": {
1717
"api-check": "npx lerna run api-check",
18-
"format-check": "npx lerna run format-check",
18+
"format-check": "cross-env NODE_OPTIONS=--max_old_space_size=32896 npx lerna run format-check",
1919
"build": "npx lerna run build --stream && npx lerna run build:loader",
2020
"build:esm": "npx lerna run build:esm --stream",
2121
"watch": "npx lerna watch -- lerna run build --scope=$LERNA_PACKAGE_NAME --include-dependents",
@@ -26,7 +26,7 @@
2626
"build:update-api:tools": "cd packages/tools && npm run build:update-api",
2727
"build:update-api:nifti": "cd packages/nifti-volume-loader && npm run build:update-api",
2828
"build:update-api:dicomImageLoader": "cd packages/dicomImageLoader && npm run build:update-api",
29-
"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",
29+
"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",
3030
"clean": "npx lerna run clean --stream",
3131
"clean:deep": "npx lerna run clean:deep --stream",
3232
"example": "node ./utils/ExampleRunner/example-runner-cli.js",
@@ -97,6 +97,7 @@
9797
"autoprefixer": "^10.4.14",
9898
"babel-loader": "9.1.2",
9999
"babel-plugin-istanbul": "^6.1.1",
100+
"babel-plugin-transform-import-meta": "2.3.2",
100101
"chai": "^5.1.2",
101102
"clean-webpack-plugin": "^4.0.0",
102103
"commander": "^10.0.1",

packages/adapters/.babelrc

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)