Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sachidanand Alle <[email protected]>
  • Loading branch information
SachidanandAlle committed Nov 23, 2024
1 parent cc8e1a4 commit 9266a15
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 27 deletions.
19 changes: 9 additions & 10 deletions plugins/ohifv3/extensions.patch
Original file line number Diff line number Diff line change
@@ -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,
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export default function getCommandsModule({ servicesManager }) {
};

const definitions = {
// setToolActive: {
// commandFn: actions.setToolActive,
// },
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -122,21 +123,21 @@ 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;
}
return val;
}

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);
}
}
Expand Down

0 comments on commit 9266a15

Please sign in to comment.