-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat(measurement): Add support measurement label autocompletion #3855
feat(measurement): Add support measurement label autocompletion #3855
Conversation
✅ Deploy Preview for ohif-platform-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3855 +/- ##
==========================================
- Coverage 46.23% 44.37% -1.87%
==========================================
Files 78 80 +2
Lines 1276 1334 +58
Branches 312 327 +15
==========================================
+ Hits 590 592 +2
- Misses 548 589 +41
- Partials 138 153 +15 see 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
…b.com/nithin-trenser/Viewers into feat/measurement-label-autocompletion
Thanks @nithin-trenser for this amazing PR, as discussed in our zoom meeting, I'm starting to review this but @IbrahimCSAE will take care of addressing the comments |
platform/docs/docs/platform/services/data/MeasurementService.md
Outdated
Show resolved
Hide resolved
interface PropType { | ||
labellingDoneCallback: (label: string) => void; | ||
measurementData: any; | ||
labelData: any; | ||
exclusive: boolean; | ||
componentClassName: any; | ||
} | ||
|
||
interface StateType { | ||
location: Location; | ||
label: string; | ||
componentClassName: any; | ||
confirmationState: boolean; | ||
displayComponent: boolean; | ||
} | ||
|
||
export interface LabelInfo { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
class LabellingFlow extends Component<PropType> { | ||
currentItems: Array<LabelInfo> = []; | ||
state: StateType; | ||
mainElement; | ||
|
||
constructor(props) { | ||
super(props); | ||
const { label } = props.measurementData; | ||
let className = props.componentClassName; | ||
|
||
this.state = { | ||
location, | ||
label, | ||
componentClassName: className, | ||
confirmationState: false, | ||
displayComponent: true, | ||
}; | ||
this.mainElement = React.createRef(); | ||
} | ||
|
||
render() { | ||
if (this.props.labelData) { | ||
this.currentItems = cloneDeep(this.props.labelData); | ||
} | ||
|
||
const className = Object.assign({}, this.state.componentClassName); | ||
|
||
return ( | ||
<LabellingTransition | ||
displayComponent={this.state.displayComponent} | ||
onTransitionExit={this.props.labellingDoneCallback} | ||
> | ||
<> | ||
<div | ||
className={className} | ||
ref={this.mainElement} | ||
> | ||
{this.labellingStateFragment()} | ||
</div> | ||
</> | ||
</LabellingTransition> | ||
); | ||
} | ||
|
||
closePopup = () => { | ||
this.setState({ | ||
displayComponent: false, | ||
}); | ||
|
||
setTimeout(() => { | ||
this.setState({ | ||
displayComponent: false, | ||
}); | ||
}, 2000); | ||
}; | ||
|
||
selectTreeSelectCalback = (event, itemSelected) => { | ||
const label = itemSelected.value; | ||
this.closePopup(); | ||
return this.props.labellingDoneCallback(label); | ||
}; | ||
|
||
labellingStateFragment = () => { | ||
return ( | ||
<SelectTree | ||
items={this.currentItems} | ||
columns={1} | ||
onSelected={this.selectTreeSelectCalback} | ||
closePopup={this.closePopup} | ||
selectTreeFirstTitle="Annotation" | ||
exclusive={this.props.exclusive} | ||
label={this.state.label} | ||
/> | ||
); | ||
}; | ||
|
||
} | ||
|
||
export default LabellingFlow; |
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.
We need to talk to Dan for this design
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.
@sedghi Other comments are resolved. Please let us know if any change in UI design is required.
extensions/measurement-tracking/src/panels/PanelMeasurementTableTracking/index.tsx
Outdated
Show resolved
Hide resolved
@IbrahimCSAE we should make this such that it works for segmentation label editing as well |
extensions/measurement-tracking/src/viewports/TrackedCornerstoneViewport.tsx
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.
Thanks this is great sutff!
Context
This PR is a prior feature needed for upcoming fetal ultra sound mode by FlyWheel.io.
This enables developers to optionally configure a list of predefined labels to be auto-populated when annotating the tissues applicable in that mode. As such this doesnot change current behaviour of the viewer.
Changes & Results
The below configurations allows to concluded the behaviour of suggested label list.
items
: This is the optional list of labels configurable for each mode.Labels property will be used for display and value property will be assigned to annotation.
labelOnMeasure
: If this is set, the list will be automatically shown after user draws a measurement. Otherwise, the label list will be shown only when user tries to manually label from side panel or annotation context menu.exclusive
: If it is set, the user will be restricted to choose a label from the provided label list. Otherwise, the list will act as suggestions, but users still have the ability to type in custom labels as needed. If no items configured, exlcusive will be ignored and allows users to provide custom labels.By default the behaviour will be similar to the configuration
To show the label popup irrespective of tracked/untracked mode, a new state(labellingOnly) is introduced to prevent machine from turning off When selecting 'No, do not ask again' tracking prompt UI.
Testing
We can configure some labels in mode configuration like below, you need to add the following via customizationService
A demo video for this behaviour is attached below.
autocompletoin-measurement-labels.mp4
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment