Skip to content

Commit da0247e

Browse files
Upgrade OHIF v3 plugin to support OHIF 3.9+ version (#1787)
* First draft - support latest ohif 3.10.x Signed-off-by: Sachidanand Alle <[email protected]> * Fix probe tool Signed-off-by: Sachidanand Alle <[email protected]> * Fix remove server uri Signed-off-by: Sachidanand Alle <[email protected]> * Add options/config dialog + fix 2D segment Signed-off-by: Sachidanand Alle <[email protected]> * Fix monailable mode visibility Signed-off-by: Sachidanand Alle <[email protected]> * Fix toolbar + viewinfo constants Signed-off-by: Sachidanand Alle <[email protected]> * Add Active Learning Section Signed-off-by: Sachidanand Alle <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add copyright header Signed-off-by: Sachidanand Alle <[email protected]> * Fix review comments Signed-off-by: Sachidanand Alle <[email protected]> * verify sam2 only once in integration tests Signed-off-by: Sachidanand Alle <[email protected]> --------- Signed-off-by: Sachidanand Alle <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ed0fdee commit da0247e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2578
-3096
lines changed

plugins/ohif/monai-label/src/components/SettingsTable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class SettingsTable extends Component {
6363
name="aiaaServerURL"
6464
type="text"
6565
defaultValue={this.state.url}
66-
onBlur={this.onBlurSeverURL}
66+
onChange={this.onBlurSeverURL}
6767
/>
6868
</td>
6969
<td>&nbsp;</td>

plugins/ohifv3/build.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cd ${my_dir}
2727
rm -rf Viewers
2828
git clone https://github.com/OHIF/Viewers.git
2929
cd Viewers
30-
git checkout 33f125940863607f8dba82c71b27a43f35431dd5
30+
git checkout d8ef36ed24466988586e19b855d2bbb86f8c657a
3131

3232
#cp -r ../extensions/monai-label extensions/
3333
#cp -r ../modes/monai-label modes/monai-label
@@ -45,6 +45,8 @@ cp ../config/monai_label.js platform/app/public/config/monai_label.js
4545

4646
yarn config set workspaces-experimental true
4747
yarn install
48+
yarn run cli list
49+
4850
APP_CONFIG=config/monai_label.js PUBLIC_URL=/ohif/ QUICK_BUILD=true yarn run build
4951

5052
rm -rf ${install_dir}

plugins/ohifv3/extensions.patch

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
diff --git a/platform/app/pluginConfig.json b/platform/app/pluginConfig.json
2-
index 08a42deb0..69e5aa005 100644
2+
index 06ae62e55..d0be6b022 100644
33
--- a/platform/app/pluginConfig.json
44
+++ b/platform/app/pluginConfig.json
5-
@@ -22,6 +22,11 @@
5+
@@ -57,6 +57,10 @@
66
"default": false,
77
"version": "3.0.0"
88
},
99
+ {
1010
+ "packageName": "@ohif/extension-monai-label",
11-
+ "default": false,
12-
+ "version": "0.0.1"
11+
+ "version": "3.0.0"
1312
+ },
1413
{
15-
"packageName": "@ohif/extension-dicom-microscopy",
14+
"packageName": "@ohif/extension-cornerstone-dicom-rt",
1615
"default": false,
17-
@@ -60,6 +65,9 @@
18-
{
19-
"packageName": "@ohif/mode-segmentation"
16+
@@ -84,6 +88,10 @@
17+
"default": false,
18+
"version": "3.0.0"
2019
},
2120
+ {
22-
+ "packageName": "@ohif/mode-monai-label"
21+
+ "packageName": "@ohif/mode-monai-label",
22+
+ "version": "3.0.0"
2323
+ },
2424
{
25-
"packageName": "@ohif/mode-tmtv"
26-
},
25+
"packageName": "@ohif/mode-basic-dev-mode",
26+
"default": false,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const path = require('path');
2+
const webpackCommon = require('./../../../.webpack/webpack.base.js');
3+
const SRC_DIR = path.join(__dirname, '../src');
4+
const DIST_DIR = path.join(__dirname, '../dist');
5+
6+
const ENTRY = {
7+
app: `${SRC_DIR}/index.tsx`,
8+
};
9+
10+
module.exports = (env, argv) => {
11+
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
12+
};
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "@ohif/extension-monai-label",
3-
"version": "0.0.1",
3+
"version": "3.0.0",
44
"description": "OHIFv3 extension for MONAI Label",
55
"author": "OHIF,NVIDIA,KCL",
66
"license": "MIT",
7-
"main": "dist/umd/extension-monai-label/index.umd.js",
7+
"main": "dist/ohif-extension-monai-label.umd.js",
8+
"module": "src/index.tsx",
89
"files": [
910
"dist/**",
1011
"public/**",
@@ -14,7 +15,6 @@
1415
"keywords": [
1516
"ohif-extension"
1617
],
17-
"module": "src/index.tsx",
1818
"publishConfig": {
1919
"access": "public"
2020
},
@@ -24,41 +24,48 @@
2424
"yarn": ">=1.18.0"
2525
},
2626
"scripts": {
27+
"clean": "shx rm -rf dist",
28+
"clean:deep": "yarn run clean && shx rm -rf node_modules",
2729
"dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --output-pathinfo",
28-
"dev:my-extension": "yarn run dev",
2930
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
30-
"build:package": "yarn run build",
31-
"start": "yarn run dev"
31+
"build:package-1": "yarn run build",
32+
"start": "yarn run dev",
33+
"test:unit": "jest --watchAll",
34+
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
3235
},
3336
"peerDependencies": {
34-
"@ohif/core": "^3.7.0-beta.80",
35-
"@ohif/extension-default": "^3.7.0-beta.80",
36-
"@ohif/extension-cornerstone": "^3.7.0-beta.80",
37-
"@ohif/i18n": "^3.7.0-beta.80",
37+
"@ohif/core": "3.10.0-beta.5",
38+
"@ohif/extension-cornerstone": "3.10.0-beta.5",
39+
"@ohif/extension-default": "3.10.0-beta.5",
40+
"@ohif/i18n": "3.10.0-beta.5",
3841
"prop-types": "^15.6.2",
39-
"react": "^17.0.2",
40-
"react-dom": "^17.0.2",
42+
"react": "^18.3.1",
43+
"react-dom": "^18.3.1",
4144
"react-i18next": "^12.2.2",
42-
"react-router": "^6.8.1",
43-
"react-router-dom": "^6.8.1"
45+
"react-router": "^6.23.1",
46+
"react-router-dom": "^6.23.1"
4447
},
4548
"dependencies": {
4649
"@babel/runtime": "^7.20.13",
50+
"@cornerstonejs/adapters": "^2.2.3",
51+
"@cornerstonejs/core": "^2.2.3",
52+
"@kitware/vtk.js": "32.1.0",
53+
"react-color": "^2.19.3",
4754
"md5.js": "^1.3.5",
4855
"axios": "^0.21.1",
4956
"arraybuffer-concat": "^0.0.1",
5057
"ndarray": "^1.0.19",
5158
"nrrd-js": "^0.2.1",
5259
"pako": "^2.0.3",
53-
"react-color": "^2.19.3",
5460
"bootstrap": "^5.0.2",
5561
"react-select": "^4.3.1",
56-
"chroma-js": "^2.1.2",
57-
"itk": "^14.1.1"
62+
"chroma-js": "^2.1.2"
5863
},
5964
"devDependencies": {
6065
"@babel/runtime": "^7.20.13",
61-
"@cornerstonejs/tools": "^1.16.4",
66+
"@cornerstonejs/adapters": "^2.2.3",
67+
"@cornerstonejs/core": "^2.2.3",
68+
"@cornerstonejs/tools": "^2.2.3",
6269
"react-color": "^2.19.3"
6370
}
6471
}

plugins/ohifv3/extensions/monai-label/src/components/ModelSelector.css

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
Copyright (c) MONAI Consortium
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
.modelSelector .table {
215
border-collapse: collapse;
316
border: 0 solid;
@@ -8,23 +21,26 @@
821
}
922
.modelSelector .selectBox {
1023
width: 100%;
24+
color: #000;
25+
font-size: smaller;
26+
height: 18px;
1127
}
1228
.modelSelector .actionButton {
1329
border: 2px solid #000;
1430
border-radius: 15px;
15-
background-color: #add8e6;
31+
background-color: #00a4d9;
1632
color: var(--ui-gray-dark);
17-
line-height: 25px;
33+
line-height: 20px;
1834
padding: 0 15px;
1935
outline: none;
2036
cursor: pointer;
2137
}
2238
.modelSelector .actionButton:hover,
2339
.modelSelector .actionButton:active {
24-
background-color: var(--ui-sky-blue);
40+
background-color: #00a4d9;
2541
}
2642
.modelSelector .actionButton:disabled {
27-
background-color: var(--ui-sky-blue);
43+
background-color: #00a4d9;
2844
}
2945
.modelSelector .actionButton svg {
3046
margin-right: 4px;

plugins/ohifv3/extensions/monai-label/src/components/ModelSelector.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
Copyright (c) MONAI Consortium
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
import React, { Component } from 'react';
215
import PropTypes from 'prop-types';
316

@@ -12,7 +25,6 @@ export default class ModelSelector extends Component {
1225
usage: PropTypes.any,
1326
onClick: PropTypes.func,
1427
onSelectModel: PropTypes.func,
15-
scribblesSelector: PropTypes.any,
1628
};
1729

1830
constructor(props) {
@@ -21,8 +33,8 @@ export default class ModelSelector extends Component {
2133
const currentModel = props.currentModel
2234
? props.currentModel
2335
: props.models.length > 0
24-
? props.models[0]
25-
: '';
36+
? props.models[0]
37+
: '';
2638
this.state = {
2739
models: props.models,
2840
currentModel: currentModel,
@@ -83,7 +95,7 @@ export default class ModelSelector extends Component {
8395
<select
8496
className="selectBox"
8597
onChange={this.onChangeModel}
86-
value={currentModel}
98+
defaultValue={currentModel}
8799
>
88100
{this.props.models.map((model) => (
89101
<option key={model} name={model} value={model}>
@@ -107,7 +119,6 @@ export default class ModelSelector extends Component {
107119
</button>
108120
</td>
109121
</tr>
110-
{this.props.scribblesSelector}
111122
</tbody>
112123
</table>
113124
{this.props.usage}

plugins/ohifv3/extensions/monai-label/src/components/MonaiLabelPanel.css

+25-15
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
1-
@import url("w3.css");
1+
/*
2+
Copyright (c) MONAI Consortium
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
/*@import url("w3.css");*/
215

316
.monaiLabelPanel {
4-
background-color: #789;
17+
background-color: #000;
518
height: 100%;
619
width: 100%;
7-
display: flex;
820
flex-direction: column;
921
color: var(--text-primary-color);
1022
padding: 2px;
11-
overflow-y: scroll; /* Make the panel scrollable vertically */
1223
/* Accordion styles */
1324
}
1425
.monaiLabelPanel .subtitle {
15-
font-size: 14px;
26+
font-size: 9px;
1627
text-decoration: underline;
1728
font-weight: 500;
18-
color: #000;
29+
color: aqua;
1930
margin: 1px;
2031
text-align: center;
2132
}
2233
.monaiLabelPanel .tabs {
2334
border-radius: 4px;
2435
overflow: auto;
2536
box-shadow: 0 4px 4px -2px rgba(0,0,0,0.5);
26-
background: #000;
2737
margin: 1rem 0;
2838
}
2939
.monaiLabelPanel .tab {
3040
width: 100%;
31-
color: #fff;
41+
/*color: #fff;*/
3242
overflow: hidden;
3343
}
3444
.monaiLabelPanel .tab-switch {
@@ -61,11 +71,11 @@
6171
.monaiLabelPanel .tab-content {
6272
max-height: 0;
6373
padding: 0 1em;
64-
background: #808080;
74+
background: #000;
6575
transition: all 0.35s;
6676
width: 90%;
6777
font-size: small;
68-
color: #000;
78+
color: #fff;
6979
}
7080
.monaiLabelPanel .tab-close {
7181
display: flex;
@@ -79,7 +89,7 @@
7989
background: #1a252f;
8090
}
8191
.monaiLabelPanel input:checked + .tab-label {
82-
background: #000;
92+
background: #00a4d9;
8393
}
8494
.monaiLabelPanel input:checked + .tab-label::after {
8595
transform: rotate(90deg);
@@ -98,22 +108,21 @@
98108
width: 100%;
99109
padding: 1px;
100110
border: 1px solid #000;
101-
border-radius: 5px;
102111
color: #000;
103112
}
104113
.monaiLabelPanel .actionButton {
105114
border: 1px solid #000;
106115
border-radius: 15px;
107-
background-color: #add8e6;
116+
background-color: #00a4d9;
108117
color: #000;
109118
line-height: 25px;
110-
padding: 10px;
119+
padding: 10px 20px;
111120
outline: none;
112121
cursor: pointer;
113122
}
114123
.monaiLabelPanel .actionButton:hover,
115124
.monaiLabelPanel .actionButton:active {
116-
background-color: var(--ui-sky-blue);
125+
background-color: #00a4d9;
117126
}
118127
.monaiLabelPanel .actionButton:disabled {
119128
background-color: var(--ui-sky-blue);
@@ -122,6 +131,7 @@
122131
margin-right: 4px;
123132
position: relative;
124133
top: 2px;
134+
bottom: 2px;
125135
}
126136
.scrollbar {
127137
overflow-y: scroll;

0 commit comments

Comments
 (0)