lint(curly): consistent use of curly brackets in codebase (#3584)
This commit is contained in:
1 parent
9ae3d9f769
commit
5d435424e2
113 files changed
+1501
-1056
No files matched your search
@@ -41,7 +41,9 @@ class DicomMicroscopyViewport extends Component {
|
||||
const { microscopyService } = this.props.servicesManager.services;
|
||||
this.microscopyService = microscopyService;
|
||||
this.debouncedResize = debounce(() => {
|
||||
if (this.viewer) this.viewer.resize();
|
||||
if (this.viewer) {
|
||||
this.viewer.resize();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,12 @@ const itemGenerator = (props: any) => {
|
||||
props.formatTime = formatDICOMTime;
|
||||
props.formatPN = formatPN;
|
||||
props.formatNumberPrecision = formatNumberPrecision;
|
||||
if (condition && !condition(props)) return null;
|
||||
if (!contents && !valueFunc) return null;
|
||||
if (condition && !condition(props)) {
|
||||
return null;
|
||||
}
|
||||
if (!contents && !valueFunc) {
|
||||
return null;
|
||||
}
|
||||
const value = valueFunc && valueFunc(props);
|
||||
const contentsValue = (contents && contents(props)) || [
|
||||
{ className: 'mr-1', value: title },
|
||||
|
||||
+9
-3
@@ -1,10 +1,16 @@
|
||||
const listComponentGenerator = props => {
|
||||
const { list, itemGenerator } = props;
|
||||
if (!list) return;
|
||||
if (!list) {
|
||||
return;
|
||||
}
|
||||
return list.map(item => {
|
||||
if (!item) return;
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
const generator = item.generator || itemGenerator;
|
||||
if (!generator) throw new Error(`No generator for ${item}`);
|
||||
if (!generator) {
|
||||
throw new Error(`No generator for ${item}`);
|
||||
}
|
||||
return generator({ ...props, item });
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,7 +22,9 @@ export default function getCommandsModule({
|
||||
deleteMeasurement: ({ uid }) => {
|
||||
if (uid) {
|
||||
const roiAnnotation = microscopyService.getAnnotation(uid);
|
||||
if (roiAnnotation) microscopyService.removeAnnotation(roiAnnotation);
|
||||
if (roiAnnotation) {
|
||||
microscopyService.removeAnnotation(roiAnnotation);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -72,7 +74,7 @@ export default function getCommandsModule({
|
||||
].indexOf(toolName) >= 0
|
||||
) {
|
||||
// TODO: read from configuration
|
||||
let options = {
|
||||
const options = {
|
||||
geometryType: toolName,
|
||||
vertexEnabled: true,
|
||||
styleOptions: styles.default,
|
||||
@@ -140,7 +142,9 @@ export default function getCommandsModule({
|
||||
);
|
||||
let onoff = false; // true if this will toggle on
|
||||
for (let i = 0; i < overlays.length; i++) {
|
||||
if (i === 0) onoff = overlays.item(0).classList.contains('hidden');
|
||||
if (i === 0) {
|
||||
onoff = overlays.item(0).classList.contains('hidden');
|
||||
}
|
||||
overlays.item(i).classList.toggle('hidden');
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
* @returns {string} formatted name
|
||||
*/
|
||||
export default function formatDICOMPatientName(name) {
|
||||
if (typeof name !== 'string') return;
|
||||
if (typeof name !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the first ^ to a ', '. String.replace() only affects
|
||||
|
||||
@@ -56,7 +56,7 @@ export default class MicroscopyService extends PubSubService {
|
||||
clear() {
|
||||
this.managedViewers.forEach(managedViewer => managedViewer.destroy());
|
||||
this.managedViewers.clear();
|
||||
for (var key in this.annotations) {
|
||||
for (const key in this.annotations) {
|
||||
delete this.annotations[key];
|
||||
}
|
||||
|
||||
@@ -124,7 +124,9 @@ export default class MicroscopyService extends PubSubService {
|
||||
_onRoiModified(data) {
|
||||
const { roiGraphic, managedViewer } = data;
|
||||
const roiAnnotation = this.getAnnotation(roiGraphic.uid);
|
||||
if (!roiAnnotation) return;
|
||||
if (!roiAnnotation) {
|
||||
return;
|
||||
}
|
||||
roiAnnotation.setRoiGraphic(roiGraphic);
|
||||
roiAnnotation.setViewState(managedViewer.getViewState());
|
||||
}
|
||||
@@ -156,7 +158,10 @@ export default class MicroscopyService extends PubSubService {
|
||||
_onRoiUpdated(data) {
|
||||
const { roiGraphic, managedViewer } = data;
|
||||
this.synchronizeViewers(managedViewer);
|
||||
this._broadcastEvent(EVENTS.ANNOTATION_UPDATED, this.getAnnotation(roiGraphic.uid));
|
||||
this._broadcastEvent(
|
||||
EVENTS.ANNOTATION_UPDATED,
|
||||
this.getAnnotation(roiGraphic.uid)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,8 +175,13 @@ export default class MicroscopyService extends PubSubService {
|
||||
_onRoiSelected(data) {
|
||||
const { roiGraphic } = data;
|
||||
const selectedAnnotation = this.getAnnotation(roiGraphic.uid);
|
||||
if (selectedAnnotation && selectedAnnotation !== this.getSelectedAnnotation()) {
|
||||
if (this.selectedAnnotation) this.clearSelection();
|
||||
if (
|
||||
selectedAnnotation &&
|
||||
selectedAnnotation !== this.getSelectedAnnotation()
|
||||
) {
|
||||
if (this.selectedAnnotation) {
|
||||
this.clearSelection();
|
||||
}
|
||||
this.selectedAnnotation = selectedAnnotation;
|
||||
this._broadcastEvent(EVENTS.ANNOTATION_SELECTED, selectedAnnotation);
|
||||
}
|
||||
@@ -183,11 +193,26 @@ export default class MicroscopyService extends PubSubService {
|
||||
* @param {ViewerManager} managedViewer The viewer being added
|
||||
*/
|
||||
_addManagedViewerSubscriptions(managedViewer) {
|
||||
managedViewer._roiAddedSubscription = managedViewer.subscribe(ViewerEvents.ADDED, this._onRoiAdded);
|
||||
managedViewer._roiModifiedSubscription = managedViewer.subscribe(ViewerEvents.MODIFIED, this._onRoiModified);
|
||||
managedViewer._roiRemovedSubscription = managedViewer.subscribe(ViewerEvents.REMOVED, this._onRoiRemoved);
|
||||
managedViewer._roiUpdatedSubscription = managedViewer.subscribe(ViewerEvents.UPDATED, this._onRoiUpdated);
|
||||
managedViewer._roiSelectedSubscription = managedViewer.subscribe(ViewerEvents.UPDATED, this._onRoiSelected);
|
||||
managedViewer._roiAddedSubscription = managedViewer.subscribe(
|
||||
ViewerEvents.ADDED,
|
||||
this._onRoiAdded
|
||||
);
|
||||
managedViewer._roiModifiedSubscription = managedViewer.subscribe(
|
||||
ViewerEvents.MODIFIED,
|
||||
this._onRoiModified
|
||||
);
|
||||
managedViewer._roiRemovedSubscription = managedViewer.subscribe(
|
||||
ViewerEvents.REMOVED,
|
||||
this._onRoiRemoved
|
||||
);
|
||||
managedViewer._roiUpdatedSubscription = managedViewer.subscribe(
|
||||
ViewerEvents.UPDATED,
|
||||
this._onRoiUpdated
|
||||
);
|
||||
managedViewer._roiSelectedSubscription = managedViewer.subscribe(
|
||||
ViewerEvents.UPDATED,
|
||||
this._onRoiSelected
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,11 +221,16 @@ export default class MicroscopyService extends PubSubService {
|
||||
* @param {ViewerManager} managedViewer The viewer being removed
|
||||
*/
|
||||
_removeManagedViewerSubscriptions(managedViewer) {
|
||||
managedViewer._roiAddedSubscription && managedViewer._roiAddedSubscription.unsubscribe();
|
||||
managedViewer._roiModifiedSubscription && managedViewer._roiModifiedSubscription.unsubscribe();
|
||||
managedViewer._roiRemovedSubscription && managedViewer._roiRemovedSubscription.unsubscribe();
|
||||
managedViewer._roiUpdatedSubscription && managedViewer._roiUpdatedSubscription.unsubscribe();
|
||||
managedViewer._roiSelectedSubscription && managedViewer._roiSelectedSubscription.unsubscribe();
|
||||
managedViewer._roiAddedSubscription &&
|
||||
managedViewer._roiAddedSubscription.unsubscribe();
|
||||
managedViewer._roiModifiedSubscription &&
|
||||
managedViewer._roiModifiedSubscription.unsubscribe();
|
||||
managedViewer._roiRemovedSubscription &&
|
||||
managedViewer._roiRemovedSubscription.unsubscribe();
|
||||
managedViewer._roiUpdatedSubscription &&
|
||||
managedViewer._roiUpdatedSubscription.unsubscribe();
|
||||
managedViewer._roiSelectedSubscription &&
|
||||
managedViewer._roiSelectedSubscription.unsubscribe();
|
||||
|
||||
managedViewer._roiAddedSubscription = null;
|
||||
managedViewer._roiModifiedSubscription = null;
|
||||
@@ -460,7 +490,9 @@ export default class MicroscopyService extends PubSubService {
|
||||
* @param {RoiAnnotation} roiAnnotation The instance to be selected
|
||||
*/
|
||||
selectAnnotation(roiAnnotation) {
|
||||
if (this.selectedAnnotation) this.clearSelection();
|
||||
if (this.selectedAnnotation) {
|
||||
this.clearSelection();
|
||||
}
|
||||
|
||||
this.selectedAnnotation = roiAnnotation;
|
||||
this._broadcastEvent(EVENTS.ANNOTATION_SELECTED, roiAnnotation);
|
||||
|
||||
@@ -83,7 +83,9 @@ export default function constructSR(
|
||||
console.debug('[SR] storing evaluations...', evaluations);
|
||||
console.debug('[SR] storing presentation state...', presentationState);
|
||||
|
||||
if (presentationState) presentationState.marker = marker;
|
||||
if (presentationState) {
|
||||
presentationState.marker = marker;
|
||||
}
|
||||
|
||||
/** Avoid incompatibility with dcmjs */
|
||||
measurements = measurements.map((measurement: any) => {
|
||||
|
||||
@@ -38,7 +38,9 @@ export default function coordinateFormatScoord3d2Geometry(
|
||||
}
|
||||
|
||||
function _getPixelSpacing(metadata) {
|
||||
if (metadata.PixelSpacing) return metadata.PixelSpacing;
|
||||
if (metadata.PixelSpacing) {
|
||||
return metadata.PixelSpacing;
|
||||
}
|
||||
const functionalGroup = metadata.SharedFunctionalGroupsSequence[0];
|
||||
const pixelMeasures = functionalGroup.PixelMeasuresSequence[0];
|
||||
return pixelMeasures.PixelSpacing;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @param filename
|
||||
*/
|
||||
export function saveByteArray(buffer: ArrayBuffer, filename: string) {
|
||||
var blob = new Blob([buffer], { type: 'application/dicom' });
|
||||
var link = document.createElement('a');
|
||||
const blob = new Blob([buffer], { type: 'application/dicom' });
|
||||
const link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = filename;
|
||||
link.click();
|
||||
|
||||
Reference in new issue
Block a user