-
Notifications
You must be signed in to change notification settings - Fork 339
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
Updating proper values for ChangeType parameter in AnnotationModifiedEventDetail. #1821
base: main
Are you sure you want to change the base?
Changes from 6 commits
12c1fb6
27316df
1ba46cf
af5cc55
0403351
40ffe9e
92227e0
54d1b79
1ddc5ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,8 @@ type Annotation = { | |
[key: string]: unknown; | ||
/** Cached Annotation statistics which is specific to the tool */ | ||
cachedStats?: Record<string, unknown>; | ||
/** Label of an annotation */ | ||
label?: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is inconsistent with the label in LengthTool - label belongs to the data element. Note the difference between CS3D and OHIF - in CS3D the data is in the data object, while in OHIF it is at the top level. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The label is already defined inside the data element as you suggested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, was seeing the nesting wrong. Could you move the handles to it's own type - I think that is sufficiently long to be worth having by itself. That would resolve the issue with having it hard to see the nesting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I like that a lot better. I never like having to try to manually figure out the indentation to figure out what is what. |
||
}; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { Annotation } from '../types/AnnotationTypes'; | ||
import { triggerAnnotationModified } from '../stateManagement/annotation/helpers/state'; | ||
import { ChangeTypes } from '../enums'; | ||
|
||
export default function setAnnotationLabel( | ||
annotation: Annotation, | ||
element: HTMLDivElement, | ||
updatedLabel: string | ||
) { | ||
annotation.data.label = updatedLabel; | ||
triggerAnnotationModified(annotation, element, ChangeTypes.LabelChange); | ||
} | ||
wayfarer3130 marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about !data.cachedStates[targetId]?.areaUnit
The areaUnit should be a non empty string, even for unknown units as that will be pixels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there is an existing issue that calculateCachedStats is always called for each mouse movement of open freenad annotation. This is due to the areaUnit for open freehand ROIs in cachedStates is always
undefined
.As this condition is always true for Open freehand annotations, resulting in the unintended activation of an
annotationModified
event, we are restricting the second condition for closed freehand only.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we should probably check on unit rather than areaUnit, and always make sure we specify unit in it - that should be available for both closed and open contours. I believe it is not currently set for open contours, but it should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be an equivalent check for open contours, and I'd really rather have a single check that works for both.