chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -27,31 +27,22 @@ const CornerstoneViewportDownloadForm = ({
|
||||
const activeViewportElement = enabledElement?.element;
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
const {
|
||||
viewportId: activeViewportId,
|
||||
renderingEngineId,
|
||||
} = activeViewportEnabledElement;
|
||||
const { viewportId: activeViewportId, renderingEngineId } = activeViewportEnabledElement;
|
||||
|
||||
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
||||
activeViewportId,
|
||||
renderingEngineId
|
||||
);
|
||||
const toolGroup = ToolGroupManager.getToolGroupForViewport(activeViewportId, renderingEngineId);
|
||||
|
||||
const toolModeAndBindings = Object.keys(toolGroup.toolOptions).reduce(
|
||||
(acc, toolName) => {
|
||||
const tool = toolGroup.toolOptions[toolName];
|
||||
const { mode, bindings } = tool;
|
||||
const toolModeAndBindings = Object.keys(toolGroup.toolOptions).reduce((acc, toolName) => {
|
||||
const tool = toolGroup.toolOptions[toolName];
|
||||
const { mode, bindings } = tool;
|
||||
|
||||
return {
|
||||
...acc,
|
||||
[toolName]: {
|
||||
mode,
|
||||
bindings,
|
||||
},
|
||||
};
|
||||
},
|
||||
{}
|
||||
);
|
||||
return {
|
||||
...acc,
|
||||
[toolName]: {
|
||||
mode,
|
||||
bindings,
|
||||
},
|
||||
};
|
||||
}, {});
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
@@ -64,9 +55,7 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
const enableViewport = viewportElement => {
|
||||
if (viewportElement) {
|
||||
const { renderingEngine, viewport } = getEnabledElement(
|
||||
activeViewportElement
|
||||
);
|
||||
const { renderingEngine, viewport } = getEnabledElement(activeViewportElement);
|
||||
|
||||
const viewportInput = {
|
||||
viewportId: VIEWPORT_ID,
|
||||
@@ -91,11 +80,7 @@ const CornerstoneViewportDownloadForm = ({
|
||||
}
|
||||
};
|
||||
|
||||
const updateViewportPreview = (
|
||||
downloadViewportElement,
|
||||
internalCanvas,
|
||||
fileType
|
||||
) =>
|
||||
const updateViewportPreview = (downloadViewportElement, internalCanvas, fileType) =>
|
||||
new Promise(resolve => {
|
||||
const enabledElement = getEnabledElement(downloadViewportElement);
|
||||
|
||||
@@ -133,10 +118,7 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
resolve({ dataUrl, width: newWidth, height: newHeight });
|
||||
|
||||
downloadViewportElement.removeEventListener(
|
||||
Enums.Events.IMAGE_RENDERED,
|
||||
updateViewport
|
||||
);
|
||||
downloadViewportElement.removeEventListener(Enums.Events.IMAGE_RENDERED, updateViewport);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -144,9 +126,7 @@ const CornerstoneViewportDownloadForm = ({
|
||||
const loadImage = (activeViewportElement, viewportElement, width, height) =>
|
||||
new Promise(resolve => {
|
||||
if (activeViewportElement && viewportElement) {
|
||||
const activeViewportEnabledElement = getEnabledElement(
|
||||
activeViewportElement
|
||||
);
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
if (!activeViewportEnabledElement) {
|
||||
return;
|
||||
@@ -165,10 +145,7 @@ const CornerstoneViewportDownloadForm = ({
|
||||
downloadViewport.setProperties(properties);
|
||||
|
||||
const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
|
||||
const newHeight = Math.min(
|
||||
height || image.height,
|
||||
MAX_TEXTURE_SIZE
|
||||
);
|
||||
const newHeight = Math.min(height || image.height, MAX_TEXTURE_SIZE);
|
||||
|
||||
resolve({ width: newWidth, height: newHeight });
|
||||
});
|
||||
@@ -190,31 +167,19 @@ const CornerstoneViewportDownloadForm = ({
|
||||
}
|
||||
});
|
||||
|
||||
const toggleAnnotations = (
|
||||
toggle,
|
||||
viewportElement,
|
||||
activeViewportElement
|
||||
) => {
|
||||
const activeViewportEnabledElement = getEnabledElement(
|
||||
activeViewportElement
|
||||
);
|
||||
const toggleAnnotations = (toggle, viewportElement, activeViewportElement) => {
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
const downloadViewportElement = getEnabledElement(viewportElement);
|
||||
|
||||
const {
|
||||
viewportId: activeViewportId,
|
||||
renderingEngineId,
|
||||
} = activeViewportEnabledElement;
|
||||
const { viewportId: activeViewportId, renderingEngineId } = activeViewportEnabledElement;
|
||||
const { viewportId: downloadViewportId } = downloadViewportElement;
|
||||
|
||||
if (!activeViewportEnabledElement || !downloadViewportElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const toolGroup = ToolGroupManager.getToolGroupForViewport(
|
||||
activeViewportId,
|
||||
renderingEngineId
|
||||
);
|
||||
const toolGroup = ToolGroupManager.getToolGroupForViewport(activeViewportId, renderingEngineId);
|
||||
|
||||
// add the viewport to the toolGroup
|
||||
toolGroup.addViewport(downloadViewportId, renderingEngineId);
|
||||
|
||||
@@ -98,22 +98,13 @@ export default class DicomFileUploader extends PubSubService {
|
||||
});
|
||||
},
|
||||
timeout: () => {
|
||||
this._reject(
|
||||
reject,
|
||||
new UploadRejection(UploadStatus.Failed, 'The request timed out.')
|
||||
);
|
||||
this._reject(reject, new UploadRejection(UploadStatus.Failed, 'The request timed out.'));
|
||||
},
|
||||
abort: () => {
|
||||
this._reject(
|
||||
reject,
|
||||
new UploadRejection(UploadStatus.Cancelled, 'Cancelled')
|
||||
);
|
||||
this._reject(reject, new UploadRejection(UploadStatus.Cancelled, 'Cancelled'));
|
||||
},
|
||||
error: () => {
|
||||
this._reject(
|
||||
reject,
|
||||
new UploadRejection(UploadStatus.Failed, 'The request failed.')
|
||||
);
|
||||
this._reject(reject, new UploadRejection(UploadStatus.Failed, 'The request failed.'));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -122,10 +113,7 @@ export default class DicomFileUploader extends PubSubService {
|
||||
.loadFileRequest(this._fileId)
|
||||
.then(dicomFile => {
|
||||
if (this._abortController.signal.aborted) {
|
||||
this._reject(
|
||||
reject,
|
||||
new UploadRejection(UploadStatus.Cancelled, 'Cancelled')
|
||||
);
|
||||
this._reject(reject, new UploadRejection(UploadStatus.Cancelled, 'Cancelled'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,10 +121,7 @@ export default class DicomFileUploader extends PubSubService {
|
||||
// The file is not DICOM
|
||||
this._reject(
|
||||
reject,
|
||||
new UploadRejection(
|
||||
UploadStatus.Failed,
|
||||
'Not a valid DICOM file.'
|
||||
)
|
||||
new UploadRejection(UploadStatus.Failed, 'Not a valid DICOM file.')
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -164,10 +149,7 @@ export default class DicomFileUploader extends PubSubService {
|
||||
}
|
||||
|
||||
private _isRejected(): boolean {
|
||||
return (
|
||||
this._status === UploadStatus.Failed ||
|
||||
this._status === UploadStatus.Cancelled
|
||||
);
|
||||
return this._status === UploadStatus.Failed || this._status === UploadStatus.Cancelled;
|
||||
}
|
||||
|
||||
private _reject(reject: (reason?: any) => void, reason: any) {
|
||||
|
||||
@@ -21,11 +21,7 @@ function callInputDialog(
|
||||
dialogConfig: any = {}
|
||||
) {
|
||||
const dialogId = 'dialog-enter-annotation';
|
||||
const label = data
|
||||
? isArrowAnnotateInputDialog
|
||||
? data.text
|
||||
: data.label
|
||||
: '';
|
||||
const label = data ? (isArrowAnnotateInputDialog ? data.text : data.label) : '';
|
||||
const {
|
||||
dialogTitle = 'Annotation',
|
||||
inputLabel = 'Enter your annotation',
|
||||
@@ -69,7 +65,7 @@ function callInputDialog(
|
||||
return (
|
||||
<Input
|
||||
autoFocus
|
||||
className="bg-black border-primary-main"
|
||||
className="border-primary-main bg-black"
|
||||
type="text"
|
||||
id="annotation"
|
||||
label={inputLabel}
|
||||
|
||||
@@ -8,9 +8,7 @@ const getImageId = imageObj => {
|
||||
return;
|
||||
}
|
||||
|
||||
return typeof imageObj.getImageId === 'function'
|
||||
? imageObj.getImageId()
|
||||
: imageObj.url;
|
||||
return typeof imageObj.getImageId === 'function' ? imageObj.getImageId() : imageObj.url;
|
||||
};
|
||||
|
||||
const findImageIdOnStudies = (studies, displaySetInstanceUID) => {
|
||||
@@ -163,9 +161,7 @@ class DicomLoaderService {
|
||||
getDicomDataMethod = fetchIt.bind(this, imageId);
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported image type: ${loaderType} for imageId: ${imageId}`
|
||||
);
|
||||
throw new Error(`Unsupported image type: ${loaderType} for imageId: ${imageId}`);
|
||||
}
|
||||
|
||||
return getDicomDataMethod();
|
||||
|
||||
@@ -3,9 +3,7 @@ import { IEnabledElement } from '@cornerstonejs/core/dist/esm/types';
|
||||
|
||||
import { getEnabledElement as OHIFgetEnabledElement } from '../state';
|
||||
|
||||
export default function getActiveViewportEnabledElement(
|
||||
viewportGridService
|
||||
): IEnabledElement {
|
||||
export default function getActiveViewportEnabledElement(viewportGridService): IEnabledElement {
|
||||
const { activeViewportId } = viewportGridService.getState();
|
||||
const { element } = OHIFgetEnabledElement(activeViewportId) || {};
|
||||
const enabledElement = getEnabledElement(element);
|
||||
|
||||
@@ -2,9 +2,7 @@ import { Enums } from '@cornerstonejs/core';
|
||||
|
||||
const MIP = 'mip';
|
||||
|
||||
export default function getCornerstoneBlendMode(
|
||||
blendMode: string
|
||||
): Enums.BlendModes {
|
||||
export default function getCornerstoneBlendMode(blendMode: string): Enums.BlendModes {
|
||||
if (!blendMode) {
|
||||
return Enums.BlendModes.COMPOSITE;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ const AXIAL = 'axial';
|
||||
const SAGITTAL = 'sagittal';
|
||||
const CORONAL = 'coronal';
|
||||
|
||||
export default function getCornerstoneOrientation(
|
||||
orientation: string
|
||||
): Enums.OrientationAxis {
|
||||
export default function getCornerstoneOrientation(orientation: string): Enums.OrientationAxis {
|
||||
if (orientation) {
|
||||
switch (orientation.toLowerCase()) {
|
||||
case AXIAL:
|
||||
|
||||
@@ -5,9 +5,7 @@ const VOLUME = 'volume';
|
||||
const ORTHOGRAPHIC = 'orthographic';
|
||||
const VOLUME_3D = 'volume3d';
|
||||
|
||||
export default function getCornerstoneViewportType(
|
||||
viewportType: string
|
||||
): Enums.ViewportType {
|
||||
export default function getCornerstoneViewportType(viewportType: string): Enums.ViewportType {
|
||||
const lowerViewportType = viewportType.toLowerCase();
|
||||
if (lowerViewportType === STACK) {
|
||||
return Enums.ViewportType.STACK;
|
||||
@@ -21,7 +19,5 @@ export default function getCornerstoneViewportType(
|
||||
return Enums.ViewportType.VOLUME_3D;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Invalid viewport type: ${viewportType}. Valid types are: stack, volume`
|
||||
);
|
||||
throw new Error(`Invalid viewport type: ${viewportType}. Valid types are: stack, volume`);
|
||||
}
|
||||
@@ -19,11 +19,7 @@ export default function getNthFrames(imageIds) {
|
||||
const centerEnd = centerStart + 6;
|
||||
|
||||
for (let i = 0; i < imageIds.length; i++) {
|
||||
if (
|
||||
i < 2 ||
|
||||
i > imageIds.length - 4 ||
|
||||
(i > centerStart && i < centerEnd)
|
||||
) {
|
||||
if (i < 2 || i > imageIds.length - 4 || (i > centerStart && i < centerEnd)) {
|
||||
frames[0].push(imageIds[i]);
|
||||
} else if (i % 7 === 2) {
|
||||
frames[1].push(imageIds[i]);
|
||||
@@ -33,12 +29,6 @@ export default function getNthFrames(imageIds) {
|
||||
frames[(i % 2) + 3].push(imageIds[i]);
|
||||
}
|
||||
}
|
||||
const ret = [
|
||||
...frames[0],
|
||||
...frames[1],
|
||||
...frames[2],
|
||||
...frames[3],
|
||||
...frames[4],
|
||||
];
|
||||
const ret = [...frames[0], ...frames[1], ...frames[2], ...frames[3], ...frames[4]];
|
||||
return ret;
|
||||
}
|
||||
@@ -105,9 +105,7 @@ export default function interleaveCenterLoader({
|
||||
const { imageId } = request;
|
||||
|
||||
AllRequests.forEach(volumeRequests => {
|
||||
const volumeImageIdRequest = volumeRequests.find(
|
||||
req => req.imageId === imageId
|
||||
);
|
||||
const volumeImageIdRequest = volumeRequests.find(req => req.imageId === imageId);
|
||||
if (volumeImageIdRequest) {
|
||||
finalRequests.push(volumeImageIdRequest);
|
||||
}
|
||||
@@ -117,31 +115,17 @@ export default function interleaveCenterLoader({
|
||||
const requestType = Enums.RequestType.Prefetch;
|
||||
const priority = 0;
|
||||
|
||||
finalRequests.forEach(
|
||||
({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(
|
||||
null,
|
||||
imageId,
|
||||
imageIdIndex,
|
||||
options
|
||||
);
|
||||
finalRequests.forEach(({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(null, imageId, imageIdIndex, options);
|
||||
|
||||
imageLoadPoolManager.addRequest(
|
||||
callLoadImageBound,
|
||||
requestType,
|
||||
additionalDetails,
|
||||
priority
|
||||
);
|
||||
}
|
||||
);
|
||||
imageLoadPoolManager.addRequest(callLoadImageBound, requestType, additionalDetails, priority);
|
||||
});
|
||||
|
||||
// clear the volumeIdMapsToLoad
|
||||
volumeIdMapsToLoad.clear();
|
||||
|
||||
// copy the viewportIdVolumeInputArrayMap
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(
|
||||
viewportIdVolumeInputArrayMap
|
||||
);
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(viewportIdVolumeInputArrayMap);
|
||||
|
||||
// reset the viewportIdVolumeInputArrayMap
|
||||
viewportIdVolumeInputArrayMap.clear();
|
||||
|
||||
@@ -94,9 +94,7 @@ export default function interleaveTopToBottom({
|
||||
const { imageId } = request;
|
||||
|
||||
AllRequests.forEach(volumeRequests => {
|
||||
const volumeImageIdRequest = volumeRequests.find(
|
||||
req => req.imageId === imageId
|
||||
);
|
||||
const volumeImageIdRequest = volumeRequests.find(req => req.imageId === imageId);
|
||||
if (volumeImageIdRequest) {
|
||||
finalRequests.push(volumeImageIdRequest);
|
||||
}
|
||||
@@ -106,31 +104,17 @@ export default function interleaveTopToBottom({
|
||||
const requestType = Enums.RequestType.Prefetch;
|
||||
const priority = 0;
|
||||
|
||||
finalRequests.forEach(
|
||||
({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(
|
||||
null,
|
||||
imageId,
|
||||
imageIdIndex,
|
||||
options
|
||||
);
|
||||
finalRequests.forEach(({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(null, imageId, imageIdIndex, options);
|
||||
|
||||
imageLoadPoolManager.addRequest(
|
||||
callLoadImageBound,
|
||||
requestType,
|
||||
additionalDetails,
|
||||
priority
|
||||
);
|
||||
}
|
||||
);
|
||||
imageLoadPoolManager.addRequest(callLoadImageBound, requestType, additionalDetails, priority);
|
||||
});
|
||||
|
||||
// clear the volumeIdMapsToLoad
|
||||
volumeIdMapsToLoad.clear();
|
||||
|
||||
// copy the viewportIdVolumeInputArrayMap
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(
|
||||
viewportIdVolumeInputArrayMap
|
||||
);
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(viewportIdVolumeInputArrayMap);
|
||||
|
||||
// reset the viewportIdVolumeInputArrayMap
|
||||
viewportIdVolumeInputArrayMap.clear();
|
||||
|
||||
@@ -32,11 +32,7 @@ const Angle = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -55,14 +51,10 @@ const Angle = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -99,16 +91,11 @@ function getMappedAnnotations(annotation, DisplaySetService) {
|
||||
const targetStats = cachedStats[targetId];
|
||||
|
||||
if (!referencedImageId) {
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -179,17 +166,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const displayText = [];
|
||||
|
||||
// Area is the same for all series
|
||||
const {
|
||||
angle,
|
||||
unit,
|
||||
SeriesNumber,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = mappedAnnotations[0];
|
||||
const { angle, unit, SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
@@ -202,9 +181,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
return displayText;
|
||||
}
|
||||
const roundedAngle = utils.roundNumber(angle, 2);
|
||||
displayText.push(
|
||||
`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -31,11 +31,7 @@ const Length = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
cornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -54,10 +50,7 @@ const Length = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
|
||||
@@ -91,11 +84,8 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
|
||||
const annotations = [];
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -126,9 +116,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
// Area is the same for all series
|
||||
const { SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
|
||||
@@ -27,11 +27,7 @@ const Bidirectional = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
cornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -50,14 +46,10 @@ const Bidirectional = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -94,16 +86,11 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
const targetStats = cachedStats[targetId];
|
||||
|
||||
if (!referencedImageId) {
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -175,19 +162,11 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const displayText = [];
|
||||
|
||||
// Area is the same for all series
|
||||
const {
|
||||
length,
|
||||
width,
|
||||
SeriesNumber,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = mappedAnnotations[0];
|
||||
const { length, width, SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
const roundedLength = utils.roundNumber(length, 2);
|
||||
const roundedWidth = utils.roundNumber(width, 2);
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
@@ -197,9 +176,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
|
||||
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
||||
|
||||
displayText.push(
|
||||
`L: ${roundedLength} mm (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
displayText.push(`L: ${roundedLength} mm (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
displayText.push(`W: ${roundedWidth} mm`);
|
||||
|
||||
return displayText;
|
||||
|
||||
@@ -25,11 +25,7 @@ const CircleROI = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -48,14 +44,10 @@ const CircleROI = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
DisplaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, DisplaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -93,16 +85,11 @@ function getMappedAnnotations(annotation, DisplaySetService) {
|
||||
|
||||
if (!referencedImageId) {
|
||||
// Todo: Non-acquisition plane measurement mapping not supported yet
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -150,12 +137,7 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
`max (${unit})`,
|
||||
`mean (${unit})`,
|
||||
`std (${unit})`,
|
||||
`area (mm2)`
|
||||
);
|
||||
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, `area (mm2)`);
|
||||
values.push(max, mean, stdDev, area);
|
||||
});
|
||||
|
||||
@@ -188,9 +170,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
// Area is the same for all series
|
||||
const { area, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
|
||||
@@ -32,11 +32,7 @@ const CobbAngle = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -55,14 +51,10 @@ const CobbAngle = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -99,16 +91,11 @@ function getMappedAnnotations(annotation, DisplaySetService) {
|
||||
const targetStats = cachedStats[targetId];
|
||||
|
||||
if (!referencedImageId) {
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -179,17 +166,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const displayText = [];
|
||||
|
||||
// Area is the same for all series
|
||||
const {
|
||||
angle,
|
||||
unit,
|
||||
SeriesNumber,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = mappedAnnotations[0];
|
||||
const { angle, unit, SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
@@ -202,9 +181,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
return displayText;
|
||||
}
|
||||
const roundedAngle = utils.roundNumber(angle, 2);
|
||||
displayText.push(
|
||||
`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,7 @@ const EllipticalROI = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
cornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -48,14 +44,10 @@ const EllipticalROI = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -93,16 +85,11 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
|
||||
if (!referencedImageId) {
|
||||
// Todo: Non-acquisition plane measurement mapping not supported yet
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -150,12 +137,7 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
`max (${unit})`,
|
||||
`mean (${unit})`,
|
||||
`std (${unit})`,
|
||||
`area (mm2)`
|
||||
);
|
||||
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, `area (mm2)`);
|
||||
values.push(max, mean, stdDev, area);
|
||||
});
|
||||
|
||||
@@ -188,9 +170,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
// Area is the same for all series
|
||||
const { area, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
|
||||
@@ -32,11 +32,7 @@ const Length = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
cornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -55,14 +51,10 @@ const Length = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
displaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -99,16 +91,11 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
const targetStats = cachedStats[targetId];
|
||||
|
||||
if (!referencedImageId) {
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -179,16 +166,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const displayText = [];
|
||||
|
||||
// Area is the same for all series
|
||||
const {
|
||||
length,
|
||||
SeriesNumber,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = mappedAnnotations[0];
|
||||
const { length, SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
@@ -202,9 +182,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
return displayText;
|
||||
}
|
||||
const roundedLength = utils.roundNumber(length, 2);
|
||||
displayText.push(
|
||||
`${roundedLength} mm (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
displayText.push(`${roundedLength} mm (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -31,11 +31,7 @@ const PlanarFreehandROI = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -54,14 +50,10 @@ const PlanarFreehandROI = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
DisplaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, DisplaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -96,10 +88,8 @@ function getMappedAnnotations(annotationData, DisplaySetService) {
|
||||
|
||||
const annotations = [];
|
||||
|
||||
const {
|
||||
SOPInstanceUID: _SOPInstanceUID,
|
||||
SeriesInstanceUID: _SeriesInstanceUID,
|
||||
} = getSOPInstanceAttributes(referencedImageId) || {};
|
||||
const { SOPInstanceUID: _SOPInstanceUID, SeriesInstanceUID: _SeriesInstanceUID } =
|
||||
getSOPInstanceAttributes(referencedImageId) || {};
|
||||
|
||||
if (!_SOPInstanceUID || !_SeriesInstanceUID) {
|
||||
return annotations;
|
||||
|
||||
@@ -25,11 +25,7 @@ const RectangleROI = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -48,14 +44,10 @@ const RectangleROI = {
|
||||
|
||||
const { points } = data.handles;
|
||||
|
||||
const mappedAnnotations = getMappedAnnotations(
|
||||
annotation,
|
||||
DisplaySetService
|
||||
);
|
||||
const mappedAnnotations = getMappedAnnotations(annotation, DisplaySetService);
|
||||
|
||||
const displayText = getDisplayText(mappedAnnotations, displaySet);
|
||||
const getReport = () =>
|
||||
_getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
|
||||
|
||||
return {
|
||||
uid: annotationUID,
|
||||
@@ -93,16 +85,11 @@ function getMappedAnnotations(annotation, DisplaySetService) {
|
||||
|
||||
if (!referencedImageId) {
|
||||
// Todo: Non-acquisition plane measurement mapping not supported yet
|
||||
throw new Error(
|
||||
'Non-acquisition plane measurement mapping not supported'
|
||||
);
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -150,12 +137,7 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
`max (${unit})`,
|
||||
`mean (${unit})`,
|
||||
`std (${unit})`,
|
||||
`area (mm2)`
|
||||
);
|
||||
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, `area (mm2)`);
|
||||
values.push(max, mean, stdDev, area);
|
||||
});
|
||||
|
||||
@@ -188,9 +170,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
// Area is the same for all series
|
||||
const { area, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
|
||||
const instance = displaySet.images.find(
|
||||
image => image.SOPInstanceUID === SOPInstanceUID
|
||||
);
|
||||
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
|
||||
|
||||
let InstanceNumber;
|
||||
if (instance) {
|
||||
|
||||
+2
-9
@@ -23,15 +23,8 @@ const measurementServiceMappingsFactory = (
|
||||
*/
|
||||
|
||||
const _getValueTypeFromToolType = toolType => {
|
||||
const {
|
||||
POLYLINE,
|
||||
ELLIPSE,
|
||||
CIRCLE,
|
||||
RECTANGLE,
|
||||
BIDIRECTIONAL,
|
||||
POINT,
|
||||
ANGLE,
|
||||
} = MeasurementService.VALUE_TYPES;
|
||||
const { POLYLINE, ELLIPSE, CIRCLE, RECTANGLE, BIDIRECTIONAL, POINT, ANGLE } =
|
||||
MeasurementService.VALUE_TYPES;
|
||||
|
||||
// TODO -> I get why this was attempted, but its not nearly flexible enough.
|
||||
// A single measurement may have an ellipse + a bidirectional measurement, for instances.
|
||||
|
||||
@@ -18,24 +18,16 @@ function setAnnotationSelected(annotationUID: string, selected: boolean): void {
|
||||
const isCurrentSelected = isAnnotationSelected(annotationUID);
|
||||
// branch cut, avoid invoking imaging library unnecessarily.
|
||||
if (isCurrentSelected !== selected) {
|
||||
cs3dToolAnnotationUtils.selection.setAnnotationSelected(
|
||||
annotationUID,
|
||||
selected
|
||||
);
|
||||
cs3dToolAnnotationUtils.selection.setAnnotationSelected(annotationUID, selected);
|
||||
}
|
||||
}
|
||||
|
||||
function getFirstAnnotationSelected(element) {
|
||||
const [selectedAnnotationUID] =
|
||||
cs3dToolAnnotationUtils.selection.getAnnotationsSelected() || [];
|
||||
const [selectedAnnotationUID] = cs3dToolAnnotationUtils.selection.getAnnotationsSelected() || [];
|
||||
|
||||
if (selectedAnnotationUID) {
|
||||
return cs3dToolAnnotationUtils.state.getAnnotation(selectedAnnotationUID);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
isAnnotationSelected,
|
||||
setAnnotationSelected,
|
||||
getFirstAnnotationSelected,
|
||||
};
|
||||
export { isAnnotationSelected, setAnnotationSelected, getFirstAnnotationSelected };
|
||||
@@ -51,9 +51,7 @@ export default function interleaveNthLoader({
|
||||
.map(volume => volume.getImageLoadRequests())
|
||||
.filter(requests => requests?.[0]?.imageId);
|
||||
|
||||
const orderedRequests = originalRequests.map(request =>
|
||||
getNthFrames(request)
|
||||
);
|
||||
const orderedRequests = originalRequests.map(request => getNthFrames(request));
|
||||
|
||||
// set the finalRequests to the imageLoadPoolManager
|
||||
const finalRequests = interleave(orderedRequests);
|
||||
@@ -61,31 +59,17 @@ export default function interleaveNthLoader({
|
||||
const requestType = Enums.RequestType.Prefetch;
|
||||
const priority = 0;
|
||||
|
||||
finalRequests.forEach(
|
||||
({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(
|
||||
null,
|
||||
imageId,
|
||||
imageIdIndex,
|
||||
options
|
||||
);
|
||||
finalRequests.forEach(({ callLoadImage, additionalDetails, imageId, imageIdIndex, options }) => {
|
||||
const callLoadImageBound = callLoadImage.bind(null, imageId, imageIdIndex, options);
|
||||
|
||||
imageLoadPoolManager.addRequest(
|
||||
callLoadImageBound,
|
||||
requestType,
|
||||
additionalDetails,
|
||||
priority
|
||||
);
|
||||
}
|
||||
);
|
||||
imageLoadPoolManager.addRequest(callLoadImageBound, requestType, additionalDetails, priority);
|
||||
});
|
||||
|
||||
// clear the volumeIdMapsToLoad
|
||||
volumeIdMapsToLoad.clear();
|
||||
|
||||
// copy the viewportIdVolumeInputArrayMap
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(
|
||||
viewportIdVolumeInputArrayMap
|
||||
);
|
||||
const viewportIdVolumeInputArrayMapCopy = new Map(viewportIdVolumeInputArrayMap);
|
||||
|
||||
// reset the viewportIdVolumeInputArrayMap
|
||||
viewportIdVolumeInputArrayMap.clear();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { segmentation } from '@cornerstonejs/tools';
|
||||
|
||||
function removeToolGroupSegmentationRepresentations(toolGroupId) {
|
||||
const representations = segmentation.state.getSegmentationRepresentations(
|
||||
toolGroupId
|
||||
);
|
||||
const representations = segmentation.state.getSegmentationRepresentations(toolGroupId);
|
||||
|
||||
if (!representations || !representations.length) {
|
||||
return;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Types, getRenderingEngine, utilities } from '@cornerstonejs/core';
|
||||
|
||||
export default function calculateViewportRegistrations(
|
||||
viewports: Types.IViewportId[]
|
||||
) {
|
||||
export default function calculateViewportRegistrations(viewports: Types.IViewportId[]) {
|
||||
const viewportPairs = _getViewportPairs(viewports);
|
||||
|
||||
for (const [viewport, nextViewport] of viewportPairs) {
|
||||
|
||||
@@ -6,28 +6,16 @@ import calculateViewportRegistrations from './calculateViewportRegistrations';
|
||||
// ]}
|
||||
let STACK_IMAGE_SYNC_GROUPS_INFO = [];
|
||||
|
||||
export default function toggleStackImageSync({
|
||||
toggledState,
|
||||
servicesManager,
|
||||
getEnabledElement,
|
||||
}) {
|
||||
const {
|
||||
syncGroupService,
|
||||
viewportGridService,
|
||||
displaySetService,
|
||||
cornerstoneViewportService,
|
||||
} = servicesManager.services;
|
||||
export default function toggleStackImageSync({ toggledState, servicesManager, getEnabledElement }) {
|
||||
const { syncGroupService, viewportGridService, displaySetService, cornerstoneViewportService } =
|
||||
servicesManager.services;
|
||||
|
||||
if (!toggledState) {
|
||||
STACK_IMAGE_SYNC_GROUPS_INFO.forEach(syncGroupInfo => {
|
||||
const { viewports, synchronizerId } = syncGroupInfo;
|
||||
|
||||
viewports.forEach(({ viewportId, renderingEngineId }) => {
|
||||
syncGroupService.removeViewportFromSyncGroup(
|
||||
viewportId,
|
||||
renderingEngineId,
|
||||
synchronizerId
|
||||
);
|
||||
syncGroupService.removeViewportFromSyncGroup(viewportId, renderingEngineId, synchronizerId);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,9 +35,7 @@ export default function toggleStackImageSync({
|
||||
const { displaySetInstanceUIDs } = viewport;
|
||||
|
||||
for (const displaySetInstanceUID of displaySetInstanceUIDs) {
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
|
||||
|
||||
return !!displaySet?.isReconstructable;
|
||||
}
|
||||
@@ -64,8 +50,7 @@ export default function toggleStackImageSync({
|
||||
}
|
||||
|
||||
const { element } = cornerstoneViewportService.getViewportInfo(viewportId);
|
||||
const { viewport: csViewport, renderingEngineId } =
|
||||
getEnabledElement(element);
|
||||
const { viewport: csViewport, renderingEngineId } = getEnabledElement(element);
|
||||
const { viewPlaneNormal } = csViewport.getCamera();
|
||||
|
||||
// Should we round here? I guess so, but not sure how much precision we need
|
||||
@@ -82,9 +67,7 @@ export default function toggleStackImageSync({
|
||||
|
||||
// create synchronizer for each group
|
||||
Object.values(viewportsByOrientation).map(viewports => {
|
||||
let synchronizerId = viewports
|
||||
.map(({ viewportId }) => viewportId)
|
||||
.join(',');
|
||||
let synchronizerId = viewports.map(({ viewportId }) => viewportId).join(',');
|
||||
|
||||
synchronizerId = `imageSync_${synchronizerId}`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user