Skip to content

Commit d2d7d20

Browse files
Fix ES lint issues (#1784)
Signed-off-by: Sachidanand Alle <[email protected]>
1 parent cae5499 commit d2d7d20

25 files changed

+187
-183
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import React, { Component } from 'react';
32
import PropTypes from 'prop-types';
43

@@ -41,9 +40,11 @@ export default class ModelSelector extends Component {
4140
return null;
4241
}
4342

44-
onChangeModel = evt => {
43+
onChangeModel = (evt) => {
4544
this.setState({ currentModel: evt.target.value });
46-
if (this.props.onSelectModel) this.props.onSelectModel(evt.target.value);
45+
if (this.props.onSelectModel) {
46+
this.props.onSelectModel(evt.target.value);
47+
}
4748
};
4849

4950
currentModel = () => {
@@ -84,7 +85,7 @@ export default class ModelSelector extends Component {
8485
onChange={this.onChangeModel}
8586
value={currentModel}
8687
>
87-
{this.props.models.map(model => (
88+
{this.props.models.map((model) => (
8889
<option key={model} name={model} value={model}>
8990
{`${model} `}
9091
</option>

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,23 @@ export default class MonaiLabelPanel extends Component {
121121
const response = await this.client().info();
122122

123123
// remove the background
124-
const labels = response.data.labels.splice(1)
124+
const labels = response.data.labels.splice(1);
125125

126126
const segmentations = [
127127
{
128128
id: '1',
129129
label: 'Segmentations',
130130
segments: labels.map((label, index) => ({
131131
segmentIndex: index + 1,
132-
label
132+
label,
133133
})),
134134
isActive: true,
135135
activeSegmentIndex: 1,
136136
},
137137
];
138138

139139
this.props.commandsManager.runCommand('loadSegmentationsForViewport', {
140-
segmentations
140+
segmentations,
141141
});
142142

143143
if (response.status !== 200) {
@@ -163,16 +163,18 @@ export default class MonaiLabelPanel extends Component {
163163
// Leave Event
164164
for (const action of Object.keys(this.actions)) {
165165
if (this.state.action === action) {
166-
if (this.actions[action].current)
166+
if (this.actions[action].current) {
167167
this.actions[action].current.onLeaveActionTab();
168+
}
168169
}
169170
}
170171

171172
// Enter Event
172173
for (const action of Object.keys(this.actions)) {
173174
if (name === action) {
174-
if (this.actions[action].current)
175+
if (this.actions[action].current) {
175176
this.actions[action].current.onEnterActionTab();
177+
}
176178
}
177179
}
178180
this.setState({ action: name });
@@ -193,11 +195,10 @@ export default class MonaiLabelPanel extends Component {
193195
console.info('These are the predicted labels');
194196
console.info(onInfoLabelNames);
195197

196-
if (onInfoLabelNames.hasOwnProperty('background')){
197-
delete onInfoLabelNames.background;
198+
if (onInfoLabelNames.hasOwnProperty('background')) {
199+
delete onInfoLabelNames.background;
198200
}
199201

200-
201202
const ret = SegmentationReader.parseNrrdData(response.data);
202203

203204
if (!ret) {
@@ -248,7 +249,7 @@ delete onInfoLabelNames.background;
248249
};
249250

250251
_debug = async () => {
251-
let nrrdFetch = await fetch('http://localhost:3000/pred2.nrrd');
252+
const nrrdFetch = await fetch('http://localhost:3000/pred2.nrrd');
252253

253254
const info = {
254255
spleen: 1,

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

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
8383

8484
const unsubscriptions = [];
8585

86-
events.forEach(event => {
86+
events.forEach((event) => {
8787
const { unsubscribe } = segmentationService.subscribe(event, () => {
8888
const segmentations = segmentationService.getSegmentations();
8989

90-
const activeSegmentation = segmentations?.find(seg => seg.isActive);
90+
const activeSegmentation = segmentations?.find((seg) => seg.isActive);
9191

9292
setToolsEnabled(activeSegmentation?.segmentCount > 0);
9393
});
@@ -96,7 +96,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
9696
});
9797

9898
return () => {
99-
unsubscriptions.forEach(unsubscribe => unsubscribe());
99+
unsubscriptions.forEach((unsubscribe) => unsubscribe());
100100
};
101101
}, [activeViewportId, viewports, segmentationService]);
102102

@@ -117,7 +117,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
117117
}, [toolbarService, updateActiveTool]);
118118

119119
const setToolActive = useCallback(
120-
toolName => {
120+
(toolName) => {
121121
toolbarService.recordInteraction({
122122
groupId: 'SegmentationTools',
123123
itemId: 'Brush',
@@ -139,8 +139,12 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
139139

140140
const updateBrushSize = useCallback(
141141
(toolName, brushSize) => {
142-
toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
143-
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize, toolName);
142+
toolGroupService.getToolGroupIds()?.forEach((toolGroupId) => {
143+
segmentationUtils.setBrushSizeForToolGroup(
144+
toolGroupId,
145+
brushSize,
146+
toolName
147+
);
144148
});
145149
},
146150
[toolGroupService]
@@ -150,7 +154,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
150154
(valueAsStringOrNumber, toolCategory) => {
151155
const value = Number(valueAsStringOrNumber);
152156

153-
_getToolNamesFromCategory(toolCategory).forEach(toolName => {
157+
_getToolNamesFromCategory(toolCategory).forEach((toolName) => {
154158
updateBrushSize(toolName, value);
155159
});
156160

@@ -166,7 +170,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
166170
);
167171

168172
const handleRangeChange = useCallback(
169-
newRange => {
173+
(newRange) => {
170174
if (
171175
newRange[0] === state.ThresholdBrush.thresholdRange[0] &&
172176
newRange[1] === state.ThresholdBrush.thresholdRange[1]
@@ -176,8 +180,8 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
176180

177181
const toolNames = _getToolNamesFromCategory('ThresholdBrush');
178182

179-
toolNames.forEach(toolName => {
180-
toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
183+
toolNames.forEach((toolName) => {
184+
toolGroupService.getToolGroupIds()?.forEach((toolGroupId) => {
181185
const toolGroup = toolGroupService.getToolGroup(toolGroupId);
182186
toolGroup.setToolConfiguration(toolName, {
183187
strategySpecificConfiguration: {
@@ -208,7 +212,9 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
208212
name: 'Brush',
209213
icon: 'icon-tool-brush',
210214
disabled: !toolsEnabled,
211-
active: state.activeTool === 'CircularBrush' || state.activeTool === 'SphereBrush',
215+
active:
216+
state.activeTool === 'CircularBrush' ||
217+
state.activeTool === 'SphereBrush',
212218
onClick: () => setToolActive('CircularBrush'),
213219
options: [
214220
{
@@ -219,7 +225,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
219225
max: 100,
220226
value: state.Brush.brushSize,
221227
step: 0.5,
222-
onChange: value => onBrushSizeChange(value, 'Brush'),
228+
onChange: (value) => onBrushSizeChange(value, 'Brush'),
223229
},
224230
{
225231
name: 'Mode',
@@ -230,15 +236,17 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
230236
{ value: 'CircularBrush', label: 'Circle' },
231237
{ value: 'SphereBrush', label: 'Sphere' },
232238
],
233-
onChange: value => setToolActive(value),
239+
onChange: (value) => setToolActive(value),
234240
},
235241
],
236242
},
237243
{
238244
name: 'Eraser',
239245
icon: 'icon-tool-eraser',
240246
disabled: !toolsEnabled,
241-
active: state.activeTool === 'CircularEraser' || state.activeTool === 'SphereEraser',
247+
active:
248+
state.activeTool === 'CircularEraser' ||
249+
state.activeTool === 'SphereEraser',
242250
onClick: () => setToolActive('CircularEraser'),
243251
options: [
244252
{
@@ -249,7 +257,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
249257
max: 100,
250258
value: state.Eraser.brushSize,
251259
step: 0.5,
252-
onChange: value => onBrushSizeChange(value, 'Eraser'),
260+
onChange: (value) => onBrushSizeChange(value, 'Eraser'),
253261
},
254262
{
255263
name: 'Mode',
@@ -260,7 +268,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
260268
{ value: 'CircularEraser', label: 'Circle' },
261269
{ value: 'SphereEraser', label: 'Sphere' },
262270
],
263-
onChange: value => setToolActive(value),
271+
onChange: (value) => setToolActive(value),
264272
},
265273
],
266274
},
@@ -284,7 +292,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
284292
{ value: 'RectangleScissor', label: 'Rectangle' },
285293
{ value: 'SphereScissor', label: 'Sphere' },
286294
],
287-
onChange: value => setToolActive(value),
295+
onChange: (value) => setToolActive(value),
288296
},
289297
],
290298
},
@@ -305,7 +313,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
305313
max: 100,
306314
value: state.ThresholdBrush.brushSize,
307315
step: 0.5,
308-
onChange: value => onBrushSizeChange(value, 'ThresholdBrush'),
316+
onChange: (value) => onBrushSizeChange(value, 'ThresholdBrush'),
309317
},
310318
{
311319
name: 'Mode',
@@ -316,7 +324,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
316324
{ value: 'ThresholdCircularBrush', label: 'Circle' },
317325
{ value: 'ThresholdSphereBrush', label: 'Sphere' },
318326
],
319-
onChange: value => setToolActive(value),
327+
onChange: (value) => setToolActive(value),
320328
},
321329
{
322330
type: 'custom',

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export default class SettingsTable extends Component {
88
constructor(props) {
99
super(props);
1010

11-
const onInfo = props.onInfo
12-
this.onInfo = onInfo
11+
const onInfo = props.onInfo;
12+
this.onInfo = onInfo;
1313

1414
this.state = this.getSettings();
1515
}
@@ -35,8 +35,8 @@ export default class SettingsTable extends Component {
3535
};
3636
};
3737

38-
onBlurSeverURL = evt => {
39-
let url = evt.target.value;
38+
onBlurSeverURL = (evt) => {
39+
const url = evt.target.value;
4040
this.setState({ url: url });
4141
CookieUtils.setCookie('MONAILABEL_SERVER_URL', url);
4242
};

plugins/ohifv3/extensions/monai-label/src/components/Toolbox/ThresholdSettingsPreset.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,19 @@ function ThresholdSettings({ onRangeChange }) {
3333
const [options, setOptions] = useState(defaultOptions);
3434
const [selectedPreset, setSelectedPreset] = useState(defaultOptions[0].value);
3535

36-
const handleRangeChange = newRange => {
37-
const selectedOption = options.find(o => o.value === selectedPreset);
36+
const handleRangeChange = (newRange) => {
37+
const selectedOption = options.find((o) => o.value === selectedPreset);
3838

39-
if (newRange[0] === selectedOption.range[0] && newRange[1] === selectedOption.range[1]) {
39+
if (
40+
newRange[0] === selectedOption.range[0] &&
41+
newRange[1] === selectedOption.range[1]
42+
) {
4043
return;
4144
}
4245

4346
onRangeChange(newRange);
4447

45-
const updatedOptions = options.map(o => {
48+
const updatedOptions = options.map((o) => {
4649
if (o.value === selectedPreset) {
4750
return {
4851
...o,
@@ -55,7 +58,9 @@ function ThresholdSettings({ onRangeChange }) {
5558
setOptions(updatedOptions);
5659
};
5760

58-
const selectedPresetRange = options.find(ds => ds.value === selectedPreset).range;
61+
const selectedPresetRange = options.find(
62+
(ds) => ds.value === selectedPreset
63+
).range;
5964

6065
return (
6166
<div>
@@ -66,7 +71,7 @@ function ThresholdSettings({ onRangeChange }) {
6671
isClearable={false}
6772
onChange={handlePresetChange}
6873
options={options}
69-
value={options.find(ds => ds.value === selectedPreset)}
74+
value={options.find((ds) => ds.value === selectedPreset)}
7075
className="text-white"
7176
isSearchable={false}
7277
/>

0 commit comments

Comments
 (0)