feat(microscopy): add dicom microscopy extension and mode (#3247)
* skeleton for dicom-microscopy extension * skeleton for microscopy mode * [feat] ported @radicalimaging/microscopy-dicom to OHIF's default extension * [feat] ported microscopy mode from private repo * added new definitions to the package.json * webpack configuration update for microscopy extension * register new icons for microscopy tools * fixes to the microscopy extension and mode * trivial error fix - typescript type import error * link microscopy extension with default OHIF app plugin config * demo config fix * fix logs * remove unsed imports * [fix] loading of microscopy * [fix] webworker script loading, normalizing denaturalized dataset * found the latest version of dicom-microscopy-viewer that works with current OHIF extension : 0.35.2 * hide thumbnail pane by default, as we have issues with * comments * remove unused code * [feat] microscopy - annotation selection * [feat] microscopy - edit annotation label * wip * [bugfix] dicom-microscopy tool * [bugfix] dicom microscopy annotations * [fix] mixed-content blocking caused by BulkDataURI * [fix] microscopy measurements panel - center button * [fix] microscopy measurements panel - styling * [fix] microscopy - controls * fix local loading of microscopy * fix local loading of dicom microscopy * fix typo - indexof to indexOf * [fix] remove unused icons * remove commented out lines from webpack configuration * platform/viewer/public/config/default.js - revert accidental changes * [refactor] redirecting to microscopy mode on Local mode * attribution to DMV and SLIM viewer * [fix] code review feedbacks * fix thumbnails * [fix] microscopy - fix old publisher.publish() to PubSubService._broadcastEvent() * [fix] interactions, webpack config, roi selection * [feat] microscopy - remove select tool from UI * microscopy author * [fix] saving and loading SR * [bugfix] - missing publish() function in MicroscopyService, replace with _broadcastEvent * remove author section from readme * refactor SR saving feature * fix webpack config after merge * [bugfix] repeated import * fix e2e * webpack configuration * hide "Create report" button for microscopy
This commit is contained in:
76 files changed
+5868
-31
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import moment from 'moment';
|
||||
|
||||
/**
|
||||
* Formats DICOM date.
|
||||
*
|
||||
* @param {string} date
|
||||
* @param {string} strFormat
|
||||
*/
|
||||
export default function formatDICOMDate(date, strFormat = 'MMM D, YYYY') {
|
||||
return moment(date, 'YYYYMMDD').format(strFormat);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import formatDICOMDate from './formatDICOMDate';
|
||||
|
||||
describe('formatDICOMDate', () => {
|
||||
it('should format DICOM date string', () => {
|
||||
const date = '20180916';
|
||||
const formattedDate = formatDICOMDate(date);
|
||||
expect(formattedDate).toEqual('Sep 16, 2018');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Formats a patient name for display purposes.
|
||||
*
|
||||
* @param {string} name DICOM patient name string
|
||||
* @returns {string} formatted name
|
||||
*/
|
||||
export default function formatDICOMPatientName(name) {
|
||||
if (typeof name !== 'string') return;
|
||||
|
||||
/**
|
||||
* Convert the first ^ to a ', '. String.replace() only affects
|
||||
* the first appearance of the character.
|
||||
*/
|
||||
const commaBetweenFirstAndLast = name.replace('^', ', ');
|
||||
|
||||
/** Replace any remaining '^' characters with spaces */
|
||||
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');
|
||||
|
||||
/** Trim any extraneous whitespace */
|
||||
return cleaned.trim();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import formatDICOMPatientName from './formatDICOMPatientName';
|
||||
|
||||
describe('formatDICOMPatientName', () => {
|
||||
it('should format DICOM patient name correctly', () => {
|
||||
const patientName = 'Blackford^Test';
|
||||
const formattedPatientName = formatDICOMPatientName(patientName);
|
||||
expect(formattedPatientName).toEqual('Blackford, Test');
|
||||
});
|
||||
|
||||
it('should return undefined it input is not a string', () => {
|
||||
expect(formatDICOMPatientName(123)).toEqual(undefined);
|
||||
expect(formatDICOMPatientName(null)).toEqual(undefined);
|
||||
expect(formatDICOMPatientName(undefined)).toEqual(undefined);
|
||||
expect(formatDICOMPatientName(false)).toEqual(undefined);
|
||||
expect(formatDICOMPatientName([])).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import moment from 'moment';
|
||||
|
||||
/**
|
||||
* DICOM Time is stored as HHmmss.SSS, where:
|
||||
* HH 24 hour time:
|
||||
* m mm 0..59 Minutes
|
||||
* s ss 0..59 Seconds
|
||||
* S SS SSS 0..999 Fractional seconds
|
||||
*
|
||||
* Goal: '24:12:12'
|
||||
*
|
||||
* @param {*} time
|
||||
* @param {string} strFormat
|
||||
*/
|
||||
export default function formatDICOMTime(time, strFormat = 'HH:mm:ss') {
|
||||
return moment(time, 'HH:mm:ss').format(strFormat);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import formatDICOMTime from './formatDICOMTime';
|
||||
|
||||
describe('formatDICOMTime', () => {
|
||||
it('should format DICOM time string', () => {
|
||||
const time = '101300.000';
|
||||
const formattedTime = formatDICOMTime(time);
|
||||
expect(formattedTime).toEqual('10:13:00');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Formats a number to a fixed precision.
|
||||
*
|
||||
* @param {number} number
|
||||
* @param {number} precision
|
||||
*/
|
||||
export default function formatNumberPrecision(number, precision) {
|
||||
return Number(parseFloat(number).toFixed(precision));
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import formatNumberPrecision from './formatNumberPrecision';
|
||||
|
||||
describe('formatNumberPrecision', () => {
|
||||
it('should format number precision', () => {
|
||||
const number = 0.229387;
|
||||
const formattedNumber = formatNumberPrecision(number, 2);
|
||||
expect(formattedNumber).toEqual(0.23);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import formatDICOMPatientName from './formatDICOMPatientName';
|
||||
import formatDICOMDate from './formatDICOMDate';
|
||||
import formatDICOMTime from './formatDICOMTime';
|
||||
import formatNumberPrecision from './formatNumberPrecision';
|
||||
import isValidNumber from './isValidNumber';
|
||||
|
||||
const helpers = {
|
||||
formatDICOMPatientName,
|
||||
formatDICOMDate,
|
||||
formatDICOMTime,
|
||||
formatNumberPrecision,
|
||||
isValidNumber,
|
||||
};
|
||||
|
||||
export default helpers;
|
||||
@@ -0,0 +1,3 @@
|
||||
export default function isValidNumber(value) {
|
||||
return typeof value === 'number' && !isNaN(value);
|
||||
}
|
||||
Reference in new issue
Block a user