feat: add support to scoord3d (#5016)
Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
1 parent
af40f06524
commit
735405a855
73 files changed
+1032
-993
No files matched your search
@@ -3,20 +3,17 @@ import { Enums } from '@cornerstonejs/core';
|
||||
|
||||
import OrientationAxis = Enums.OrientationAxis;
|
||||
|
||||
export const isReferenceViewable = ({
|
||||
viewportId,
|
||||
reference,
|
||||
viewportOptions,
|
||||
servicesManager,
|
||||
}) => {
|
||||
export const isReferenceViewable = (servicesManager, viewportId, reference, viewportOptions?) => {
|
||||
const { cornerstoneViewportService, displaySetService } = servicesManager.services;
|
||||
|
||||
if (!viewportOptions) {
|
||||
const viewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
||||
|
||||
// we can make a customization for this to allow
|
||||
// we can make a customization for this to allow specific settings
|
||||
// The annotation can be seen either via navigation or by changing to a volume
|
||||
const isViewable = viewport.isReferenceViewable(reference, {
|
||||
withNavigation: true,
|
||||
asVolume: true,
|
||||
});
|
||||
|
||||
return isViewable;
|
||||
|
||||
@@ -83,7 +83,7 @@ const Bidirectional = {
|
||||
|
||||
function getMappedAnnotations(annotation, displaySetService) {
|
||||
const { metadata, data } = annotation;
|
||||
const { cachedStats } = data;
|
||||
const { cachedStats = {} } = data;
|
||||
const { referencedImageId } = metadata;
|
||||
const targets = Object.keys(cachedStats);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ const CircleROI = {
|
||||
|
||||
function getMappedAnnotations(annotation, displaySetService) {
|
||||
const { metadata, data } = annotation;
|
||||
const { cachedStats } = data;
|
||||
const { cachedStats={} } = data;
|
||||
const { referencedImageId } = metadata;
|
||||
const targets = Object.keys(cachedStats);
|
||||
|
||||
|
||||
@@ -92,6 +92,11 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
const { metadata, data } = annotation;
|
||||
const { cachedStats } = data;
|
||||
const { referencedImageId } = metadata;
|
||||
|
||||
if( !cachedStats ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targets = Object.keys(cachedStats);
|
||||
|
||||
if (!targets.length) {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { getIsLocked } from './utils/getIsLocked';
|
||||
import { getIsVisible } from './utils/getIsVisible';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
import { config } from '@cornerstonejs/tools/annotation';
|
||||
|
||||
const Length = {
|
||||
toAnnotation: measurement => {},
|
||||
@@ -78,7 +77,6 @@ const Length = {
|
||||
isLocked,
|
||||
isVisible,
|
||||
metadata,
|
||||
// color,
|
||||
referenceSeriesUID: SeriesInstanceUID,
|
||||
referenceStudyUID: StudyInstanceUID,
|
||||
referencedImageId,
|
||||
|
||||
@@ -95,6 +95,11 @@ function getMappedAnnotations(annotation, displaySetService) {
|
||||
const { metadata, data } = annotation;
|
||||
const { cachedStats } = data;
|
||||
const { referencedImageId } = metadata;
|
||||
|
||||
if( !cachedStats ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targets = Object.keys(cachedStats);
|
||||
|
||||
if (!targets.length) {
|
||||
|
||||
@@ -211,9 +211,11 @@ function getDisplayText(mappedAnnotations, displaySet, customizationService) {
|
||||
mappedAnnotations.forEach(mappedAnnotation => {
|
||||
const { unit, max, SeriesNumber } = mappedAnnotation;
|
||||
|
||||
const maxStr = getStatisticDisplayString(max, unit, 'max');
|
||||
if (Number.isFinite(max)) {
|
||||
const maxStr = getStatisticDisplayString(max, unit, 'max');
|
||||
|
||||
displayText.primary.push(maxStr);
|
||||
displayText.primary.push(maxStr);
|
||||
}
|
||||
displayText.secondary.push(`S: ${SeriesNumber}${instanceText}${frameText}`);
|
||||
});
|
||||
|
||||
|
||||
+32
-5
@@ -1,5 +1,36 @@
|
||||
import * as cornerstone from '@cornerstonejs/core';
|
||||
|
||||
function getDisplaySet({ metadata, displaySetService }) {
|
||||
const { volumeId } = metadata;
|
||||
|
||||
if( volumeId ) {
|
||||
const displaySet = displaySetService.getDisplaySetsBy(displaySet =>
|
||||
volumeId.includes(displaySet.uid)
|
||||
)[0];
|
||||
if( displaySet ) {
|
||||
return displaySet;
|
||||
}
|
||||
console.warn("Unable to find volumeId", volumeId);
|
||||
metadata.volumeId = null;
|
||||
}
|
||||
|
||||
if (!metadata.FrameOfReferenceUID) {
|
||||
throw new Error(
|
||||
'No volumeId and no FrameOfReferenceUID provided. Could not find matching displaySet.'
|
||||
);
|
||||
}
|
||||
const displaySet = Array.from(displaySetService.getDisplaySetCache().values()).find(
|
||||
ds => ds.instance?.FrameOfReferenceUID === metadata.FrameOfReferenceUID
|
||||
);
|
||||
|
||||
if (!displaySet) {
|
||||
throw new Error('Could not find matching displaySet for the provided FrameOfReferenceUID.');
|
||||
}
|
||||
|
||||
return displaySet;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* It checks if the imageId is provided then it uses it to query
|
||||
* the metadata and get the SOPInstanceUID, SeriesInstanceUID and StudyInstanceUID.
|
||||
@@ -13,11 +44,7 @@ export default function getSOPInstanceAttributes(imageId, displaySetService, ann
|
||||
}
|
||||
|
||||
const { metadata } = annotation;
|
||||
const { volumeId } = metadata;
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetsBy(displaySet =>
|
||||
volumeId.includes(displaySet.uid)
|
||||
)[0];
|
||||
const displaySet = getDisplaySet({ metadata, displaySetService });
|
||||
const { StudyInstanceUID, SeriesInstanceUID } = displaySet;
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user