OHIF with Cornerstone3D 2.0 (#4347)
This commit is contained in:
1 parent
8981a61b8c
commit
7ce7127d7c
803 files changed
+32760
-15893
No files matched your search
@@ -50,7 +50,10 @@ const combineFrameInstance = (frame, instance) => {
|
||||
|
||||
// Todo: we should cache this combined instance somewhere, maybe add it
|
||||
// back to the dicomMetaStore so we don't have to do this again.
|
||||
return newInstance;
|
||||
return {
|
||||
...newInstance,
|
||||
ImagePositionPatient: newInstance.ImagePositionPatient ?? [0, 0, frameNumber],
|
||||
};
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
* @returns tabs - The prop object expected by the StudyBrowser component
|
||||
*/
|
||||
|
||||
export function createStudyBrowserTabs(primaryStudyInstanceUIDs, studyDisplayList, displaySets, recentTimeframeMS = 31536000000) {
|
||||
export function createStudyBrowserTabs(
|
||||
primaryStudyInstanceUIDs,
|
||||
studyDisplayList,
|
||||
displaySets,
|
||||
recentTimeframeMS = 31536000000
|
||||
) {
|
||||
const primaryStudies = [];
|
||||
const allStudies = [];
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ export default function getImageId(instance, frame, thumbnail = false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.imageId && frame === undefined) {
|
||||
return instance.imageId;
|
||||
}
|
||||
|
||||
if (typeof instance.getImageId === 'function') {
|
||||
return instance.getImageId();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ describe('Top level exports', () => {
|
||||
'resolveObjectPath',
|
||||
'hierarchicalListUtils',
|
||||
'progressTrackingUtils',
|
||||
'subscribeToNextViewportGridChange',
|
||||
'uuidv4',
|
||||
'addAccessors',
|
||||
].sort();
|
||||
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
sortingCriteria,
|
||||
seriesSortCriteria,
|
||||
} from './sortStudy';
|
||||
import { subscribeToNextViewportGridChange } from './subscribeToNextViewportGridChange';
|
||||
import { splitComma, getSplitParam } from './splitComma';
|
||||
import { createStudyBrowserTabs } from './createStudyBrowserTabs';
|
||||
import { sopClassDictionary } from './sopClassDictionary';
|
||||
@@ -81,7 +80,6 @@ const utils = {
|
||||
debounce,
|
||||
roundNumber,
|
||||
downloadCSVReport,
|
||||
subscribeToNextViewportGridChange,
|
||||
splitComma,
|
||||
getSplitParam,
|
||||
generateAcceptHeader,
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
function roundNumber(value, precision = 2) {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((v) => roundNumber(v, precision)).join(", ");
|
||||
return value.map(v => roundNumber(v, precision)).join(', ');
|
||||
}
|
||||
if (value === undefined || value === null || value === "") {
|
||||
return "NaN";
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return 'NaN';
|
||||
}
|
||||
value = Number(value);
|
||||
const absValue = Math.abs(value);
|
||||
@@ -27,16 +27,16 @@ function roundNumber(value, precision = 2) {
|
||||
absValue >= 100
|
||||
? precision - 2
|
||||
: absValue >= 10
|
||||
? precision - 1
|
||||
: absValue >= 1
|
||||
? precision
|
||||
: absValue >= 0.1
|
||||
? precision + 1
|
||||
: absValue >= 0.01
|
||||
? precision + 2
|
||||
: absValue >= 0.001
|
||||
? precision + 3
|
||||
: precision + 4;
|
||||
? precision - 1
|
||||
: absValue >= 1
|
||||
? precision
|
||||
: absValue >= 0.1
|
||||
? precision + 1
|
||||
: absValue >= 0.01
|
||||
? precision + 2
|
||||
: absValue >= 0.001
|
||||
? precision + 3
|
||||
: precision + 4;
|
||||
return value.toFixed(fixedPrecision);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { ViewportGridService } from '../services';
|
||||
|
||||
/**
|
||||
* Subscribes to the very next LAYOUT_CHANGED event that
|
||||
* is not currently on the event queue. The subscriptions are made on a 'zero'
|
||||
* timeout so as to avoid responding to any of those events currently on the event queue.
|
||||
* The subscription persists only for a single invocation of either event.
|
||||
* Once either event is fired, the subscriptions are unsubscribed.
|
||||
* @param viewportGridService the viewport grid service to subscribe to
|
||||
* @param gridChangeCallback the callback
|
||||
*/
|
||||
function subscribeToNextViewportGridChange(
|
||||
viewportGridService: ViewportGridService,
|
||||
gridChangeCallback: (arg: unknown) => void
|
||||
): void {
|
||||
const subscriber = () => {
|
||||
const callback = (callbackProps: unknown) => {
|
||||
subscriptions.forEach(subscription => subscription.unsubscribe());
|
||||
gridChangeCallback(callbackProps);
|
||||
};
|
||||
|
||||
const subscriptions = [
|
||||
viewportGridService.subscribe(viewportGridService.EVENTS.LAYOUT_CHANGED, callback),
|
||||
];
|
||||
};
|
||||
|
||||
window.setTimeout(subscriber, 0);
|
||||
}
|
||||
|
||||
export { subscribeToNextViewportGridChange };
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
export default function toNumber(val) {
|
||||
if (Array.isArray(val)) {
|
||||
return val.map(v => (v !== undefined ? Number(v) : v));
|
||||
return [...val].map(v => (v !== undefined ? Number(v) : v));
|
||||
} else {
|
||||
return val !== undefined ? Number(val) : val;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user