Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(annotations): Annotations styles hardening #3

Draft
wants to merge 233 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
5282db9
Convert DS and IS values to numbers
hackermd Nov 1, 2020
5c7296a
wip
igoroctaviano Nov 10, 2020
f259754
Add new function to add map overlays
igoroctaviano Nov 5, 2020
b65ecfe
Merge pull request #41 from igoroctaviano/feat/add-option-to-add-overlay
hackermd Nov 10, 2020
3c95679
Refactor the length geometry and improve length tool to have draggabl…
igoroctaviano Nov 11, 2020
19fd555
Update color
igoroctaviano Nov 11, 2020
42aff54
Improve documentation
igoroctaviano Nov 11, 2020
3749297
Refactor annotations structure and add arrow
igoroctaviano Nov 17, 2020
647237f
Refactor modify options override
igoroctaviano Nov 18, 2020
3fad4d7
Fix docstrings
hackermd Nov 23, 2020
0862326
Update package version
hackermd Nov 23, 2020
1ead560
Merge branch 'master' of github:mghcomputationalpathology/dicom-micro…
hackermd Nov 23, 2020
7ad7ee7
Add ability to add custom props for custom geometries
igoroctaviano Nov 23, 2020
3945a92
Render stored length
igoroctaviano Nov 23, 2020
c2be5d0
Update arrow labels
igoroctaviano Nov 23, 2020
e559ed4
Add better init for geometries
igoroctaviano Nov 24, 2020
ef6c023
Consolidate tools interactions
igoroctaviano Nov 24, 2020
138cdcc
Add freetext
igoroctaviano Nov 24, 2020
89c5387
Fix override of styles
igoroctaviano Nov 24, 2020
7b8073d
Refactor default styles
igoroctaviano Nov 24, 2020
f2c03ac
Fix freetext styles
igoroctaviano Nov 24, 2020
d98a3bf
Update marker class logic
igoroctaviano Nov 24, 2020
569fe10
Update marker class logic
igoroctaviano Nov 24, 2020
21c6c71
disable marker for freetext
igoroctaviano Nov 24, 2020
15770c2
Allow overview zoom configuration
igoroctaviano Nov 24, 2020
f311c40
Update svg to arrow
igoroctaviano Nov 26, 2020
9b8887d
Fix link removal
igoroctaviano Nov 26, 2020
024bd0a
Add offset to marker
igoroctaviano Nov 26, 2020
88597a9
Add dyamic suffix unit
igoroctaviano Nov 27, 2020
8ca5d86
Support adding roi measurements and evaluations
hackermd Nov 29, 2020
ada78d0
Update documentation
hackermd Nov 29, 2020
d0bff80
Fix adding props when feature was autopopulated
hackermd Nov 29, 2020
af87d6e
Add docs and update marker manager to handle only features
igoroctaviano Nov 30, 2020
d2fb8d9
Remove marker on update length
igoroctaviano Nov 30, 2020
5f98d14
Add docsa
igoroctaviano Nov 30, 2020
6dd55a6
Remove unbind events to work with multiple viewports
igoroctaviano Nov 30, 2020
c281308
Fix styling issues on drawend
igoroctaviano Nov 30, 2020
b7dce52
Fix styles override
igoroctaviano Nov 30, 2020
cb53f9d
Use instances to allow muliple viewports of the same annotations
igoroctaviano Nov 30, 2020
1cc3827
Remove unused logic
igoroctaviano Nov 30, 2020
94fce11
Remove log statement
hackermd Dec 1, 2020
d75c89f
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Dec 7, 2020
0d4a18e
Add ability to style region of interest geometries
hackermd Dec 7, 2020
4f75f39
Refactor viewer tests
hackermd Dec 7, 2020
00c42dd
Add metadata class for structured report documents
hackermd Dec 7, 2020
bc40014
Refactor coordinate mapping and add unit tests
hackermd Dec 11, 2020
4bf573d
Update package version and fix vulnerabilities
hackermd Dec 11, 2020
fea288a
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Dec 21, 2020
7ba310f
CR Update: Refactor naming to markers and refactoring styling
igoroctaviano Dec 21, 2020
83519c7
CR Update: Lock versions
igoroctaviano Dec 21, 2020
6f3f3fb
CR Update: Update overview options
igoroctaviano Dec 21, 2020
9fff804
CR Update: Generalize length to measurement for polygons and circles
igoroctaviano Dec 21, 2020
ef658d0
CR Update: Update arrow to work for lines and points
igoroctaviano Dec 22, 2020
343eeeb
CR Update: Generate evaluations and measurements
igoroctaviano Dec 22, 2020
76aa18d
Separate markups and markers, format code
igoroctaviano Jan 25, 2021
9582aaf
Move to annotation manager, update naming/semantics
igoroctaviano Jan 25, 2021
044b5d6
Avoid using viewer specifics in markers/markup logic
igoroctaviano Jan 25, 2021
14767d3
Improve getstylefunction for markups and markers
igoroctaviano Jan 25, 2021
dc1212c
Add roi style options
igoroctaviano Jan 26, 2021
cb7268e
Refactor markers and remove builtin styles
igoroctaviano Jan 26, 2021
fbe2507
Simplify styling
igoroctaviano Jan 28, 2021
6451a73
Add content types for measurements and evaluations
igoroctaviano Feb 2, 2021
3240c39
Add freetext textcontentitem
igoroctaviano Feb 2, 2021
da58d3f
Allow styles to be controlled by internal ui components
igoroctaviano Feb 4, 2021
0f3037e
Update docs and remove unused events
igoroctaviano Feb 22, 2021
1c708f8
Extract common style logic
igoroctaviano Feb 22, 2021
3d3286c
Add conditional binding from james PR
igoroctaviano Feb 24, 2021
bb0b14a
Lock versions
igoroctaviano Feb 24, 2021
cbeac84
CR Update 1/2: Update naming, style logic, add new enums
igoroctaviano Mar 5, 2021
10abc8d
Resolve multiple dragPan issue
igoroctaviano Mar 8, 2021
80693c9
Comment multiple interactions issue
igoroctaviano Mar 8, 2021
fc1acc9
Create enum for internal measurement properties
igoroctaviano Mar 8, 2021
bf4c3ff
Update check/compare functions for coded concepts
igoroctaviano Mar 8, 2021
21fc417
add jest config
igoroctaviano Mar 8, 2021
0d81c55
Move logic from annotation manager to viewer
igoroctaviano Mar 8, 2021
a69d48e
Lock versions
igoroctaviano Mar 8, 2021
2b1501f
Extract util
igoroctaviano Mar 8, 2021
42bdb29
Add method to protect roi properties updates
igoroctaviano Mar 8, 2021
b4c833f
Update jsdocs for _addROIPropertiesToFeature
igoroctaviano Mar 8, 2021
216e690
Update annotation manager tests
igoroctaviano Mar 9, 2021
ed096a1
Add create tests for markup manager
igoroctaviano Mar 9, 2021
d5069ee
Update dcmjs
igoroctaviano Mar 9, 2021
598721a
Use enums for internal properties
igoroctaviano Mar 11, 2021
fd80cb7
Add annotations examples
igoroctaviano Mar 11, 2021
7e9b66b
Add toggable overview map
igoroctaviano Mar 18, 2021
f8bef15
Add offset and absolute icons
igoroctaviano Mar 19, 2021
1fe4ebd
Resolve offset and add new arrow line tool
igoroctaviano Mar 19, 2021
659b6f5
Avoid scaling arrow line and fix styling order
igoroctaviano Mar 19, 2021
2c518dd
Add jsdocs
igoroctaviano Mar 19, 2021
bdd8d18
Handle failing annotations
igoroctaviano Mar 22, 2021
e4fb061
Address CR items
igoroctaviano Apr 8, 2021
0e2ea0b
Fix SR
igoroctaviano Apr 15, 2021
675cec5
Remove code that updates length and area and use native
igoroctaviano Apr 16, 2021
98eb33f
Fix circle problem + update sr pairs order
igoroctaviano Apr 16, 2021
e126bfd
CR Update: add draw abort
igoroctaviano Apr 16, 2021
23623b4
CR Update: Ignore sr generation if not correct type
igoroctaviano Apr 16, 2021
fc32d5d
Scale arrow
igoroctaviano Apr 22, 2021
2d993e7
Changing main source file to allow remote git dependency usage
igoroctaviano Apr 22, 2021
3569249
Use build
igoroctaviano Apr 22, 2021
5b8a5e0
Use local pointer
igoroctaviano Apr 22, 2021
8d4cbed
Use scoord coordinates to get area and length
igoroctaviano Apr 23, 2021
78ef7c6
Fix color highlight
igoroctaviano Apr 27, 2021
9ef31c7
Use correct build file
igoroctaviano Apr 27, 2021
aaa61d1
Increase tooltip visibility
igoroctaviano Apr 27, 2021
60a0775
Merge branch 'annotations-3' of github.com:RadicalImaging/dicom-micro…
igoroctaviano Apr 27, 2021
1100400
Include presentation state
igoroctaviano Apr 28, 2021
7737bca
Resolve remaining CR discussions
igoroctaviano Apr 30, 2021
16a48b7
Merge branch 'feat/annotations' of git://github.com/igoroctaviano/dic…
igoroctaviano Apr 30, 2021
e657d78
Update package path
igoroctaviano Apr 30, 2021
43b0544
Update hide and show visibility for annotations
igoroctaviano May 3, 2021
c5bb395
Update unit
igoroctaviano May 3, 2021
2dca8f6
Merge branch 'feat/annotations' of git://github.com/igoroctaviano/dic…
igoroctaviano May 3, 2021
f2045f2
Feat: Scoord markers & markups. (#43)
igoroctaviano May 5, 2021
7494a6c
Bump elliptic from 6.5.3 to 6.5.4 (#48)
dependabot[bot] May 5, 2021
f615bf0
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano May 5, 2021
0573b18
Update package lock
igoroctaviano May 5, 2021
2490366
Update package lock file
hackermd May 5, 2021
654eb8b
Update documentation
hackermd May 5, 2021
650e33b
Fix unit tests
hackermd May 6, 2021
7b60554
Fix docstrings
hackermd May 6, 2021
8fa34a8
Add contribution file
hackermd May 6, 2021
b4d0ecc
Update package dependencies and scripts
hackermd May 6, 2021
7d22998
ENH: multi channels API, coloring and blending (#47)
Punzo May 6, 2021
1ec4138
Minor improvements to example scripts
hackermd May 7, 2021
8dc0557
Update documentation
hackermd May 7, 2021
2a31ad4
Update package version
hackermd May 7, 2021
bbf9219
Bump mathjs from 7.1.0 to 7.5.1 (#50)
dependabot[bot] May 12, 2021
de997e4
Bump hosted-git-info from 2.8.8 to 2.8.9 (#49)
dependabot[bot] May 12, 2021
a4da4d7
Merge branch 'master' of github:mghcomputationalpathology/dicom-micro…
hackermd May 12, 2021
7a959ed
Fix measurement calculation
igoroctaviano May 13, 2021
e517ccb
Resolve axis ellipse error
igoroctaviano May 13, 2021
3301f8d
Fix handling of channels and viewport layout
hackermd May 17, 2021
b9d299b
Fix measurement calculation (#53)
igoroctaviano May 17, 2021
2811083
Add text shadow
igoroctaviano May 18, 2021
b166648
Do not contrain extent of view
hackermd May 18, 2021
7fcebb4
Increase package version
hackermd May 18, 2021
e9a810a
Fix calculation of line length
hackermd May 18, 2021
a075372
Ensure the view is fitted prior to rendering
hackermd May 19, 2021
1b55567
Update documentation
hackermd May 19, 2021
68fb362
Fix roi visibility issue when creating rois with visibility hidden
igoroctaviano May 24, 2021
3b6b5af
fixes (#54)
Punzo Jun 17, 2021
4030454
fix RGB image grouping function (#56)
Punzo Jul 23, 2021
04b64da
Update OpenLayer to version 6.6.1 (#57)
Punzo Jul 26, 2021
3300df7
Fix documentation in CONTRIBUTING file
hackermd Aug 4, 2021
d86267f
Fix coding style issues
hackermd Aug 4, 2021
f05cfa6
Update API docs
hackermd Aug 4, 2021
fb41c5f
Update package version
hackermd Aug 4, 2021
a3ec109
Update travis configuration
hackermd Aug 4, 2021
5d46348
Update travis configuration to use latest nodejs
hackermd Aug 4, 2021
225bf67
Fix unit test for blending information
hackermd Aug 4, 2021
8d9a779
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Aug 4, 2021
f7269a5
#58: Update to use single test framework & fix broken test (#60)
igoroctaviano Aug 5, 2021
173af03
Update travis configuration for jest test framework
hackermd Aug 5, 2021
20ca619
Update documentation for release
hackermd Aug 5, 2021
cf2c03a
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Aug 6, 2021
6ac0372
Fix merge problems
igoroctaviano Aug 6, 2021
1607859
Handle area and length calc exceptions (#61)
igoroctaviano Aug 9, 2021
c86b662
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Aug 9, 2021
8ea1a45
Allow viewer construction with formatted metadata
hackermd Aug 10, 2021
4c24b1e
Update api docs
hackermd Aug 10, 2021
3ca1ee9
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Aug 10, 2021
d253914
Fix bug related to taking measurements
hackermd Aug 10, 2021
baba885
Handle area and length calc exceptions (Update) (#62)
igoroctaviano Aug 10, 2021
a91f764
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Aug 10, 2021
71aa48d
Only include "viewport" query parameter when needed (#64)
hackermd Aug 16, 2021
370799e
Fixed some error reporting and handle a couple of missing data cases …
wayfarer3130 Sep 3, 2021
782e69b
Initial set of fixes for FUBerlin microscopy display
wayfarer3130 Sep 15, 2021
69eef20
Update to OpenLayers 6.7.0 (#65)
Punzo Sep 15, 2021
dda02bd
Update package version and dependencies
hackermd Sep 15, 2021
7e6ed32
Prevent overview map from zooming (#66)
hackermd Sep 19, 2021
074672a
Increase package version for release
hackermd Sep 19, 2021
8dd8e51
Switched to use JPEG as primary and accurate copy, makes viewing far
wayfarer3130 Sep 27, 2021
6b6b004
Consider THUMBNAIL images part of image pyramid
hackermd Oct 6, 2021
d25a82e
Increase package version and update dependencies
hackermd Oct 6, 2021
ebb5f5b
Update docs
hackermd Oct 6, 2021
42938f1
Add basic bidirectional functionality
igoroctaviano Oct 8, 2021
6795915
Add math utils
igoroctaviano Oct 8, 2021
b5a8984
Remove dead code
igoroctaviano Oct 8, 2021
7964d37
Create util
igoroctaviano Oct 8, 2021
3494703
Update bidirectional functions
igoroctaviano Oct 8, 2021
d2cfdd8
Simplify code
igoroctaviano Oct 9, 2021
8f92f56
Update naming
igoroctaviano Oct 9, 2021
cf96a72
Simplify handle usage
igoroctaviano Oct 9, 2021
105f223
Update naming
igoroctaviano Oct 9, 2021
6f5b288
Update naming for handles
igoroctaviano Oct 9, 2021
9b16141
Resolve dragging issue of start handle
igoroctaviano Oct 9, 2021
f796ddc
Move files
igoroctaviano Oct 11, 2021
2ef5c8a
Update bidirectional labels properly
igoroctaviano Oct 11, 2021
19fb23a
Remove short axis if existent
igoroctaviano Oct 11, 2021
633aba0
Resolve dragging overlays conflicting with bidirectional and offset o…
igoroctaviano Oct 12, 2021
2deeb17
Split functions, simplify bidirectional file
igoroctaviano Oct 13, 2021
716c4c3
Extract handle index function
igoroctaviano Oct 13, 2021
903f747
Resolve multiple bidirectional dragging issue
igoroctaviano Oct 13, 2021
a1d7c59
Throw error if sizes of pyramid levels don't match
hackermd Oct 14, 2021
1eed2aa
wip
igoroctaviano Oct 14, 2021
9ecb59c
Toggle visibility per roi (#68)
igoroctaviano Oct 14, 2021
684c0ab
Only warn if slide coordinates are negative
hackermd Oct 14, 2021
072e7d7
Merge branch 'master' into bugfix/style-and-checks
hackermd Oct 14, 2021
b80e7ad
Disable re-centering of overviewmap
hackermd Oct 14, 2021
8b6646e
Hide annotation marker by default
hackermd Oct 14, 2021
37b0cc9
Fit overview map into control element
hackermd Oct 15, 2021
f180cde
Update package version and dependencies
hackermd Oct 15, 2021
13b65cf
Update documentation
hackermd Oct 15, 2021
d80f551
Account for rotation when fitting overview map
hackermd Oct 15, 2021
3e32874
Add ellipse tool
igoroctaviano Oct 15, 2021
14bb57b
Resolve intersection while dragging bidirectional
igoroctaviano Oct 18, 2021
ba11d01
Update subfeatures property and remove logs
igoroctaviano Oct 18, 2021
3e62729
Add check to get index only for bidirectionals
igoroctaviano Oct 18, 2021
2a5c6f0
WIP ellipse handles
igoroctaviano Oct 20, 2021
c48cf9f
Update implementation of ellipse to match cornerstone
igoroctaviano Oct 26, 2021
5b2e612
Resolve style issues
igoroctaviano Oct 26, 2021
d0d8cf9
Fix orientation of box in overview map
hackermd Oct 26, 2021
a8f6cf1
Fix styles and update enum
igoroctaviano Oct 26, 2021
4fd749c
Resolve dragging handle of elellipse issue
igoroctaviano Oct 26, 2021
156cb5f
Resolve build issues
igoroctaviano Oct 26, 2021
e196344
Fix multiple translate for ellipse
igoroctaviano Oct 26, 2021
98c2713
Fix translate for ellipse and bidirectional
igoroctaviano Oct 27, 2021
1614efb
Merge branch 'master' of github.com:MGHComputationalPathology/dicom-m…
igoroctaviano Oct 27, 2021
ceec37f
Refactor annotation manager and generate sr for bidirectional
igoroctaviano Oct 27, 2021
393a035
Fix negative coordinate bug (sr)
igoroctaviano Oct 27, 2021
042a6d9
Fix dragging issue with translate and add bidirectional sr
igoroctaviano Oct 27, 2021
59b193b
WIP ellipse sr + fix build errors
igoroctaviano Oct 27, 2021
303e247
Extract methods from ellipse and resolve markup issue
igoroctaviano Oct 28, 2021
4f01f0a
Fix ellipse SR
igoroctaviano Oct 28, 2021
b3445d9
Fix markup not appearing in first sr load
igoroctaviano Oct 28, 2021
743e40d
[Checkpoint]: Resolve normalized annotations
igoroctaviano Oct 28, 2021
ab86368
Fixed some error reporting and handle a couple of missing data cases …
wayfarer3130 Sep 3, 2021
7f62de4
Initial set of fixes for FUBerlin microscopy display
wayfarer3130 Sep 15, 2021
11e8288
Added a local version number
wayfarer3130 Nov 3, 2021
006ecbb
fix(dicom-microscopy-viewer):Fix the units display
wayfarer3130 Nov 24, 2021
7e4b92d
Merge pull request #6 from RadicalImaging/fix/units
igoroctaviano Nov 24, 2021
4f220d1
Fix hover/onAdd styles for bidirectional and ellipse
igoroctaviano Nov 25, 2021
6d3c98b
Fix text evaluation not draggable annotation
igoroctaviano Nov 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP ellipse sr + fix build errors
igoroctaviano committed Oct 27, 2021
commit 59b193bb4708d6e0b4b4ff153d6816a76ae120d0
12 changes: 8 additions & 4 deletions src/annotations/_AnnotationManager.js
Original file line number Diff line number Diff line change
@@ -90,6 +90,11 @@ class _AnnotationManager {
value: "G-A186",
schemeDesignator: "SRT",
}),
new dcmjs.sr.coding.CodedConcept({
meaning: "AREA",
value: "G-D7FE",
schemeDesignator: "SRT",
}),
];
const measurementCodedConcept =
getContentItemNameCodedConcept(measurement);
@@ -152,10 +157,9 @@ class _AnnotationManager {

getMeasurements(feature) {
/** Annotations */
return (
bidirectional.getMeasurements(feature, this.props) ||
ellipse.getMeasurements(feature, this.props)
);
return bidirectional
.getMeasurements(feature, this.props)
.concat(ellipse.getMeasurements(feature, this.props));
}

onAdd(feature) {
5 changes: 2 additions & 3 deletions src/annotations/markers/arrow.js
Original file line number Diff line number Diff line change
@@ -124,8 +124,7 @@ const _isArrow = (feature) =>
* @param {object} dependencies.markupManager Markup manager shared instance
*/
const ArrowMarker = ({ map, markupManager }) => {
return {
...annotationInterface,
return Object.assign({}, annotationInterface, {
onAdd: (feature) => {
if (_isArrow(feature)) {
_applyStyles(feature, map)
@@ -162,7 +161,7 @@ const ArrowMarker = ({ map, markupManager }) => {
markupManager.remove(uid)
}
},
}
})
}

export default ArrowMarker
7 changes: 3 additions & 4 deletions src/annotations/markups/bidirectional/bidirectional.js
Original file line number Diff line number Diff line change
@@ -216,8 +216,7 @@ const attachPointerEvents = (viewerProperties) => {
map.on(Enums.MapEvents.POINTER_DRAG, onPointerDragHandler);
};

const bidirectional = {
...annotationInterface,
const bidirectional = Object.assign({}, annotationInterface, {
onAdd: (feature, viewerProperties) => {
const { measurements } = feature.getProperties();
if (measurements && JSON.stringify(measurements).includes("Long Axis")) {
@@ -393,7 +392,7 @@ const bidirectional = {
longAxisFeature.set(Enums.InternalProperties.StyleOptions, styles);
}
}
},
};
}
})

export default bidirectional;
71 changes: 62 additions & 9 deletions src/annotations/markups/ellipse/ellipse.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import Enums from "../../../enums";
import Style from "ol/style/Style";
import Stroke from "ol/style/Stroke";
import dcmjs from "dcmjs";
import { fromCircle } from "ol/geom/Polygon";
import CircleGeometry from "ol/geom/Circle";
import { distance } from "../bidirectional/mathUtils";
import { Feature } from "ol";
import CircleStyle from "ol/style/Circle";
import Point from "ol/geom/Point";
import { getFeatureScoord3dArea } from "../../../scoord3dUtils";
import { getUnitSuffix } from "../../../utils";
import Fill from "ol/style/Fill";
import RegularShape from "ol/style/RegularShape";

import Enums from "../../../enums";
import { distance } from "../bidirectional/mathUtils";
import { getFeatureScoord3dArea } from "../../../scoord3dUtils";
import { getUnitSuffix } from "../../../utils";
import annotationInterface from "../../annotationInterface";
import { getEllipseHandlesId, getEllipseId } from "./id";

@@ -277,8 +279,7 @@ const getChangeEvent = (viewerProperties) => {
};
};

const ellipse = {
...annotationInterface,
const ellipse = Object.assign({}, annotationInterface, {
onAdd: (feature, viewerProperties) => {
const { markupManager, drawingSource } = viewerProperties;
const { isEllipseHandles } = feature.getProperties();
@@ -353,8 +354,60 @@ const ellipse = {
markupManager.remove(ellipseHandlesFeature.getId());
}
},
getMeasurements: feature => {
// todo
getMeasurements: (feature, viewerProperties) => {
const { drawingSource, pyramid } = viewerProperties;

const { isEllipseHandles, isEllipseShape } =
feature.getProperties();
const isEllipse = isEllipseHandles || isEllipseShape;

if (isEllipse) {
let ellipseHandlesFeature;
let ellipseFeature;
let points = [];
let area = 0;

if (ellipseHandlesFeature) {
ellipseHandlesFeature = feature;

const ellipseFeatureId = getEllipseId(ellipseHandlesFeature);
ellipseFeature = drawingSource.getFeatureById(ellipseFeatureId);

if (ellipseFeature) {
area = getFeatureScoord3dArea(ellipseFeature, pyramid);
points = ellipseFeature.getGeometry().getCoordinates().map(coordinate => ({
x: coordinate[0],
y: coordinate[1]
}));
}
}

if (isEllipseShape) {
ellipseFeature = feature;
area = getFeatureScoord3dArea(ellipseFeature, pyramid);
points = ellipseFeature.getGeometry().getCoordinates().map(coordinate => ({
x: coordinate[0],
y: coordinate[1]
}));
}

const ellipse = new dcmjs.utilities.TID300.Ellipse({
area,
points
});

const contentItem = ellipse.contentItem();
const numContentItems = contentItem.filter(
(ci) => ci.ValueType === "NUM"
);
return numContentItems.map((measurement) => {
/** Update format wrong in dcmjs */
measurement.ConceptNameCodeSequence = [
measurement.ConceptNameCodeSequence,
];
return measurement;
});
}
return [];
},
onSetFeatureStyle: (feature, styleOptions, viewerProperties) => {
@@ -409,6 +462,6 @@ const ellipse = {
}
}
},
};
})

export default ellipse;
5 changes: 2 additions & 3 deletions src/annotations/markups/measurement.js
Original file line number Diff line number Diff line change
@@ -43,8 +43,7 @@ const _isMeasurement = (feature) =>
const MeasurementMarkup = (viewerProperties) => {
const { map, pyramid, markupManager } = viewerProperties;

return {
...annotationInterface,
return Object.assign({}, annotationInterface, {
onAdd: (feature) => {
if (_isMeasurement(feature)) {
const view = map.getView();
@@ -74,7 +73,7 @@ const MeasurementMarkup = (viewerProperties) => {
markupManager.create({ feature });
}
},
};
});
};

export default MeasurementMarkup;
5 changes: 2 additions & 3 deletions src/annotations/markups/textEvaluation.js
Original file line number Diff line number Diff line change
@@ -87,8 +87,7 @@ const _onInteractionEventHandler = ({ feature, markupManager }) => {
* @param {object} dependencies.markupManager MarkupManager shared instance
*/
const TextEvaluationMarkup = ({ markupManager }) => {
return {
...annotationInterface,
return Object.assign({}, annotationInterface, {
onAdd: (feature) => {
if (_isTextEvaluation(feature)) {
_onInteractionEventHandler({ feature, markupManager })
@@ -130,7 +129,7 @@ const TextEvaluationMarkup = ({ markupManager }) => {
_onInteractionEventHandler({ feature, markupManager })
}
},
}
})
}

export default TextEvaluationMarkup
16 changes: 3 additions & 13 deletions src/viewer.js
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ import {
import { RenderingEngine } from './renderingEngine.js'
import Enums from './enums'
import _AnnotationManager from './annotations/_AnnotationManager'
import { getLongAxisId, getShortAxisId } from './annotations/markups/bidirectional/id'

function _getInteractionBindingCondition (bindings, condition = () => true) {
const BUTTONS = {
@@ -378,19 +377,10 @@ function _updateFeatureEvaluations (feature) {
*/
function _updateFeatureMeasurements (feature, viewerProperties) {
const { map, pyramid, annotationManager } = viewerProperties;
const featureMarkup = feature.get(Enums.InternalProperties.Markup);

const {
[Enums.InternalProperties.Markup]: featureMarkup,
[Enums.Bidirectional.IsShortAxis]: isShortAxis,
[Enums.Bidirectional.IsLongAxis]: isLongAxis
} = feature.getProperties();

const isBidirectional = isShortAxis || isLongAxis;

if (
Enums.Markup.Measurement !== featureMarkup
) {
return
if (Enums.Markup.Measurement !== featureMarkup) {
return;
}

const area = getFeatureScoord3dArea(feature, pyramid)