Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrokohler committed Aug 16, 2024
1 parent aff34e9 commit aa5574f
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 62 deletions.
14 changes: 7 additions & 7 deletions public/config/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ window.config = {
servers: [
{
id: 'preview',
url: "https://proxy.imaging.datacommons.cancer.gov/current/viewer-only-no-downloads-see-tinyurl-dot-com-slash-3j3d9jyp/dicomWeb",
url: 'https://proxy.imaging.datacommons.cancer.gov/current/viewer-only-no-downloads-see-tinyurl-dot-com-slash-3j3d9jyp/dicomWeb',
write: false
}
],
oidc: {
authority: "https://accounts.google.com",
clientId: "293449031882-k4um45hl4g94fsgbnviel0lh38836i9v.apps.googleusercontent.com",
scope: "email profile openid https://www.googleapis.com/auth/cloud-healthcare",
grantType: "implicit"
authority: 'https://accounts.google.com',
clientId: '293449031882-k4um45hl4g94fsgbnviel0lh38836i9v.apps.googleusercontent.com',
scope: 'email profile openid https://www.googleapis.com/auth/cloud-healthcare',
grantType: 'implicit'
},
disableWorklist: false,
disableAnnotationTools: false,
enableServerSelection: true,
mode: "light",
mode: 'light',
preload: true,
annotations: [
{
Expand All @@ -30,6 +30,6 @@ window.config = {
color: [255, 255, 255, 0.2]
}
}
},
}
]
}
39 changes: 19 additions & 20 deletions src/components/AnnotationCategoryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ const AnnotationCategoryItem = ({
</Space>
{types.map((type: Type) => {
const { CodeMeaning, CodingSchemeDesignator, CodeValue, uids } =
type;
const shortenedCodeMeaning = CodeMeaning.slice(0, 22);
const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`;
type
const shortenedCodeMeaning = CodeMeaning.slice(0, 22)
const displayCodeMeaning = shortenedCodeMeaning === CodeMeaning ? CodeMeaning : `${shortenedCodeMeaning}...`
const isChecked = uids.every((uid: string) =>
checkedAnnotationUids.has(uid)
)
Expand All @@ -114,11 +114,11 @@ const AnnotationCategoryItem = ({
<div
key={`${type.CodingSchemeDesignator}:${type.CodeMeaning}`}
style={{
paddingLeft: "25px",
wordWrap: "break-word",
width: "100%",
display: "flex",
flexDirection: "row",
paddingLeft: '25px',
wordWrap: 'break-word',
width: '100%',
display: 'flex',
flexDirection: 'row'
}}
>
<Checkbox
Expand All @@ -127,21 +127,20 @@ const AnnotationCategoryItem = ({
onChange={(e: any) =>
handleChangeCheckedType({
type,
isVisible: e.target.checked,
})
}
></Checkbox>
<div style={{ paddingLeft: "5px" }}>
isVisible: e.target.checked
})}
/>
<div style={{ paddingLeft: '5px' }}>
<Tooltip
title={`${CodeValue}:${CodingSchemeDesignator}`}
mouseEnterDelay={1}
>
{displayCodeMeaning}
</Tooltip>
<Popover
placement="topLeft"
overlayStyle={{ width: "350px" }}
title="Display Settings"
placement='topLeft'
overlayStyle={{ width: '350px' }}
title='Display Settings'
content={() => (
<ColorSettingsMenu
annotationGroupsUIDs={type.uids}
Expand All @@ -151,15 +150,15 @@ const AnnotationCategoryItem = ({
)}
>
<Button
type="primary"
shape="circle"
style={{ marginLeft: "10px" }}
type='primary'
shape='circle'
style={{ marginLeft: '10px' }}
icon={<SettingOutlined />}
/>
</Popover>
</div>
</div>
);
)
})}
</div>
</Space>
Expand Down
3 changes: 1 addition & 2 deletions src/components/AnnotationCategoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React from 'react'
import { Menu } from 'antd'
import AnnotationCategoryItem from './AnnotationCategoryItem'


export interface AnnotationCategoryAndType {
uid: string;
uid: string
type: Omit<Type, 'uids'>
category: Omit<Category, 'types'>
}
Expand Down
14 changes: 7 additions & 7 deletions src/components/ColorSettingsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ ColorSettingsMenuState
uid,
styleOptions: {
color: color,
opacity: this.state.currentStyle.opacity,
},
});
opacity: this.state.currentStyle.opacity
}
})
})
}
}
Expand All @@ -102,8 +102,8 @@ ColorSettingsMenuState
uid,
styleOptions: {
color: color,
opacity: this.state.currentStyle.opacity,
},
opacity: this.state.currentStyle.opacity
}
})
})
}
Expand All @@ -128,8 +128,8 @@ ColorSettingsMenuState
uid,
styleOptions: {
color: color,
opacity: this.state.currentStyle.opacity,
},
opacity: this.state.currentStyle.opacity
}
})
})
}
Expand Down
26 changes: 13 additions & 13 deletions src/components/SlideViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2507,15 +2507,15 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
}): void {
console.log(`change style of ROI ${uid}`)
try {
const opacity = styleOptions.opacity ?? 0.4;
const strokeColor = styleOptions.color ?? [0, 0, 0];
const fillColor = strokeColor.map((c) => Math.min(c + 25, 255));
const opacity = styleOptions.opacity ?? 0.4
const strokeColor = styleOptions.color ?? [0, 0, 0]
const fillColor = strokeColor.map((c) => Math.min(c + 25, 255))
const style = _formatRoiStyle({
fill: { color: [...fillColor, opacity] },
stroke: { color: [...strokeColor, opacity] },
radius: this.defaultRoiStyle.stroke?.width,
});
this.volumeViewer.setROIStyle(uid, style);
radius: this.defaultRoiStyle.stroke?.width
})
this.volumeViewer.setROIStyle(uid, style)
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
NotificationMiddleware.onError(
Expand Down Expand Up @@ -3014,7 +3014,7 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
)
annotationGroups.push(...filteredAnnotationGroups)

const annotations = rois.map(roi => adaptRoiToAnnotation(roi));
const annotations = rois.map(roi => adaptRoiToAnnotation(roi))

const openSubMenuItems = [
'specimens', 'optical-paths', 'annotations', 'presentation-states'
Expand Down Expand Up @@ -3319,15 +3319,15 @@ class SlideViewer extends React.Component<SlideViewerProps, SlideViewerState> {
}
} = {}

if(annotations.length > 0){
if (annotations.length > 0) {
annotations.forEach((annotation) => {
const key = _buildKey(annotation.category);
const style = this.getRoiStyle(key);
const key = _buildKey(annotation.category)
const style = this.getRoiStyle(key)
defaultAnnotationStyles[annotation.uid] = {
color: style.stroke?.color,
opacity: 0.4,
} as any;
});
opacity: 0.4
} as any
})
}

if (annotationGroups.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/NotificationMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ const NotificationSourceDefinition = {
}

class NotificationMiddleware extends PubSub {
constructor() {
constructor () {
super()

const outerContext = (args) => {
this.publish(NotificationMiddlewareEvents.OnWarning, Array.from(args).join(' '))
}

(function () {
var warn = console.warn;
const warn = console.warn
console.warn = function () {
if (!JSON.stringify(arguments).includes('request')) {
outerContext(arguments)
Expand Down
18 changes: 8 additions & 10 deletions src/services/RoiToAnnotationAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import * as dmv from 'dicom-microscopy-viewer';
import * as dmv from 'dicom-microscopy-viewer'
import * as dcmjs from 'dcmjs'
import { AnnotationCategoryAndType } from '../components/AnnotationCategoryList';

import { AnnotationCategoryAndType } from '../components/AnnotationCategoryList'

export const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndType => {
const { uid, evaluations } = roi;
const { uid, evaluations } = roi

const result = {
category: {
CodeValue: 'undefined',
CodeMeaning: 'undefined',
CodingSchemeDesignator: 'undefined',
CodingSchemeDesignator: 'undefined'
},
type: {
CodeValue: 'undefined',
CodeMeaning: 'undefined',
CodingSchemeDesignator: 'undefined',
CodingSchemeDesignator: 'undefined'
}
}

Expand All @@ -28,12 +27,12 @@ export const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndTyp
const nameValue = item.ConceptNameCodeSequence[0].CodeValue
if (item.ValueType === dcmjs.sr.valueTypes.ValueTypes.CODE) {
const codeContentItem = item as dcmjs.sr.valueTypes.CodeContentItem
const value = codeContentItem.ConceptCodeSequence[0];
const value = codeContentItem.ConceptCodeSequence[0]
// For consistency with Segment and Annotation Group
if (nameValue === '276214006') {
result.category = { ...value };
result.category = { ...value }
} else if (nameValue === '121071') {
result.type = { ...value };
result.type = { ...value }
}
}
})
Expand All @@ -43,4 +42,3 @@ export const adaptRoiToAnnotation = (roi: dmv.roi.ROI): AnnotationCategoryAndTyp
uid
}
}

2 changes: 1 addition & 1 deletion types/dicom-microscopy-viewer/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ declare module 'dicom-microscopy-viewer' {
SpecimenDescriptionSequence: SpecimenDescription[]
OpticalPathSequence: OpticalPath[]
AnnotationGroupSequence: Array<{
SOPClassUID: string,
SOPClassUID: string
AnnotationGroupNumber: number
AnnotationGroupUID: string
AnnotationGroupLabel: string
Expand Down

0 comments on commit aa5574f

Please sign in to comment.