Fixing lint errors in PanelMeasurementTableTracking
This commit is contained in:
parent
e3ced7e294
commit
064df8a509
@ -21,7 +21,12 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
measurementChangeTimestamp,
|
measurementChangeTimestamp,
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
const { MeasurementService, UINotificationService, UIDialogService, DisplaySetService } = servicesManager.services;
|
const {
|
||||||
|
MeasurementService,
|
||||||
|
UINotificationService,
|
||||||
|
UIDialogService,
|
||||||
|
DisplaySetService,
|
||||||
|
} = servicesManager.services;
|
||||||
const [
|
const [
|
||||||
trackedMeasurements,
|
trackedMeasurements,
|
||||||
sendTrackedMeasurementsEvent,
|
sendTrackedMeasurementsEvent,
|
||||||
@ -31,9 +36,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
DISPLAY_STUDY_SUMMARY_INITIAL_VALUE
|
DISPLAY_STUDY_SUMMARY_INITIAL_VALUE
|
||||||
);
|
);
|
||||||
const [displayMeasurements, setDisplayMeasurements] = useState([]);
|
const [displayMeasurements, setDisplayMeasurements] = useState([]);
|
||||||
// TODO: measurements subscribtion
|
|
||||||
|
|
||||||
// Initial?
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const measurements = MeasurementService.getMeasurements();
|
const measurements = MeasurementService.getMeasurements();
|
||||||
const filteredMeasurements = measurements.filter(
|
const filteredMeasurements = measurements.filter(
|
||||||
@ -120,7 +123,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
isDraggable: false,
|
isDraggable: false,
|
||||||
centralize: true,
|
centralize: true,
|
||||||
// TODO: Create a loading indicator component + zeplin design?
|
// TODO: Create a loading indicator component + zeplin design?
|
||||||
content: () => <div className="text-primary-active">Loading...</div>
|
content: () => <div className="text-primary-active">Loading...</div>,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -136,13 +139,18 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
// Would need some way of saying which one is the "push" dataSource
|
// Would need some way of saying which one is the "push" dataSource
|
||||||
const dataSource = dataSources[0];
|
const dataSource = dataSources[0];
|
||||||
|
|
||||||
const naturalizedReport = await DICOMSR.storeMeasurements(trackedMeasurements, dataSource);
|
const naturalizedReport = await DICOMSR.storeMeasurements(
|
||||||
|
trackedMeasurements,
|
||||||
|
dataSource
|
||||||
|
);
|
||||||
|
|
||||||
DisplaySetService.makeDisplaySets([naturalizedReport], { madeInClient: true });
|
DisplaySetService.makeDisplaySets([naturalizedReport], {
|
||||||
|
madeInClient: true,
|
||||||
|
});
|
||||||
UINotificationService.show({
|
UINotificationService.show({
|
||||||
title: 'STOW SR',
|
title: 'STOW SR',
|
||||||
message: 'Measurements saved successfully',
|
message: 'Measurements saved successfully',
|
||||||
type: 'success'
|
type: 'success',
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
UINotificationService.show({
|
UINotificationService.show({
|
||||||
@ -183,7 +191,16 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelMeasurementTableTracking.propTypes = {};
|
PanelMeasurementTableTracking.propTypes = {
|
||||||
|
servicesManager: PropTypes.shape({
|
||||||
|
services: PropTypes.shape({
|
||||||
|
MeasurementService: PropTypes.shape({
|
||||||
|
getMeasurements: PropTypes.func.isRequired,
|
||||||
|
VALUE_TYPES: PropTypes.object.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: This could be a MeasurementService mapper
|
// TODO: This could be a MeasurementService mapper
|
||||||
function _mapMeasurementToDisplay(measurement, index, types) {
|
function _mapMeasurementToDisplay(measurement, index, types) {
|
||||||
@ -203,9 +220,6 @@ function _mapMeasurementToDisplay(measurement, index, types) {
|
|||||||
);
|
);
|
||||||
const { PixelSpacing, SeriesNumber, InstanceNumber } = instance;
|
const { PixelSpacing, SeriesNumber, InstanceNumber } = instance;
|
||||||
|
|
||||||
console.log('mapping....', measurement);
|
|
||||||
console.log(instance);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: index + 1,
|
id: index + 1,
|
||||||
label: '(empty)', // 'Label short description',
|
label: '(empty)', // 'Label short description',
|
||||||
@ -234,15 +248,7 @@ function _getDisplayText(
|
|||||||
instanceNumber,
|
instanceNumber,
|
||||||
types
|
types
|
||||||
) {
|
) {
|
||||||
// TODO: determination of shape influences text
|
|
||||||
// Length: 'xx.x unit (S:x, I:x)'
|
|
||||||
// Rectangle: 'xx.x x xx.x unit (S:x, I:x)',
|
|
||||||
// Ellipse?
|
|
||||||
// Bidirectional?
|
|
||||||
// Freehand?
|
|
||||||
|
|
||||||
const { type, points } = measurement;
|
const { type, points } = measurement;
|
||||||
|
|
||||||
const hasPixelSpacing =
|
const hasPixelSpacing =
|
||||||
pixelSpacing !== undefined &&
|
pixelSpacing !== undefined &&
|
||||||
Array.isArray(pixelSpacing) &&
|
Array.isArray(pixelSpacing) &&
|
||||||
@ -253,18 +259,16 @@ function _getDisplayText(
|
|||||||
const unit = hasPixelSpacing ? 'mm' : 'px';
|
const unit = hasPixelSpacing ? 'mm' : 'px';
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case types.POLYLINE:
|
case types.POLYLINE: {
|
||||||
const { length } = measurement;
|
const { length } = measurement;
|
||||||
|
|
||||||
const roundedLength = _round(length, 1);
|
const roundedLength = _round(length, 1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
`${roundedLength} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
`${roundedLength} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
];
|
];
|
||||||
|
}
|
||||||
case types.BIDIRECTIONAL:
|
case types.BIDIRECTIONAL: {
|
||||||
const { shortestDiameter, longestDiameter } = measurement;
|
const { shortestDiameter, longestDiameter } = measurement;
|
||||||
|
|
||||||
const roundedShortestDiameter = _round(shortestDiameter, 1);
|
const roundedShortestDiameter = _round(shortestDiameter, 1);
|
||||||
const roundedLongestDiameter = _round(longestDiameter, 1);
|
const roundedLongestDiameter = _round(longestDiameter, 1);
|
||||||
|
|
||||||
@ -272,18 +276,21 @@ function _getDisplayText(
|
|||||||
`l: ${roundedLongestDiameter} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
`l: ${roundedLongestDiameter} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
`s: ${roundedShortestDiameter} ${unit}`,
|
`s: ${roundedShortestDiameter} ${unit}`,
|
||||||
];
|
];
|
||||||
case types.ELLIPSE:
|
}
|
||||||
|
case types.ELLIPSE: {
|
||||||
const { area } = measurement;
|
const { area } = measurement;
|
||||||
|
|
||||||
const roundedArea = _round(area, 1);
|
const roundedArea = _round(area, 1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
`${roundedArea} ${unit}2 (S:${seriesNumber}, I:${instanceNumber})`,
|
`${roundedArea} ${unit}2 (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
];
|
];
|
||||||
case types.POINT:
|
}
|
||||||
|
case types.POINT: {
|
||||||
const { text } = measurement;
|
const { text } = measurement;
|
||||||
return [`${text} (S:${seriesNumber}, I:${instanceNumber})`];
|
return [`${text} (S:${seriesNumber}, I:${instanceNumber})`];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _round(value, decimals) {
|
function _round(value, decimals) {
|
||||||
return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
|
return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user