Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
142 changes: 71 additions & 71 deletions plugins/ohifv3/extensions/monai-label/package.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
{
"name": "@ohif/extension-monai-label",
"version": "3.0.0",
"description": "OHIFv3 extension for MONAI Label",
"author": "OHIF,NVIDIA,KCL",
"license": "MIT",
"main": "dist/ohif-extension-monai-label.umd.js",
"module": "src/index.tsx",
"files": [
"dist/**",
"public/**",
"README.md"
],
"repository": "OHIF/Viewers",
"keywords": [
"ohif-extension"
],
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=14",
"npm": ">=6",
"yarn": ">=1.18.0"
},
"scripts": {
"clean": "shx rm -rf dist",
"clean:deep": "yarn run clean && shx rm -rf node_modules",
"dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --output-pathinfo",
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
"build:package-1": "yarn run build",
"start": "yarn run dev",
"test:unit": "jest --watchAll",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.5",
"@ohif/extension-cornerstone": "3.10.0-beta.5",
"@ohif/extension-default": "3.10.0-beta.5",
"@ohif/i18n": "3.10.0-beta.5",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^12.2.2",
"react-router": "^6.23.1",
"react-router-dom": "^6.23.1"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.2.3",
"@cornerstonejs/core": "^2.2.3",
"@kitware/vtk.js": "32.1.0",
"react-color": "^2.19.3",
"md5.js": "^1.3.5",
"axios": "^0.21.1",
"arraybuffer-concat": "^0.0.1",
"ndarray": "^1.0.19",
"nrrd-js": "^0.2.1",
"pako": "^2.0.3",
"bootstrap": "^5.0.2",
"react-select": "^4.3.1",
"chroma-js": "^2.1.2"
},
"devDependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^2.2.3",
"@cornerstonejs/core": "^2.2.3",
"@cornerstonejs/tools": "^2.2.3",
"react-color": "^2.19.3"
}
}
{
"name": "@ohif/extension-monai-label",
"version": "3.0.0",
"description": "OHIFv3 extension for MONAI Label",
"author": "OHIF,NVIDIA,KCL",
"license": "MIT",
"main": "dist/ohif-extension-monai-label.umd.js",
"module": "src/index.tsx",
"files": [
"dist/**",
"public/**",
"README.md"
],
"repository": "OHIF/Viewers",
"keywords": [
"ohif-extension"
],
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=14",
"npm": ">=6",
"yarn": ">=1.18.0"
},
"scripts": {
"clean": "shx rm -rf dist",
"clean:deep": "yarn run clean && shx rm -rf node_modules",
"dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --output-pathinfo",
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
"build:package-1": "yarn run build",
"start": "yarn run dev",
"test:unit": "jest --watchAll",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.11.0",
"@ohif/extension-cornerstone": "3.11.0",
"@ohif/extension-default": "3.11.0",
"@ohif/i18n": "3.11.0",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^12.2.2",
"react-router": "^6.23.1",
"react-router-dom": "^6.23.1"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.32.5",
"@cornerstonejs/core": "^3.32.5",
"@kitware/vtk.js": "32.12.0",
"react-color": "^2.19.3",
"md5.js": "^1.3.5",
"axios": "^0.21.1",
"arraybuffer-concat": "^0.0.1",
"ndarray": "^1.0.19",
"nrrd-js": "^0.2.1",
"pako": "^2.0.3",
"bootstrap": "^5.0.2",
"react-select": "^4.3.1",
"chroma-js": "^2.1.2"
},
"devDependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.32.5",
"@cornerstonejs/core": "^3.32.5",
"@cornerstonejs/tools": "^3.32.5",
"react-color": "^2.19.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,61 +1,82 @@
/*
Copyright (c) MONAI Consortium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import { Dialog, ButtonEnums } from '@ohif/ui';
import OptionsForm from './actions/OptionsForm';

function optionsInputDialog(uiDialogService, config, info, callback) {
const dialogId = 'monai-label-options';
const optionsRef = React.createRef<OptionsForm>();

const onSubmitHandler = ({ action }) => {
switch (action.id) {
case 'save':
callback(optionsRef.current.state.config, action.id);
uiDialogService.dismiss({ id: dialogId });
break;
case 'cancel':
callback({}, action.id);
uiDialogService.dismiss({ id: dialogId });
break;
case 'reset':
optionsRef.current.onReset();
break;
}
};

uiDialogService.create({
id: dialogId,
centralize: true,
isDraggable: false,
showOverlay: true,
content: Dialog,
contentProps: {
title: 'Options / Configurations',
noCloseButton: true,
onClose: () => uiDialogService.dismiss({ id: dialogId }),
actions: [
{ id: 'reset', text: 'Reset', type: ButtonEnums.type.secondary },
{ id: 'cancel', text: 'Cancel', type: ButtonEnums.type.secondary },
{ id: 'save', text: 'Confirm', type: ButtonEnums.type.primary },
],
onSubmit: onSubmitHandler,
body: () => {
return <OptionsForm ref={optionsRef} config={config} info={info} />;
},
},
});
}

export default optionsInputDialog;
/*
Copyright (c) MONAI Consortium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import React from 'react';
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, Button } from '@ohif/ui-next';
import OptionsForm from './actions/OptionsForm';

function OptionsInputDialogComponent({ config, info, callback, hide }) {
const optionsRef = React.useRef<OptionsForm>(null);

const handleSave = () => {
if (optionsRef.current) {
callback(optionsRef.current.state.config, 'save');
}
hide();
};

const handleCancel = () => {
callback({}, 'cancel');
hide();
};

const handleReset = () => {
if (optionsRef.current) {
optionsRef.current.onReset();
}
};

return (
<Dialog open={true} onOpenChange={(open) => !open && handleCancel()}>
<DialogContent className="max-w-4xl">
<DialogHeader>
<DialogTitle>Options / Configurations</DialogTitle>
</DialogHeader>

<div className="py-4">
<OptionsForm ref={optionsRef} config={config} info={info} />
</div>

<DialogFooter className="flex gap-2">
<Button variant="outline" onClick={handleReset}>
Reset
</Button>
<Button variant="outline" onClick={handleCancel}>
Cancel
</Button>
<Button onClick={handleSave}>
Confirm
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}

function optionsInputDialog(uiDialogService, config, info, callback) {
const dialogId = 'monai-label-options';

uiDialogService.show({
id: dialogId,
title: 'Options / Configurations',
content: OptionsInputDialogComponent,
shouldCloseOnEsc: true,
contentProps: {
config,
info,
callback,
},
});
}

export default optionsInputDialog;
Loading