diff --git a/plugins/ohifv3/extensions.patch b/plugins/ohifv3/extensions.patch index 602ec5f75..3275adf64 100644 --- a/plugins/ohifv3/extensions.patch +++ b/plugins/ohifv3/extensions.patch @@ -1,27 +1,26 @@ diff --git a/platform/app/pluginConfig.json b/platform/app/pluginConfig.json -index 08a42deb0..69e5aa005 100644 +index 06ae62e55..d0be6b022 100644 --- a/platform/app/pluginConfig.json +++ b/platform/app/pluginConfig.json -@@ -22,6 +22,11 @@ +@@ -57,6 +57,10 @@ "default": false, "version": "3.0.0" }, + { + "packageName": "@ohif/extension-monai-label", -+ "default": false, + "version": "3.0.0" + }, { - "packageName": "@ohif/extension-dicom-microscopy", + "packageName": "@ohif/extension-cornerstone-dicom-rt", "default": false, -@@ -60,6 +65,9 @@ - { - "packageName": "@ohif/mode-segmentation" +@@ -84,6 +88,10 @@ + "default": false, + "version": "3.0.0" }, + { -+ "packageName": "@ohif/mode-monai-label" ++ "packageName": "@ohif/mode-monai-label", + "version": "3.0.0" + }, { - "packageName": "@ohif/mode-tmtv" - }, + "packageName": "@ohif/mode-basic-dev-mode", + "default": false, diff --git a/plugins/ohifv3/extensions/monai-label/src/components/SettingsTable.tsx b/plugins/ohifv3/extensions/monai-label/src/components/SettingsTable.tsx index 56491e417..73a5350ec 100644 --- a/plugins/ohifv3/extensions/monai-label/src/components/SettingsTable.tsx +++ b/plugins/ohifv3/extensions/monai-label/src/components/SettingsTable.tsx @@ -18,14 +18,12 @@ import { Icon } from '@ohif/ui'; import { CookieUtils } from '../utils/GenericUtils'; export default class SettingsTable extends Component { + onInfo: any; + constructor(props) { super(props); - this.onInfo = props.onInfo; - this.state = this.getSettings(); - } - getSettings = () => { const url = CookieUtils.getCookieString( 'MONAILABEL_SERVER_URL', 'http://' + window.location.host.split(':')[0] + ':8000/' @@ -39,12 +37,13 @@ export default class SettingsTable extends Component { 'NRRD' ); - return { + this.state = { url: url, overlap_segments: overlap_segments, export_format: export_format, }; - }; + } + onBlurSeverURL = (evt) => { const url = evt.target.value; diff --git a/plugins/ohifv3/extensions/monai-label/src/getCommandsModule.ts b/plugins/ohifv3/extensions/monai-label/src/getCommandsModule.ts index 266a61374..c1f72915b 100644 --- a/plugins/ohifv3/extensions/monai-label/src/getCommandsModule.ts +++ b/plugins/ohifv3/extensions/monai-label/src/getCommandsModule.ts @@ -13,9 +13,6 @@ export default function getCommandsModule({ servicesManager }) { }; const definitions = { - // setToolActive: { - // commandFn: actions.setToolActive, - // }, }; return { diff --git a/plugins/ohifv3/extensions/monai-label/src/services/MonaiLabelClient.js b/plugins/ohifv3/extensions/monai-label/src/services/MonaiLabelClient.js index b15446da4..84e18b275 100644 --- a/plugins/ohifv3/extensions/monai-label/src/services/MonaiLabelClient.js +++ b/plugins/ohifv3/extensions/monai-label/src/services/MonaiLabelClient.js @@ -23,13 +23,12 @@ export default class MonaiLabelClient { return await MonaiLabelClient.api_get(url.toString()); } - async infer(model, image, params, label = null, result_extension = '.nrrd') { - console.log('Running Infer for: ', model, image, params); + async infer(model, image, params, label = null, result_extension = '.nrrd', output='image') { + console.log('Running Infer for: ', { model, image, params, result_extension, output }); let url = new URL('infer/' + encodeURIComponent(model), this.server_url); url.searchParams.append('image', image); - // url.searchParams.append('output', 'all'); - url.searchParams.append('output', 'image'); + url.searchParams.append('output', output); url = url.toString(); if (result_extension) { diff --git a/plugins/ohifv3/extensions/monai-label/src/utils/GenericUtils.js b/plugins/ohifv3/extensions/monai-label/src/utils/GenericUtils.js index f7762bd5b..b9a52a739 100644 --- a/plugins/ohifv3/extensions/monai-label/src/utils/GenericUtils.js +++ b/plugins/ohifv3/extensions/monai-label/src/utils/GenericUtils.js @@ -113,6 +113,7 @@ export class CookieUtils { let results = document.cookie.match( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' ); + // console.log('Cookie results: ', results); if (results) { return unescape(results[2]); } else { @@ -122,8 +123,8 @@ export class CookieUtils { static getCookieString(name, defaultVal = '') { const val = CookieUtils.getCookie(name); - console.debug(name + ' = ' + val + ' (default: ' + defaultVal + ' )'); - if (!val) { + // console.log(name + ' = ' + val + ' (default: ' + defaultVal + ' )'); + if (!val || val === 'undefined' || val === 'null' || val === '') { CookieUtils.setCookie(name, defaultVal); return defaultVal; } @@ -131,12 +132,12 @@ export class CookieUtils { } static getCookieBool(name, defaultVal = false) { - const val = CookieUtils.getCookie(name, defaultVal); + const val = CookieUtils.getCookieString(name, defaultVal); return !!JSON.parse(String(val).toLowerCase()); } static getCookieNumber(name, defaultVal = 0) { - const val = CookieUtils.getCookie(name, defaultVal); + const val = CookieUtils.getCookieString(name, defaultVal); return Number(val); } }