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
@@ -13,9 +13,7 @@ describe('absoluteUrl', () => {
|
||||
writable: true,
|
||||
});
|
||||
const absoluteUrlOutput = absoluteUrl('/path_3/path_to_destination');
|
||||
expect(absoluteUrlOutput).toEqual(
|
||||
'/path_1/path_2/path_3/path_to_destination'
|
||||
);
|
||||
expect(absoluteUrlOutput).toEqual('/path_1/path_2/path_3/path_to_destination');
|
||||
});
|
||||
|
||||
test('should return / when the path is not defined', () => {
|
||||
|
||||
@@ -9,24 +9,21 @@
|
||||
* single frame data. (eg frame is undefined is the same as frame===1).
|
||||
*/
|
||||
const combineFrameInstance = (frame, instance) => {
|
||||
const {
|
||||
PerFrameFunctionalGroupsSequence,
|
||||
SharedFunctionalGroupsSequence,
|
||||
NumberOfFrames,
|
||||
} = instance;
|
||||
const { PerFrameFunctionalGroupsSequence, SharedFunctionalGroupsSequence, NumberOfFrames } =
|
||||
instance;
|
||||
|
||||
if (PerFrameFunctionalGroupsSequence || NumberOfFrames > 1) {
|
||||
const frameNumber = Number.parseInt(frame || 1);
|
||||
const shared = (SharedFunctionalGroupsSequence
|
||||
? Object.values(SharedFunctionalGroupsSequence[0])
|
||||
: []
|
||||
const shared = (
|
||||
SharedFunctionalGroupsSequence ? Object.values(SharedFunctionalGroupsSequence[0]) : []
|
||||
)
|
||||
.filter(it => !!it)
|
||||
.map(it => it[0])
|
||||
.filter(it => it !== undefined && typeof it === 'object');
|
||||
const perFrame = (PerFrameFunctionalGroupsSequence
|
||||
? Object.values(PerFrameFunctionalGroupsSequence[frameNumber - 1])
|
||||
: []
|
||||
const perFrame = (
|
||||
PerFrameFunctionalGroupsSequence
|
||||
? Object.values(PerFrameFunctionalGroupsSequence[frameNumber - 1])
|
||||
: []
|
||||
)
|
||||
.filter(it => !!it)
|
||||
.map(it => it[0])
|
||||
@@ -34,19 +31,12 @@ const combineFrameInstance = (frame, instance) => {
|
||||
|
||||
// this is to fix NM multiframe datasets with position and orientation
|
||||
// information inside DetectorInformationSequence
|
||||
if (
|
||||
!instance.ImageOrientationPatient &&
|
||||
instance.DetectorInformationSequence
|
||||
) {
|
||||
if (!instance.ImageOrientationPatient && instance.DetectorInformationSequence) {
|
||||
instance.ImageOrientationPatient =
|
||||
instance.DetectorInformationSequence[0].ImageOrientationPatient;
|
||||
}
|
||||
if (
|
||||
!instance.ImagePositionPatient &&
|
||||
instance.DetectorInformationSequence
|
||||
) {
|
||||
instance.ImagePositionPatient =
|
||||
instance.DetectorInformationSequence[0].ImagePositionPatient;
|
||||
if (!instance.ImagePositionPatient && instance.DetectorInformationSequence) {
|
||||
instance.ImagePositionPatient = instance.DetectorInformationSequence[0].ImagePositionPatient;
|
||||
}
|
||||
|
||||
const newInstance = Object.assign(instance, { frameNumber: frameNumber });
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// leading edge, instead of the trailing.
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
return function () {
|
||||
var context = this,
|
||||
args = arguments;
|
||||
var later = function() {
|
||||
var later = function () {
|
||||
timeout = null;
|
||||
if (!immediate) {
|
||||
func.apply(context, args);
|
||||
|
||||
@@ -17,22 +17,14 @@ export default function downloadCSVReport(measurementData) {
|
||||
|
||||
const reportMap = {};
|
||||
measurementData.forEach(measurement => {
|
||||
const {
|
||||
referenceStudyUID,
|
||||
referenceSeriesUID,
|
||||
getReport,
|
||||
uid,
|
||||
} = measurement;
|
||||
const { referenceStudyUID, referenceSeriesUID, getReport, uid } = measurement;
|
||||
|
||||
if (!getReport) {
|
||||
console.warn('Measurement does not have a getReport function');
|
||||
return;
|
||||
}
|
||||
|
||||
const seriesMetadata = DicomMetadataStore.getSeries(
|
||||
referenceStudyUID,
|
||||
referenceSeriesUID
|
||||
);
|
||||
const seriesMetadata = DicomMetadataStore.getSeries(referenceStudyUID, referenceSeriesUID);
|
||||
|
||||
const commonRowItems = _getCommonRowItems(measurement, seriesMetadata);
|
||||
const report = getReport(measurement);
|
||||
@@ -57,9 +49,7 @@ export default function downloadCSVReport(measurementData) {
|
||||
|
||||
const results = _mapReportsToRowArray(reportMap, columns);
|
||||
|
||||
let csvContent =
|
||||
'data:text/csv;charset=utf-8,' +
|
||||
results.map(res => res.join(',')).join('\n');
|
||||
let csvContent = 'data:text/csv;charset=utf-8,' + results.map(res => res.join(',')).join('\n');
|
||||
|
||||
_createAndDownloadFile(csvContent);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,7 @@ const generateAcceptHeader = (
|
||||
return quotedParam;
|
||||
}
|
||||
if (mime.startsWith('transfer-syntax=')) {
|
||||
const quotedParam =
|
||||
'transfer-syntax="' + mime.substring(16, mime.length) + '"';
|
||||
const quotedParam = 'transfer-syntax="' + mime.substring(16, mime.length) + '"';
|
||||
return quotedParam;
|
||||
} else {
|
||||
return mime;
|
||||
|
||||
@@ -38,11 +38,7 @@ export default function getImageId(instance, frame, thumbnail = false) {
|
||||
|
||||
const renderingAttr = thumbnail ? 'thumbnailRendering' : 'imageRendering';
|
||||
|
||||
if (
|
||||
!instance[renderingAttr] ||
|
||||
instance[renderingAttr] === 'wadouri' ||
|
||||
!instance.wadorsuri
|
||||
) {
|
||||
if (!instance[renderingAttr] || instance[renderingAttr] === 'wadouri' || !instance.wadorsuri) {
|
||||
let imageId = 'dicomweb:' + instance.wadouri;
|
||||
if (frame !== undefined) {
|
||||
imageId += '&frame=' + frame;
|
||||
|
||||
@@ -103,7 +103,7 @@ function print(list) {
|
||||
let text = '';
|
||||
if (Array.isArray(list)) {
|
||||
let prev = [];
|
||||
forEachValue(list, function(...args) {
|
||||
forEachValue(list, function (...args) {
|
||||
let prevLen = prev.length;
|
||||
for (let i = 0, l = args.length; i < l; ++i) {
|
||||
if (i < prevLen && args[i] === prev[i]) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { addToList, forEach, getItem, print } from './hierarchicalListUtils';
|
||||
|
||||
describe('hierarchicalListUtils', function() {
|
||||
describe('hierarchicalListUtils', function () {
|
||||
let sharedList;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
sharedList = [
|
||||
['1.2.3.1', ['1.2.3.1.1', '1.2.3.1.2']],
|
||||
'1.2.3.2',
|
||||
@@ -11,14 +11,14 @@ describe('hierarchicalListUtils', function() {
|
||||
];
|
||||
});
|
||||
|
||||
describe('getItem', function() {
|
||||
it('should retrieve elements from a list by index', function() {
|
||||
describe('getItem', function () {
|
||||
it('should retrieve elements from a list by index', function () {
|
||||
expect(getItem(sharedList, 0)).toBe('1.2.3.1');
|
||||
expect(getItem(sharedList, 1)).toBe('1.2.3.2');
|
||||
expect(getItem(sharedList, 2)).toBe('1.2.3.3');
|
||||
expect(getItem(sharedList, 3)).toBeUndefined();
|
||||
});
|
||||
it('should retrieve elements from a list by path', function() {
|
||||
it('should retrieve elements from a list by path', function () {
|
||||
expect(getItem(sharedList, '0')).toBe('1.2.3.1');
|
||||
expect(getItem(sharedList, '0/0')).toBe('1.2.3.1.1');
|
||||
expect(getItem(sharedList, '0/1')).toBe('1.2.3.1.2');
|
||||
@@ -35,8 +35,8 @@ describe('hierarchicalListUtils', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('addToList', function() {
|
||||
it('should support adding elements to a list hierarchically', function() {
|
||||
describe('addToList', function () {
|
||||
it('should support adding elements to a list hierarchically', function () {
|
||||
const list = [];
|
||||
addToList(list, '1.2.3.1', '1.2.3.1.1');
|
||||
addToList(list, '1.2.3.1', '1.2.3.1.2');
|
||||
@@ -46,7 +46,7 @@ describe('hierarchicalListUtils', function() {
|
||||
addToList(list, '1.2.3.3', '1.2.3.3.2', '1.2.3.3.2.2');
|
||||
expect(list).toStrictEqual(sharedList);
|
||||
});
|
||||
it('should change leaf nodes into non-leaf nodes', function() {
|
||||
it('should change leaf nodes into non-leaf nodes', function () {
|
||||
const listw = [];
|
||||
const listx = [['x.1', ['x.1.1', 'x.1.2']], 'x.2'];
|
||||
const listy = [
|
||||
@@ -64,8 +64,8 @@ describe('hierarchicalListUtils', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('forEach', function() {
|
||||
it('should iterate through all leaf nodes of the tree', function() {
|
||||
describe('forEach', function () {
|
||||
it('should iterate through all leaf nodes of the tree', function () {
|
||||
const fn = jest.fn();
|
||||
forEach(sharedList, fn);
|
||||
expect(fn).toHaveBeenCalledTimes(6);
|
||||
@@ -78,8 +78,8 @@ describe('hierarchicalListUtils', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('print', function() {
|
||||
it('should pretty-print the hierarchical list', function() {
|
||||
describe('print', function () {
|
||||
it('should pretty-print the hierarchical list', function () {
|
||||
expect(print(sharedList)).toBe(
|
||||
'1.2.3.1\n' +
|
||||
' 1.2.3.1.1\n' +
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
export default function pausePlugin(Mousetrap) {
|
||||
var _originalStopCallback = Mousetrap.prototype.stopCallback;
|
||||
|
||||
Mousetrap.prototype.stopCallback = function(e, element, combo) {
|
||||
Mousetrap.prototype.stopCallback = function (e, element, combo) {
|
||||
var self = this;
|
||||
|
||||
if (self.paused) {
|
||||
@@ -18,12 +18,12 @@ export default function pausePlugin(Mousetrap) {
|
||||
return _originalStopCallback.call(self, e, element, combo);
|
||||
};
|
||||
|
||||
Mousetrap.prototype.pause = function() {
|
||||
Mousetrap.prototype.pause = function () {
|
||||
var self = this;
|
||||
self.paused = true;
|
||||
};
|
||||
|
||||
Mousetrap.prototype.unpause = function() {
|
||||
Mousetrap.prototype.unpause = function () {
|
||||
var self = this;
|
||||
self.paused = false;
|
||||
};
|
||||
|
||||
@@ -122,7 +122,7 @@ export default function recordPlugin(Mousetrap, options = { timeout: 100 }) {
|
||||
*/
|
||||
function _normalizeSequence(sequence) {
|
||||
for (let i = 0; i < sequence.length; ++i) {
|
||||
sequence[i].sort(function(x, y) {
|
||||
sequence[i].sort(function (x, y) {
|
||||
// modifier keys always come first, in alphabetical order
|
||||
if (x.length > 1 && y.length === 1) {
|
||||
return -1;
|
||||
@@ -177,10 +177,10 @@ export default function recordPlugin(Mousetrap, options = { timeout: 100 }) {
|
||||
* @param {Function} callback
|
||||
* @returns void
|
||||
*/
|
||||
Mousetrap.prototype.record = function(callback) {
|
||||
Mousetrap.prototype.record = function (callback) {
|
||||
var self = this;
|
||||
self.recording = true;
|
||||
_recordedSequenceCallback = function() {
|
||||
_recordedSequenceCallback = function () {
|
||||
self.recording = false;
|
||||
callback.apply(self, arguments);
|
||||
};
|
||||
@@ -192,7 +192,7 @@ export default function recordPlugin(Mousetrap, options = { timeout: 100 }) {
|
||||
* @param {Function} callback
|
||||
* @returns void
|
||||
*/
|
||||
Mousetrap.prototype.stopRecord = function() {
|
||||
Mousetrap.prototype.stopRecord = function () {
|
||||
var self = this;
|
||||
self.recording = false;
|
||||
};
|
||||
@@ -203,11 +203,11 @@ export default function recordPlugin(Mousetrap, options = { timeout: 100 }) {
|
||||
* @param {Function} callback
|
||||
* @returns void
|
||||
*/
|
||||
Mousetrap.prototype.startRecording = function() {
|
||||
Mousetrap.prototype.startRecording = function () {
|
||||
var self = this;
|
||||
self.recording = true;
|
||||
};
|
||||
Mousetrap.prototype.handleKey = function() {
|
||||
Mousetrap.prototype.handleKey = function () {
|
||||
var self = this;
|
||||
_handleKey.apply(self, arguments);
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import isDicomUid from './isDicomUid';
|
||||
|
||||
describe('isDicomUid', function() {
|
||||
it('should return true for valid DICOM UIDs', function() {
|
||||
describe('isDicomUid', function () {
|
||||
it('should return true for valid DICOM UIDs', function () {
|
||||
expect(isDicomUid('1')).toBe(true);
|
||||
expect(isDicomUid('1.2')).toBe(true);
|
||||
expect(isDicomUid('1.2.3')).toBe(true);
|
||||
expect(isDicomUid('1.2.3.4')).toBe(true);
|
||||
});
|
||||
it('should return false for invalid DICOM UIDs', function() {
|
||||
it('should return false for invalid DICOM UIDs', function () {
|
||||
expect(isDicomUid('x')).toBe(false);
|
||||
expect(isDicomUid('1.')).toBe(false);
|
||||
expect(isDicomUid('1. 2')).toBe(false);
|
||||
|
||||
@@ -30,23 +30,17 @@ export default function isDisplaySetReconstructable(instances) {
|
||||
}
|
||||
|
||||
// Can't reconstruct if all instances don't have the ImagePositionPatient.
|
||||
if (
|
||||
!isMultiframe &&
|
||||
!instances.every(instance => instance.ImagePositionPatient)
|
||||
) {
|
||||
if (!isMultiframe && !instances.every(instance => instance.ImagePositionPatient)) {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
const sortedInstances = sortInstancesByPosition(instances);
|
||||
|
||||
return isMultiframe
|
||||
? processMultiframe(sortedInstances[0])
|
||||
: processSingleframe(sortedInstances);
|
||||
return isMultiframe ? processMultiframe(sortedInstances[0]) : processSingleframe(sortedInstances);
|
||||
}
|
||||
|
||||
function hasPixelMeasurements(multiFrameInstance) {
|
||||
const perFrameSequence =
|
||||
multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
const perFrameSequence = multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
const sharedSequence = multiFrameInstance.SharedFunctionalGroupsSequence;
|
||||
|
||||
return (
|
||||
@@ -54,39 +48,34 @@ function hasPixelMeasurements(multiFrameInstance) {
|
||||
Boolean(sharedSequence?.PixelMeasuresSequence) ||
|
||||
Boolean(
|
||||
multiFrameInstance.PixelSpacing &&
|
||||
(multiFrameInstance.SliceThickness ||
|
||||
multiFrameInstance.SpacingBetweenFrames)
|
||||
(multiFrameInstance.SliceThickness || multiFrameInstance.SpacingBetweenFrames)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function hasOrientation(multiFrameInstance) {
|
||||
const sharedSequence = multiFrameInstance.SharedFunctionalGroupsSequence;
|
||||
const perFrameSequence =
|
||||
multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
const perFrameSequence = multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
|
||||
return (
|
||||
Boolean(sharedSequence?.PlaneOrientationSequence) ||
|
||||
Boolean(perFrameSequence?.PlaneOrientationSequence) ||
|
||||
Boolean(
|
||||
multiFrameInstance.ImageOrientationPatient ||
|
||||
multiFrameInstance.DetectorInformationSequence?.[0]
|
||||
?.ImageOrientationPatient
|
||||
multiFrameInstance.DetectorInformationSequence?.[0]?.ImageOrientationPatient
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function hasPosition(multiFrameInstance) {
|
||||
const perFrameSequence =
|
||||
multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
const perFrameSequence = multiFrameInstance.PerFrameFunctionalGroupsSequence?.[0];
|
||||
|
||||
return (
|
||||
Boolean(perFrameSequence?.PlanePositionSequence) ||
|
||||
Boolean(perFrameSequence?.CTPositionSequence) ||
|
||||
Boolean(
|
||||
multiFrameInstance.ImagePositionPatient ||
|
||||
multiFrameInstance.DetectorInformationSequence?.[0]
|
||||
?.ImagePositionPatient
|
||||
multiFrameInstance.DetectorInformationSequence?.[0]?.ImagePositionPatient
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -114,10 +103,7 @@ function processMultiframe(multiFrameInstance) {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
if (
|
||||
multiFrameInstance.Modality.includes('NM') &&
|
||||
!isNMReconstructable(multiFrameInstance)
|
||||
) {
|
||||
if (multiFrameInstance.Modality.includes('NM') && !isNMReconstructable(multiFrameInstance)) {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
@@ -130,9 +116,7 @@ function processSingleframe(instances) {
|
||||
const firstImageRows = toNumber(firstImage.Rows);
|
||||
const firstImageColumns = toNumber(firstImage.Columns);
|
||||
const firstImageSamplesPerPixel = toNumber(firstImage.SamplesPerPixel);
|
||||
const firstImageOrientationPatient = toNumber(
|
||||
firstImage.ImageOrientationPatient
|
||||
);
|
||||
const firstImageOrientationPatient = toNumber(firstImage.ImageOrientationPatient);
|
||||
const firstImagePositionPatient = toNumber(firstImage.ImagePositionPatient);
|
||||
|
||||
// Can't reconstruct if we:
|
||||
@@ -141,12 +125,7 @@ function processSingleframe(instances) {
|
||||
// -- Have different orientations within a displaySet.
|
||||
for (let i = 1; i < instances.length; i++) {
|
||||
const instance = instances[i];
|
||||
const {
|
||||
Rows,
|
||||
Columns,
|
||||
SamplesPerPixel,
|
||||
ImageOrientationPatient,
|
||||
} = instance;
|
||||
const { Rows, Columns, SamplesPerPixel, ImageOrientationPatient } = instance;
|
||||
|
||||
const imageOrientationPatient = toNumber(ImageOrientationPatient);
|
||||
|
||||
@@ -167,9 +146,7 @@ function processSingleframe(instances) {
|
||||
// If spacing is on a uniform grid but we are missing frames,
|
||||
// Allow reconstruction, but pass back the number of missing frames.
|
||||
if (instances.length > 2) {
|
||||
const lastIpp = toNumber(
|
||||
instances[instances.length - 1].ImagePositionPatient
|
||||
);
|
||||
const lastIpp = toNumber(instances[instances.length - 1].ImagePositionPatient);
|
||||
|
||||
// We can't reconstruct if we are missing ImagePositionPatient values
|
||||
if (!firstImagePositionPatient || !lastIpp) {
|
||||
@@ -177,8 +154,7 @@ function processSingleframe(instances) {
|
||||
}
|
||||
|
||||
averageSpacingBetweenFrames =
|
||||
_getPerpendicularDistance(firstImagePositionPatient, lastIpp) /
|
||||
(instances.length - 1);
|
||||
_getPerpendicularDistance(firstImagePositionPatient, lastIpp) / (instances.length - 1);
|
||||
|
||||
let previousImagePositionPatient = firstImagePositionPatient;
|
||||
|
||||
@@ -191,10 +167,7 @@ function processSingleframe(instances) {
|
||||
imagePositionPatient,
|
||||
previousImagePositionPatient
|
||||
);
|
||||
const spacingIssue = _getSpacingIssue(
|
||||
spacingBetweenFrames,
|
||||
averageSpacingBetweenFrames
|
||||
);
|
||||
const spacingIssue = _getSpacingIssue(spacingBetweenFrames, averageSpacingBetweenFrames);
|
||||
|
||||
if (spacingIssue) {
|
||||
const issue = spacingIssue.issue;
|
||||
@@ -262,11 +235,7 @@ function _getSpacingIssue(spacing, averageSpacing) {
|
||||
}
|
||||
|
||||
function _getPerpendicularDistance(a, b) {
|
||||
return Math.sqrt(
|
||||
Math.pow(a[0] - b[0], 2) +
|
||||
Math.pow(a[1] - b[1], 2) +
|
||||
Math.pow(a[2] - b[2], 2)
|
||||
);
|
||||
return Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2) + Math.pow(a[2] - b[2], 2));
|
||||
}
|
||||
|
||||
const constructableModalities = ['MR', 'CT', 'PT', 'NM'];
|
||||
|
||||
@@ -3,23 +3,17 @@ import { isImage } from './isImage';
|
||||
|
||||
describe('isImage', () => {
|
||||
test('should return true when the image is of type sopClassDictionary.ComputedRadiographyImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.ComputedRadiographyImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.ComputedRadiographyImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.DigitalXRayImageStorageForPresentation', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.DigitalXRayImageStorageForPresentation
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.DigitalXRayImageStorageForPresentation);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.DigitalXRayImageStorageForProcessing', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.DigitalXRayImageStorageForProcessing
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.DigitalXRayImageStorageForProcessing);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -45,9 +39,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.DigitalIntraOralXRayImageStorageForProcessing', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.DigitalIntraOralXRayImageStorageForProcessing
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.DigitalIntraOralXRayImageStorageForProcessing);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -62,16 +54,12 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.LegacyConvertedEnhancedCTImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.LegacyConvertedEnhancedCTImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.LegacyConvertedEnhancedCTImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.UltrasoundMultiframeImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.UltrasoundMultiframeImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.UltrasoundMultiframeImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -86,16 +74,12 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.EnhancedMRColorImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.EnhancedMRColorImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.EnhancedMRColorImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.LegacyConvertedEnhancedMRImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.LegacyConvertedEnhancedMRImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.LegacyConvertedEnhancedMRImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -105,9 +89,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.SecondaryCaptureImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.SecondaryCaptureImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.SecondaryCaptureImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -140,9 +122,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.XRayAngiographicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.XRayAngiographicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.XRayAngiographicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -152,9 +132,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.XRayRadiofluoroscopicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.XRayRadiofluoroscopicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.XRayRadiofluoroscopicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -164,23 +142,17 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.XRay3DAngiographicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.XRay3DAngiographicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.XRay3DAngiographicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.XRay3DCraniofacialImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.XRay3DCraniofacialImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.XRay3DCraniofacialImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.BreastTomosynthesisImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.BreastTomosynthesisImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.BreastTomosynthesisImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -192,9 +164,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.BreastProjectionXRayImageStorageForProcessing', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.BreastProjectionXRayImageStorageForProcessing
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.BreastProjectionXRayImageStorageForProcessing);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -213,9 +183,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.NuclearMedicineImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.NuclearMedicineImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.NuclearMedicineImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -225,9 +193,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VideoEndoscopicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VideoEndoscopicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VideoEndoscopicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -237,65 +203,47 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VideoMicroscopicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VideoMicroscopicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VideoMicroscopicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VLSlideCoordinatesMicroscopicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VLSlideCoordinatesMicroscopicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VLSlideCoordinatesMicroscopicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VLPhotographicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VLPhotographicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VLPhotographicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VideoPhotographicImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VideoPhotographicImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VideoPhotographicImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.OphthalmicPhotography8BitImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.OphthalmicPhotography8BitImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.OphthalmicPhotography8BitImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.OphthalmicPhotography16BitImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.OphthalmicPhotography16BitImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.OphthalmicPhotography16BitImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.OphthalmicTomographyImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.OphthalmicTomographyImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.OphthalmicTomographyImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.VLWholeSlideMicroscopyImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.VLWholeSlideMicroscopyImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.VLWholeSlideMicroscopyImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.PositronEmissionTomographyImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.PositronEmissionTomographyImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.PositronEmissionTomographyImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
@@ -305,9 +253,7 @@ describe('isImage', () => {
|
||||
});
|
||||
|
||||
test('should return true when the image is of type sopClassDictionary.LegacyConvertedEnhancedPETImageStorage', () => {
|
||||
const isImageStatus = isImage(
|
||||
sopClassDictionary.LegacyConvertedEnhancedPETImageStorage
|
||||
);
|
||||
const isImageStatus = isImage(sopClassDictionary.LegacyConvertedEnhancedPETImageStorage);
|
||||
expect(isImageStatus).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
const LOW_PRIORITY_MODALITIES = Object.freeze([
|
||||
'SEG',
|
||||
'KO',
|
||||
'PR',
|
||||
'SR',
|
||||
'RTSTRUCT',
|
||||
]);
|
||||
const LOW_PRIORITY_MODALITIES = Object.freeze(['SEG', 'KO', 'PR', 'SR', 'RTSTRUCT']);
|
||||
|
||||
export default function isLowPriorityModality(Modality) {
|
||||
return LOW_PRIORITY_MODALITIES.includes(Modality);
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
const LOW_PRIORITY_MODALITIES = Object.freeze([
|
||||
'SEG',
|
||||
'KO',
|
||||
'PR',
|
||||
'SR',
|
||||
'RTSTRUCT',
|
||||
]);
|
||||
const LOW_PRIORITY_MODALITIES = Object.freeze(['SEG', 'KO', 'PR', 'SR', 'RTSTRUCT']);
|
||||
|
||||
export default function isLowPriorityModality(Modality) {
|
||||
return LOW_PRIORITY_MODALITIES.includes(Modality);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
export default function makeCancelable(thenable) {
|
||||
let isCanceled = false;
|
||||
const promise = Promise.resolve(thenable).then(
|
||||
function(result) {
|
||||
function (result) {
|
||||
if (isCanceled) {
|
||||
throw Object.freeze({ isCanceled });
|
||||
}
|
||||
return result;
|
||||
},
|
||||
function(error) {
|
||||
function (error) {
|
||||
if (isCanceled) {
|
||||
throw Object.freeze({ isCanceled, error });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export default function makeDeferred() {
|
||||
let reject,
|
||||
resolve,
|
||||
promise = new Promise(function(res, rej) {
|
||||
promise = new Promise(function (res, rej) {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
|
||||
@@ -11,11 +11,7 @@
|
||||
* @returns Array view containing the palette data, or a promise to return one.
|
||||
* Returns undefined if the palette data is absent.
|
||||
*/
|
||||
export default function fetchPaletteColorLookupTableData(
|
||||
item,
|
||||
tag,
|
||||
descriptorTag
|
||||
) {
|
||||
export default function fetchPaletteColorLookupTableData(item, tag, descriptorTag) {
|
||||
const { PaletteColorLookupTableUID } = item;
|
||||
const paletteData = item[tag];
|
||||
if (paletteData === undefined && PaletteColorLookupTableUID === undefined) {
|
||||
@@ -55,19 +51,12 @@ function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
|
||||
|
||||
if (paletteColorLookupTableData.InlineBinary) {
|
||||
try {
|
||||
const arraybuffer = Uint8Array.from(
|
||||
atob(paletteColorLookupTableData.InlineBinary),
|
||||
c => c.charCodeAt(0)
|
||||
const arraybuffer = Uint8Array.from(atob(paletteColorLookupTableData.InlineBinary), c =>
|
||||
c.charCodeAt(0)
|
||||
);
|
||||
return (paletteColorLookupTableData.palette = arrayBufferToPaletteColorLUT(
|
||||
arraybuffer
|
||||
));
|
||||
return (paletteColorLookupTableData.palette = arrayBufferToPaletteColorLUT(arraybuffer));
|
||||
} catch (e) {
|
||||
console.log(
|
||||
"Couldn't decode",
|
||||
paletteColorLookupTableData.InlineBinary,
|
||||
e
|
||||
);
|
||||
console.log("Couldn't decode", paletteColorLookupTableData.InlineBinary, e);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -75,12 +64,7 @@ function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
|
||||
if (paletteColorLookupTableData.retrieveBulkData) {
|
||||
return paletteColorLookupTableData
|
||||
.retrieveBulkData()
|
||||
.then(
|
||||
val =>
|
||||
(paletteColorLookupTableData.palette = arrayBufferToPaletteColorLUT(
|
||||
val
|
||||
))
|
||||
);
|
||||
.then(val => (paletteColorLookupTableData.palette = arrayBufferToPaletteColorLUT(val)));
|
||||
}
|
||||
|
||||
console.error(`No data found for ${paletteColorLookupTableData} palette`);
|
||||
|
||||
@@ -48,11 +48,7 @@ export default function getPixelSpacingInformation(instance) {
|
||||
type: TYPES.UNKNOWN,
|
||||
isProjection,
|
||||
};
|
||||
} else if (
|
||||
PixelSpacing &&
|
||||
ImagerPixelSpacing &&
|
||||
PixelSpacing === ImagerPixelSpacing
|
||||
) {
|
||||
} else if (PixelSpacing && ImagerPixelSpacing && PixelSpacing === ImagerPixelSpacing) {
|
||||
// If Imager Pixel Spacing and Pixel Spacing are present and they have the same values,
|
||||
// then the user should be informed that the measurements are at the detector plane
|
||||
return {
|
||||
@@ -60,11 +56,7 @@ export default function getPixelSpacingInformation(instance) {
|
||||
type: TYPES.DETECTOR,
|
||||
isProjection,
|
||||
};
|
||||
} else if (
|
||||
PixelSpacing &&
|
||||
ImagerPixelSpacing &&
|
||||
PixelSpacing !== ImagerPixelSpacing
|
||||
) {
|
||||
} else if (PixelSpacing && ImagerPixelSpacing && PixelSpacing !== ImagerPixelSpacing) {
|
||||
// If Imager Pixel Spacing and Pixel Spacing are present and they have different values,
|
||||
// then the user should be informed that these are "calibrated"
|
||||
// (in some unknown manner if Pixel Spacing Calibration Type and/or
|
||||
@@ -95,10 +87,7 @@ export default function getPixelSpacingInformation(instance) {
|
||||
PixelSpacing: CorrectedImagerPixelSpacing,
|
||||
isProjection,
|
||||
};
|
||||
} else if (
|
||||
SequenceOfUltrasoundRegions &&
|
||||
typeof SequenceOfUltrasoundRegions === 'object'
|
||||
) {
|
||||
} else if (SequenceOfUltrasoundRegions && typeof SequenceOfUltrasoundRegions === 'object') {
|
||||
const { PhysicalDeltaX, PhysicalDeltaY } = SequenceOfUltrasoundRegions;
|
||||
const USPixelSpacing = [PhysicalDeltaX * 10, PhysicalDeltaY * 10];
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ export default function unpackOverlay(arrayBuffer) {
|
||||
for (let byteIndex = 0; byteIndex < byteArray.length; byteIndex++) {
|
||||
const bitIndex = byteIndex % 8;
|
||||
const bitByteIndex = Math.floor(byteIndex / 8);
|
||||
byteArray[byteIndex] =
|
||||
1 * ((bitArray[bitByteIndex] & (1 << bitIndex)) >> bitIndex);
|
||||
byteArray[byteIndex] = 1 * ((bitArray[bitByteIndex] & (1 << bitIndex)) >> bitIndex);
|
||||
}
|
||||
|
||||
return byteArray;
|
||||
|
||||
@@ -85,9 +85,7 @@ export class ObjectPath {
|
||||
* @return {Boolean} Returns "true" if the object is a real Object instance and "false" otherwise.
|
||||
*/
|
||||
static isValidObject(object) {
|
||||
return (
|
||||
typeof object === 'object' && object !== null && object instanceof Object
|
||||
);
|
||||
return typeof object === 'object' && object !== null && object instanceof Object;
|
||||
}
|
||||
|
||||
static getPathComponents(path) {
|
||||
|
||||
@@ -149,10 +149,10 @@ function waitOn(list, thenable) {
|
||||
const task = increaseList(list);
|
||||
if (isTask(task)) {
|
||||
task.awaiting = Promise.resolve(thenable).then(
|
||||
function() {
|
||||
function () {
|
||||
finish(task);
|
||||
},
|
||||
function() {
|
||||
function () {
|
||||
task.failed = true;
|
||||
finish(task);
|
||||
}
|
||||
@@ -226,11 +226,7 @@ function getTaskByName(list, name) {
|
||||
* @returns {boolean} Returns true on success and false otherewise
|
||||
*/
|
||||
function addObserver(list, observer) {
|
||||
if (
|
||||
isList(list) &&
|
||||
Array.isArray(list.observers) &&
|
||||
typeof observer === 'function'
|
||||
) {
|
||||
if (isList(list) && Array.isArray(list.observers) && typeof observer === 'function') {
|
||||
list.observers.push(observer);
|
||||
return true;
|
||||
}
|
||||
@@ -244,11 +240,7 @@ function addObserver(list, observer) {
|
||||
* @returns {boolean} Returns true on success and false otherewise
|
||||
*/
|
||||
function removeObserver(list, observer) {
|
||||
if (
|
||||
isList(list) &&
|
||||
Array.isArray(list.observers) &&
|
||||
list.observers.length > 0
|
||||
) {
|
||||
if (isList(list) && Array.isArray(list.observers) && list.observers.length > 0) {
|
||||
const index = list.observers.indexOf(observer);
|
||||
if (index >= 0) {
|
||||
list.observers.splice(index, 1);
|
||||
@@ -276,9 +268,7 @@ function objectWithType(type, object) {
|
||||
}
|
||||
|
||||
function isOfType(type, subject) {
|
||||
return (
|
||||
subject !== null && typeof subject === 'object' && subject[TYPE] === type
|
||||
);
|
||||
return subject !== null && typeof subject === 'object' && subject[TYPE] === type;
|
||||
}
|
||||
|
||||
function isValidProgress(value) {
|
||||
@@ -299,12 +289,8 @@ function contains(list, task) {
|
||||
}
|
||||
|
||||
function notify(list, data) {
|
||||
if (
|
||||
isList(list) &&
|
||||
Array.isArray(list.observers) &&
|
||||
list.observers.length > 0
|
||||
) {
|
||||
list.observers.slice().forEach(function(observer) {
|
||||
if (isList(list) && Array.isArray(list.observers) && list.observers.length > 0) {
|
||||
list.observers.slice().forEach(function (observer) {
|
||||
if (typeof observer === 'function') {
|
||||
try {
|
||||
observer(data, list);
|
||||
|
||||
@@ -40,11 +40,7 @@ describe('progressTrackingUtils', () => {
|
||||
|
||||
it('should call observer twice for each task', () => {
|
||||
const { list, observer } = context;
|
||||
const promises = [
|
||||
Promise.resolve('A'),
|
||||
Promise.resolve('B'),
|
||||
Promise.resolve('C'),
|
||||
];
|
||||
const promises = [Promise.resolve('A'), Promise.resolve('B'), Promise.resolve('C')];
|
||||
promises.forEach(promise => void utils.waitOn(list, promise));
|
||||
return Promise.all(promises).then(() => {
|
||||
expect(observer).toBeCalledTimes(6);
|
||||
|
||||
@@ -10,8 +10,6 @@ export default function resolveObjectPath(root, path, defaultValue) {
|
||||
);
|
||||
}
|
||||
value = root[path];
|
||||
return value === undefined && defaultValue !== undefined
|
||||
? defaultValue
|
||||
: value;
|
||||
return value === undefined && defaultValue !== undefined ? defaultValue : value;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import resolveObjectPath from './resolveObjectPath';
|
||||
|
||||
describe('resolveObjectPath', function() {
|
||||
describe('resolveObjectPath', function () {
|
||||
let config;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
config = {
|
||||
active: {
|
||||
user: {
|
||||
@@ -21,13 +21,13 @@ describe('resolveObjectPath', function() {
|
||||
};
|
||||
});
|
||||
|
||||
it('should safely return deeply nested values from an object', function() {
|
||||
it('should safely return deeply nested values from an object', function () {
|
||||
expect(resolveObjectPath(config, 'active.user.name.first')).toBe('John');
|
||||
expect(resolveObjectPath(config, 'active.user.name.last')).toBe('Doe');
|
||||
expect(resolveObjectPath(config, 'active.servers.0.ipv4')).toBe('10.0.0.1');
|
||||
});
|
||||
|
||||
it('should silently return undefined when intermediate values are not valid objects', function() {
|
||||
it('should silently return undefined when intermediate values are not valid objects', function () {
|
||||
expect(resolveObjectPath(config, 'active.usr.name.first')).toBeUndefined();
|
||||
expect(resolveObjectPath(config, 'active.name.last')).toBeUndefined();
|
||||
expect(resolveObjectPath(config, 'active.servers.7.ipv4')).toBeUndefined();
|
||||
|
||||
@@ -3,14 +3,10 @@ export const sopClassDictionary = {
|
||||
ComputedRadiographyImageStorage: '1.2.840.10008.5.1.4.1.1.1',
|
||||
DigitalXRayImageStorageForPresentation: '1.2.840.10008.5.1.4.1.1.1.1',
|
||||
DigitalXRayImageStorageForProcessing: '1.2.840.10008.5.1.4.1.1.1.1.1',
|
||||
DigitalMammographyXRayImageStorageForPresentation:
|
||||
'1.2.840.10008.5.1.4.1.1.1.2',
|
||||
DigitalMammographyXRayImageStorageForProcessing:
|
||||
'1.2.840.10008.5.1.4.1.1.1.2.1',
|
||||
DigitalIntraOralXRayImageStorageForPresentation:
|
||||
'1.2.840.10008.5.1.4.1.1.1.3',
|
||||
DigitalIntraOralXRayImageStorageForProcessing:
|
||||
'1.2.840.10008.5.1.4.1.1.1.3.1',
|
||||
DigitalMammographyXRayImageStorageForPresentation: '1.2.840.10008.5.1.4.1.1.1.2',
|
||||
DigitalMammographyXRayImageStorageForProcessing: '1.2.840.10008.5.1.4.1.1.1.2.1',
|
||||
DigitalIntraOralXRayImageStorageForPresentation: '1.2.840.10008.5.1.4.1.1.1.3',
|
||||
DigitalIntraOralXRayImageStorageForProcessing: '1.2.840.10008.5.1.4.1.1.1.3.1',
|
||||
CTImageStorage: '1.2.840.10008.5.1.4.1.1.2',
|
||||
EnhancedCTImageStorage: '1.2.840.10008.5.1.4.1.1.2.1',
|
||||
LegacyConvertedEnhancedCTImageStorage: '1.2.840.10008.5.1.4.1.1.2.2',
|
||||
@@ -23,14 +19,10 @@ export const sopClassDictionary = {
|
||||
UltrasoundImageStorage: '1.2.840.10008.5.1.4.1.1.6.1',
|
||||
EnhancedUSVolumeStorage: '1.2.840.10008.5.1.4.1.1.6.2',
|
||||
SecondaryCaptureImageStorage: '1.2.840.10008.5.1.4.1.1.7',
|
||||
MultiframeSingleBitSecondaryCaptureImageStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.7.1',
|
||||
MultiframeGrayscaleByteSecondaryCaptureImageStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.7.2',
|
||||
MultiframeGrayscaleWordSecondaryCaptureImageStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.7.3',
|
||||
MultiframeTrueColorSecondaryCaptureImageStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.7.4',
|
||||
MultiframeSingleBitSecondaryCaptureImageStorage: '1.2.840.10008.5.1.4.1.1.7.1',
|
||||
MultiframeGrayscaleByteSecondaryCaptureImageStorage: '1.2.840.10008.5.1.4.1.1.7.2',
|
||||
MultiframeGrayscaleWordSecondaryCaptureImageStorage: '1.2.840.10008.5.1.4.1.1.7.3',
|
||||
MultiframeTrueColorSecondaryCaptureImageStorage: '1.2.840.10008.5.1.4.1.1.7.4',
|
||||
Sop12LeadECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.1',
|
||||
GeneralECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.2',
|
||||
AmbulatoryECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.3',
|
||||
@@ -44,8 +36,7 @@ export const sopClassDictionary = {
|
||||
ColorSoftcopyPresentationStateStorage: '1.2.840.10008.5.1.4.1.1.11.2',
|
||||
PseudoColorSoftcopyPresentationStateStorage: '1.2.840.10008.5.1.4.1.1.11.3',
|
||||
BlendingSoftcopyPresentationStateStorage: '1.2.840.10008.5.1.4.1.1.11.4',
|
||||
XAXRFGrayscaleSoftcopyPresentationStateStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.11.5',
|
||||
XAXRFGrayscaleSoftcopyPresentationStateStorage: '1.2.840.10008.5.1.4.1.1.11.5',
|
||||
XRayAngiographicImageStorage: '1.2.840.10008.5.1.4.1.1.12.1',
|
||||
EnhancedXAImageStorage: '1.2.840.10008.5.1.4.1.1.12.1.1',
|
||||
XRayRadiofluoroscopicImageStorage: '1.2.840.10008.5.1.4.1.1.12.2',
|
||||
@@ -53,14 +44,11 @@ export const sopClassDictionary = {
|
||||
XRay3DAngiographicImageStorage: '1.2.840.10008.5.1.4.1.1.13.1.1',
|
||||
XRay3DCraniofacialImageStorage: '1.2.840.10008.5.1.4.1.1.13.1.2',
|
||||
BreastTomosynthesisImageStorage: '1.2.840.10008.5.1.4.1.1.13.1.3',
|
||||
BreastProjectionXRayImageStorageForPresentation:
|
||||
'1.2.840.10008.5.1.4.1.1.13.1.4',
|
||||
BreastProjectionXRayImageStorageForProcessing:
|
||||
'1.2.840.10008.5.1.4.1.1.13.1.5',
|
||||
BreastProjectionXRayImageStorageForPresentation: '1.2.840.10008.5.1.4.1.1.13.1.4',
|
||||
BreastProjectionXRayImageStorageForProcessing: '1.2.840.10008.5.1.4.1.1.13.1.5',
|
||||
IntravascularOpticalCoherenceTomographyImageStorageForPresentation:
|
||||
'1.2.840.10008.5.1.4.1.1.14.1',
|
||||
IntravascularOpticalCoherenceTomographyImageStorageForProcessing:
|
||||
'1.2.840.10008.5.1.4.1.1.14.2',
|
||||
IntravascularOpticalCoherenceTomographyImageStorageForProcessing: '1.2.840.10008.5.1.4.1.1.14.2',
|
||||
NuclearMedicineImageStorage: '1.2.840.10008.5.1.4.1.1.20',
|
||||
RawDataStorage: '1.2.840.10008.5.1.4.1.1.66',
|
||||
SpatialRegistrationStorage: '1.2.840.10008.5.1.4.1.1.66.1',
|
||||
@@ -92,8 +80,7 @@ export const sopClassDictionary = {
|
||||
OphthalmicAxialMeasurementsStorage: '1.2.840.10008.5.1.4.1.1.78.7',
|
||||
IntraocularLensCalculationsStorage: '1.2.840.10008.5.1.4.1.1.78.8',
|
||||
MacularGridThicknessandVolumeReport: '1.2.840.10008.5.1.4.1.1.79.1',
|
||||
OphthalmicVisualFieldStaticPerimetryMeasurementsStorage:
|
||||
'1.2.840.10008.5.1.4.1.1.80.1',
|
||||
OphthalmicVisualFieldStaticPerimetryMeasurementsStorage: '1.2.840.10008.5.1.4.1.1.80.1',
|
||||
OphthalmicThicknessMapStorage: '1.2.840.10008.5.1.4.1.1.81.1',
|
||||
CornealTopographyMapStorage: '1.2.840.10008.5.1.4.1.1.82.1',
|
||||
BasicTextSR: '1.2.840.10008.5.1.4.1.1.88.11',
|
||||
|
||||
@@ -3,7 +3,7 @@ export default function sortBy() {
|
||||
var fields = [].slice.call(arguments),
|
||||
n_fields = fields.length;
|
||||
|
||||
return function(A, B) {
|
||||
return function (A, B) {
|
||||
var a, b, field, key, reverse, result, i;
|
||||
|
||||
for (i = 0; i < n_fields; i++) {
|
||||
|
||||
@@ -15,10 +15,8 @@ export default function sortInstances(instances: Array<any>) {
|
||||
return instances;
|
||||
}
|
||||
|
||||
const {
|
||||
ImagePositionPatient: referenceImagePositionPatient,
|
||||
ImageOrientationPatient,
|
||||
} = instances[Math.floor(instances.length / 2)]; // this prevents getting scout image as test image
|
||||
const { ImagePositionPatient: referenceImagePositionPatient, ImageOrientationPatient } =
|
||||
instances[Math.floor(instances.length / 2)]; // this prevents getting scout image as test image
|
||||
|
||||
if (!referenceImagePositionPatient || !ImageOrientationPatient) {
|
||||
return instances;
|
||||
@@ -49,11 +47,7 @@ export default function sortInstances(instances: Array<any>) {
|
||||
|
||||
const positionVector = vec3.create();
|
||||
|
||||
vec3.sub(
|
||||
positionVector,
|
||||
referenceImagePositionPatient,
|
||||
imagePositionPatient
|
||||
);
|
||||
vec3.sub(positionVector, referenceImagePositionPatient, imagePositionPatient);
|
||||
|
||||
const distance = vec3.dot(positionVector, scanAxisNormal);
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import isLowPriorityModality from './isLowPriorityModality';
|
||||
|
||||
const compareSeriesDateTime = (a, b) => {
|
||||
const seriesDateA = Date.parse(
|
||||
`${a.seriesDate ?? a.SeriesDate} ${a.seriesTime ?? a.SeriesTime}`
|
||||
);
|
||||
const seriesDateB = Date.parse(
|
||||
`${a.seriesDate ?? a.SeriesDate} ${a.seriesTime ?? a.SeriesTime}`
|
||||
);
|
||||
const seriesDateA = Date.parse(`${a.seriesDate ?? a.SeriesDate} ${a.seriesTime ?? a.SeriesTime}`);
|
||||
const seriesDateB = Date.parse(`${a.seriesDate ?? a.SeriesDate} ${a.seriesTime ?? a.SeriesTime}`);
|
||||
return seriesDateA - seriesDateB;
|
||||
};
|
||||
|
||||
@@ -26,12 +22,8 @@ const defaultSeriesSort = (a, b) => {
|
||||
* @param {Object} secondSeries
|
||||
*/
|
||||
function seriesInfoSortingCriteria(firstSeries, secondSeries) {
|
||||
const aLowPriority = isLowPriorityModality(
|
||||
firstSeries.Modality ?? firstSeries.modality
|
||||
);
|
||||
const bLowPriority = isLowPriorityModality(
|
||||
secondSeries.Modality ?? secondSeries.modality
|
||||
);
|
||||
const aLowPriority = isLowPriorityModality(firstSeries.Modality ?? firstSeries.modality);
|
||||
const bLowPriority = isLowPriorityModality(secondSeries.Modality ?? secondSeries.modality);
|
||||
|
||||
if (aLowPriority) {
|
||||
return bLowPriority ? defaultSeriesSort(secondSeries, firstSeries) : 1;
|
||||
@@ -122,10 +114,4 @@ export default function sortStudy(
|
||||
return study;
|
||||
}
|
||||
|
||||
export {
|
||||
sortStudy,
|
||||
sortStudySeries,
|
||||
sortStudyInstances,
|
||||
sortingCriteria,
|
||||
seriesSortCriteria,
|
||||
};
|
||||
export { sortStudy, sortStudySeries, sortStudyInstances, sortingCriteria, seriesSortCriteria };
|
||||
@@ -23,9 +23,7 @@ const getSplitParam = (
|
||||
lowerCaseKey: string,
|
||||
params = new URLSearchParams(window.location.search)
|
||||
): string[] => {
|
||||
const sourceKey = [...params.keys()].find(
|
||||
it => it.toLowerCase() === lowerCaseKey
|
||||
);
|
||||
const sourceKey = [...params.keys()].find(it => it.toLowerCase() === lowerCaseKey);
|
||||
if (!sourceKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ function subscribeToNextViewportGridChange(
|
||||
};
|
||||
|
||||
const subscriptions = [
|
||||
viewportGridService.subscribe(
|
||||
viewportGridService.EVENTS.LAYOUT_CHANGED,
|
||||
callback
|
||||
),
|
||||
viewportGridService.subscribe(viewportGridService.EVENTS.LAYOUT_CHANGED, callback),
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user