OHIF with Cornerstone3D 2.0 (#4347)
This commit is contained in:
1 parent
8981a61b8c
commit
7ce7127d7c
803 files changed
+32760
-15893
No files matched your search
@@ -5,7 +5,7 @@ import { MeasurementTable } from '@ohif/ui';
|
||||
import { withTranslation, WithTranslation } from 'react-i18next';
|
||||
import { EVENTS as MicroscopyEvents } from '../../services/MicroscopyService';
|
||||
import dcmjs from 'dcmjs';
|
||||
import callInputDialog from '../../utils/callInputDialog';
|
||||
import { callInputDialog } from '@ohif/extension-default';
|
||||
import constructSR from '../../utils/constructSR';
|
||||
import { saveByteArray } from '../../utils/saveByteArray';
|
||||
import { Separator } from '@ohif/ui-next';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandsManager, ExtensionManager } from '@ohif/core';
|
||||
import { callInputDialog } from '@ohif/extension-default';
|
||||
import styles from './utils/styles';
|
||||
import callInputDialog from './utils/callInputDialog';
|
||||
|
||||
export default function getCommandsModule({
|
||||
servicesManager,
|
||||
@@ -26,7 +26,6 @@ export default function getCommandsModule({
|
||||
|
||||
setLabel: ({ uid }) => {
|
||||
const roiAnnotation = microscopyService.getAnnotation(uid);
|
||||
|
||||
callInputDialog({
|
||||
uiDialogService,
|
||||
defaultValue: '',
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Input, Dialog, ButtonEnums } from '@ohif/ui';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} data
|
||||
* @param {*} data.text
|
||||
* @param {*} data.label
|
||||
* @param {*} event
|
||||
* @param {func} callback
|
||||
* @param {*} isArrowAnnotateInputDialog
|
||||
*/
|
||||
export default function callInputDialog({
|
||||
uiDialogService,
|
||||
title = 'Annotation',
|
||||
defaultValue = '',
|
||||
callback = (value: string, action: string) => {},
|
||||
}) {
|
||||
const dialogId = 'microscopy-input-dialog';
|
||||
|
||||
const onSubmitHandler = ({ action, value }) => {
|
||||
switch (action.id) {
|
||||
case 'save':
|
||||
callback(value.value, action.id);
|
||||
break;
|
||||
case 'cancel':
|
||||
callback('', action.id);
|
||||
break;
|
||||
}
|
||||
uiDialogService.dismiss({ id: dialogId });
|
||||
};
|
||||
|
||||
if (uiDialogService) {
|
||||
uiDialogService.create({
|
||||
id: dialogId,
|
||||
centralize: true,
|
||||
isDraggable: false,
|
||||
showOverlay: true,
|
||||
content: Dialog,
|
||||
contentProps: {
|
||||
title: title,
|
||||
value: { value: defaultValue },
|
||||
noCloseButton: true,
|
||||
onClose: () => uiDialogService.dismiss({ id: dialogId }),
|
||||
actions: [
|
||||
{ id: 'cancel', text: 'Cancel', type: ButtonEnums.type.secondary },
|
||||
{ id: 'save', text: 'Save', type: ButtonEnums.type.primary },
|
||||
],
|
||||
onSubmit: onSubmitHandler,
|
||||
body: ({ value, setValue }) => {
|
||||
return (
|
||||
<Input
|
||||
label="Enter your annotation"
|
||||
labelClassName="text-white text-[14px] leading-[1.2]"
|
||||
autoFocus
|
||||
className="border-primary-main bg-black"
|
||||
type="text"
|
||||
value={value.defaultValue}
|
||||
onChange={event => {
|
||||
event.persist();
|
||||
setValue(value => ({ ...value, value: event.target.value }));
|
||||
}}
|
||||
onKeyPress={event => {
|
||||
if (event.key === 'Enter') {
|
||||
onSubmitHandler({ value, action: { id: 'save' } });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user