Pull in main
This commit is contained in:
commit
d956c3008c
@ -33,9 +33,9 @@
|
|||||||
"@ohif/ui": "^0.50.0",
|
"@ohif/ui": "^0.50.0",
|
||||||
"cornerstone-core": "^2.3.0",
|
"cornerstone-core": "^2.3.0",
|
||||||
"cornerstone-math": "^0.1.8",
|
"cornerstone-math": "^0.1.8",
|
||||||
"cornerstone-tools": "4.16.0",
|
"cornerstone-tools": "4.16.1",
|
||||||
"dcmjs": "0.14.0",
|
|
||||||
"cornerstone-wado-image-loader": "^3.1.2",
|
"cornerstone-wado-image-loader": "^3.1.2",
|
||||||
|
"dcmjs": "0.14.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Button, ButtonGroup, Icon, IconButton } from '@ohif/ui';
|
|
||||||
|
|
||||||
function ActionButtons() {
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
<ButtonGroup onClick={() => alert('Export')}>
|
|
||||||
<Button
|
|
||||||
className="px-2 py-2 text-base text-white bg-black border-primary-main"
|
|
||||||
size="initial"
|
|
||||||
color="inherit"
|
|
||||||
>
|
|
||||||
Export
|
|
||||||
</Button>
|
|
||||||
<IconButton
|
|
||||||
className="px-2 text-white bg-black border-primary-main"
|
|
||||||
color="inherit"
|
|
||||||
size="initial"
|
|
||||||
>
|
|
||||||
<Icon name="arrow-down" />
|
|
||||||
</IconButton>
|
|
||||||
</ButtonGroup>
|
|
||||||
<Button
|
|
||||||
className="px-2 py-2 ml-2 text-base text-white bg-black border border-primary-main"
|
|
||||||
variant="outlined"
|
|
||||||
size="initial"
|
|
||||||
color="inherit"
|
|
||||||
onClick={() => alert('Create Report')}
|
|
||||||
>
|
|
||||||
Create Report
|
|
||||||
</Button>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActionButtons;
|
|
||||||
@ -1,55 +1,170 @@
|
|||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { StudySummary, MeasurementTable } from '@ohif/ui';
|
import PropTypes from 'prop-types';
|
||||||
import ActionButtons from './ActionButtons.jsx';
|
import { MeasurementTable } from '@ohif/ui';
|
||||||
|
import { DicomMetadataStore } from '@ohif/core';
|
||||||
|
import debounce from './debounce.js';
|
||||||
|
|
||||||
export default function PanelMeasurementTable({
|
export default function PanelMeasurementTable({
|
||||||
servicesManager,
|
servicesManager,
|
||||||
commandsManager,
|
// commandsManager,
|
||||||
}) {
|
}) {
|
||||||
const { MeasurementService } = servicesManager.services;
|
const { MeasurementService } = servicesManager.services;
|
||||||
|
const [displayMeasurements, setDisplayMeasurements] = useState([]);
|
||||||
|
|
||||||
console.log('MeasurementTable rendering!!!!!!!!!!!!!');
|
useEffect(() => {
|
||||||
|
const debouncedSetDisplayMeasurements = debounce(
|
||||||
|
setDisplayMeasurements,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
// ~~ Initial
|
||||||
|
setDisplayMeasurements(_getMappedMeasurements(MeasurementService));
|
||||||
|
|
||||||
const descriptionData = {
|
// ~~ Subscription
|
||||||
date: '07-Sep-2010',
|
const added = MeasurementService.EVENTS.MEASUREMENT_ADDED;
|
||||||
modality: 'CT',
|
const updated = MeasurementService.EVENTS.MEASUREMENT_UPDATED;
|
||||||
description: 'CHEST/ABD/PELVIS W CONTRAST',
|
const removed = MeasurementService.EVENTS.MEASUREMENT_REMOVED;
|
||||||
};
|
const subscriptions = [];
|
||||||
|
|
||||||
const activeMeasurementItem = 0;
|
[added, updated, removed].forEach(evt => {
|
||||||
|
subscriptions.push(
|
||||||
|
MeasurementService.subscribe(evt, () => {
|
||||||
|
debouncedSetDisplayMeasurements(
|
||||||
|
_getMappedMeasurements(MeasurementService)
|
||||||
|
);
|
||||||
|
}).unsubscribe
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const measurementTableData = {
|
return () => {
|
||||||
title: 'Measurements',
|
subscriptions.forEach(unsub => {
|
||||||
amount: 10,
|
unsub();
|
||||||
data: new Array(10).fill({}).map((el, i) => ({
|
});
|
||||||
id: i + 1,
|
};
|
||||||
label: 'Label short description',
|
}, [MeasurementService]);
|
||||||
displayText: '24.0 x 24.0 mm (S:4, I:22)',
|
|
||||||
isActive: activeMeasurementItem === i + 1,
|
// const activeMeasurementItem = 0;
|
||||||
})),
|
|
||||||
onClick: id => setActiveMeasurementItem(s => (s === id ? null : id)),
|
|
||||||
onEdit: id => alert(`Edit: ${id}`),
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="overflow-x-hidden overflow-y-auto invisible-scrollbar">
|
<div className="overflow-x-hidden overflow-y-auto invisible-scrollbar">
|
||||||
<StudySummary
|
|
||||||
date={descriptionData.date}
|
|
||||||
modality={descriptionData.modality}
|
|
||||||
description={descriptionData.description}
|
|
||||||
/>
|
|
||||||
<MeasurementTable
|
<MeasurementTable
|
||||||
title="Measurements"
|
title="Measurements"
|
||||||
amount={measurementTableData.data.length}
|
amount={displayMeasurements.length}
|
||||||
data={measurementTableData.data}
|
data={displayMeasurements}
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
onEdit={id => alert(`Edit: ${id}`)}
|
onEdit={id => alert(`Edit: ${id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-center p-4">
|
|
||||||
<ActionButtons />
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PanelMeasurementTable.propTypes = {
|
||||||
|
servicesManager: PropTypes.shape({
|
||||||
|
services: PropTypes.shape({
|
||||||
|
MeasurementService: PropTypes.shape({
|
||||||
|
getMeasurements: PropTypes.func.isRequired,
|
||||||
|
subscribe: PropTypes.func.isRequired,
|
||||||
|
EVENTS: PropTypes.object.isRequired,
|
||||||
|
VALUE_TYPES: PropTypes.object.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
function _getMappedMeasurements(MeasurementService) {
|
||||||
|
const measurements = MeasurementService.getMeasurements();
|
||||||
|
const mappedMeasurements = measurements.map((m, index) =>
|
||||||
|
_mapMeasurementToDisplay(m, index, MeasurementService.VALUE_TYPES)
|
||||||
|
);
|
||||||
|
|
||||||
|
return mappedMeasurements;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _mapMeasurementToDisplay(measurement, index, types) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
label,
|
||||||
|
description,
|
||||||
|
// Reference IDs
|
||||||
|
referenceStudyUID,
|
||||||
|
referenceSeriesUID,
|
||||||
|
SOPInstanceUID,
|
||||||
|
} = measurement;
|
||||||
|
const instance = DicomMetadataStore.getInstance(
|
||||||
|
referenceStudyUID,
|
||||||
|
referenceSeriesUID,
|
||||||
|
SOPInstanceUID
|
||||||
|
);
|
||||||
|
const { PixelSpacing, SeriesNumber, InstanceNumber } = instance;
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: index + 1,
|
||||||
|
label: '(empty)', // 'Label short description',
|
||||||
|
displayText:
|
||||||
|
_getDisplayText(
|
||||||
|
measurement,
|
||||||
|
PixelSpacing,
|
||||||
|
SeriesNumber,
|
||||||
|
InstanceNumber,
|
||||||
|
types
|
||||||
|
) || [],
|
||||||
|
// TODO: handle one layer down
|
||||||
|
isActive: false, // activeMeasurementItem === i + 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getDisplayText(
|
||||||
|
measurement,
|
||||||
|
pixelSpacing,
|
||||||
|
seriesNumber,
|
||||||
|
instanceNumber,
|
||||||
|
types
|
||||||
|
) {
|
||||||
|
const { type, points } = measurement;
|
||||||
|
const hasPixelSpacing =
|
||||||
|
pixelSpacing !== undefined &&
|
||||||
|
Array.isArray(pixelSpacing) &&
|
||||||
|
pixelSpacing.length === 2;
|
||||||
|
const [rowPixelSpacing, colPixelSpacing] = hasPixelSpacing
|
||||||
|
? pixelSpacing
|
||||||
|
: [1, 1];
|
||||||
|
const unit = hasPixelSpacing ? 'mm' : 'px';
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case types.POLYLINE: {
|
||||||
|
const { length } = measurement;
|
||||||
|
const roundedLength = _round(length, 1);
|
||||||
|
|
||||||
|
return [
|
||||||
|
`${roundedLength} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case types.BIDIRECTIONAL: {
|
||||||
|
const { shortestDiameter, longestDiameter } = measurement;
|
||||||
|
const roundedShortestDiameter = _round(shortestDiameter, 1);
|
||||||
|
const roundedLongestDiameter = _round(longestDiameter, 1);
|
||||||
|
|
||||||
|
return [
|
||||||
|
`l: ${roundedLongestDiameter} ${unit} (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
|
`s: ${roundedShortestDiameter} ${unit}`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case types.ELLIPSE: {
|
||||||
|
const { area } = measurement;
|
||||||
|
const roundedArea = _round(area, 1);
|
||||||
|
|
||||||
|
return [
|
||||||
|
`${roundedArea} ${unit}2 (S:${seriesNumber}, I:${instanceNumber})`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
case types.POINT: {
|
||||||
|
const { text } = measurement;
|
||||||
|
return [`${text} (S:${seriesNumber}, I:${instanceNumber})`];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _round(value, decimals) {
|
||||||
|
return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
|
||||||
|
}
|
||||||
|
|||||||
@ -21,15 +21,13 @@ function PanelStudyBrowser({
|
|||||||
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
||||||
const [{ StudyInstanceUIDs }, dispatch] = useImageViewer();
|
const [{ StudyInstanceUIDs }, dispatch] = useImageViewer();
|
||||||
const [activeTabName, setActiveTabName] = useState('primary');
|
const [activeTabName, setActiveTabName] = useState('primary');
|
||||||
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState(
|
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState([
|
||||||
[]
|
...StudyInstanceUIDs,
|
||||||
);
|
]);
|
||||||
const [studyDisplayList, setStudyDisplayList] = useState([]);
|
const [studyDisplayList, setStudyDisplayList] = useState([]);
|
||||||
const [displaySets, setDisplaySets] = useState([]);
|
const [displaySets, setDisplaySets] = useState([]);
|
||||||
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
|
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
|
||||||
|
|
||||||
console.log(DisplaySetService);
|
|
||||||
|
|
||||||
// ~~ studyDisplayList
|
// ~~ studyDisplayList
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Fetch all studies for the patient in each primary study
|
// Fetch all studies for the patient in each primary study
|
||||||
|
|||||||
21
extensions/default/src/debounce.js
Normal file
21
extensions/default/src/debounce.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Returns a function, that, as long as it continues to be invoked, will not
|
||||||
|
// be triggered. The function will be called after it stops being called for
|
||||||
|
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||||||
|
// leading edge, instead of the trailing.
|
||||||
|
function debounce(func, wait, immediate) {
|
||||||
|
var timeout;
|
||||||
|
return function() {
|
||||||
|
var context = this,
|
||||||
|
args = arguments;
|
||||||
|
var later = function() {
|
||||||
|
timeout = null;
|
||||||
|
if (!immediate) func.apply(context, args);
|
||||||
|
};
|
||||||
|
var callNow = immediate && !timeout;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(later, wait);
|
||||||
|
if (callNow) func.apply(context, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default debounce;
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
"cornerstone-core": "^2.2.8",
|
"cornerstone-core": "^2.2.8",
|
||||||
"cornerstone-tools": "4.16.0",
|
"cornerstone-tools": "4.16.1",
|
||||||
"dcmjs": "0.14.0",
|
"dcmjs": "0.14.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
"cornerstone-core": "^2.2.8",
|
"cornerstone-core": "^2.2.8",
|
||||||
"cornerstone-tools": "4.15.1",
|
"cornerstone-tools": "4.16.1",
|
||||||
"dcmjs": "0.14.0",
|
"dcmjs": "0.14.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.8.6",
|
"react": "^16.8.6",
|
||||||
|
|||||||
@ -33,9 +33,9 @@
|
|||||||
"@ohif/ui": "^0.50.0",
|
"@ohif/ui": "^0.50.0",
|
||||||
"cornerstone-core": "^2.3.0",
|
"cornerstone-core": "^2.3.0",
|
||||||
"cornerstone-math": "^0.1.8",
|
"cornerstone-math": "^0.1.8",
|
||||||
"cornerstone-tools": "4.16.0",
|
"cornerstone-tools": "4.16.1",
|
||||||
"dcmjs": "0.14.0",
|
|
||||||
"cornerstone-wado-image-loader": "^3.1.2",
|
"cornerstone-wado-image-loader": "^3.1.2",
|
||||||
|
"dcmjs": "0.14.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import id from './id';
|
import id from './id';
|
||||||
import { utils, classes } from '@ohif/core';
|
import { utils, classes } from '@ohif/core';
|
||||||
import addMeasurement from './utils/addMeasurement.js';
|
import addMeasurement from './utils/addMeasurement';
|
||||||
import { adapters } from 'dcmjs';
|
import isRehydratable from './utils/isRehydratable';
|
||||||
|
|
||||||
const cornerstoneAdapters = adapters.Cornerstone;
|
|
||||||
|
|
||||||
const { ImageSet } = classes;
|
const { ImageSet } = classes;
|
||||||
|
|
||||||
@ -95,7 +93,12 @@ function _getDisplaySetsFromSeries(
|
|||||||
sopClassUids,
|
sopClassUids,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_isRehydratable(displaySet, MeasurementService)) {
|
const mappings = MeasurementService.getSourceMappings(
|
||||||
|
'CornerstoneTools',
|
||||||
|
'4'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isRehydratable(displaySet, mappings)) {
|
||||||
displaySet.isLocked = false;
|
displaySet.isLocked = false;
|
||||||
displaySet.isHydrated = false;
|
displaySet.isHydrated = false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ export default {
|
|||||||
id,
|
id,
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// TODO -> This isn't used anywhere yet, but we do have a hard dependency, and need to check for these in the future.
|
// TODO -> This isn't used anywhere yet, but we do have a hard dependency, and need to check for these in the future.
|
||||||
|
// OHIF-229
|
||||||
{
|
{
|
||||||
id: 'org.ohif.cornerstone',
|
id: 'org.ohif.cornerstone',
|
||||||
version: '3.0.0',
|
version: '3.0.0',
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export default function getToolStateToCornerstoneMeasurementSchema(
|
|||||||
// TODO -> I get why this was attemped, but its not nearly flexible enough.
|
// TODO -> I get why this was attemped, but its not nearly flexible enough.
|
||||||
// A single measurement may have an ellipse + a bidirectional measurement, for instances.
|
// A single measurement may have an ellipse + a bidirectional measurement, for instances.
|
||||||
// You can't define a bidirectional tool as a single type..
|
// You can't define a bidirectional tool as a single type..
|
||||||
|
// OHIF-230
|
||||||
const TOOL_TYPE_TO_VALUE_TYPE = {
|
const TOOL_TYPE_TO_VALUE_TYPE = {
|
||||||
Length: POLYLINE,
|
Length: POLYLINE,
|
||||||
EllipticalRoi: ELLIPSE,
|
EllipticalRoi: ELLIPSE,
|
||||||
|
|||||||
48
extensions/dicom-sr/src/utils/isRehydratable.js
Normal file
48
extensions/dicom-sr/src/utils/isRehydratable.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { adapters } from 'dcmjs';
|
||||||
|
|
||||||
|
const cornerstoneAdapters = adapters.Cornerstone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given `displySet`can be rehydrated into the `MeasurementService`.
|
||||||
|
*
|
||||||
|
* @param {object} displaySet The SR `displaySet` to check.
|
||||||
|
* @param {object[]} mappings The CornerstoneTools 4 mappings to the `MeasurementService`.
|
||||||
|
* @returns {boolean} True if the SR can be rehydrated into the `MeasurementService`.
|
||||||
|
*/
|
||||||
|
export default function isRehydratable(displaySet, mappings) {
|
||||||
|
if (!mappings || !mappings.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mappingDefinitions = mappings.map(m => m.definition);
|
||||||
|
const { measurements } = displaySet;
|
||||||
|
|
||||||
|
const adapterKeys = Object.keys(cornerstoneAdapters).filter(
|
||||||
|
adapterKey =>
|
||||||
|
typeof cornerstoneAdapters[adapterKey]
|
||||||
|
.isValidCornerstoneTrackingIdentifier === 'function'
|
||||||
|
);
|
||||||
|
|
||||||
|
const adapters = [];
|
||||||
|
|
||||||
|
adapterKeys.forEach(key => {
|
||||||
|
if (mappingDefinitions.includes(key)) {
|
||||||
|
// Must have both a dcmjs adapter and a MeasurementService
|
||||||
|
// Definition in order to be a candidate for import.
|
||||||
|
adapters.push(cornerstoneAdapters[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < measurements.length; i++) {
|
||||||
|
const TrackingIdentifier = measurements[i].TrackingIdentifier;
|
||||||
|
const hydratable = adapters.some(adapter =>
|
||||||
|
adapter.isValidCornerstoneTrackingIdentifier(TrackingIdentifier)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hydratable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@ -28,12 +28,12 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^0.50.0",
|
"@ohif/core": "^0.50.0",
|
||||||
|
"cornerstone-tools": "4.16.1",
|
||||||
"dcmjs": "0.14.0",
|
"dcmjs": "0.14.0",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"webpack": "^4.0.0",
|
"webpack": "^4.0.0"
|
||||||
"cornerstone-tools": "4.15.1"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "7.7.6",
|
"@babel/runtime": "7.7.6",
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { DICOMSR } from '@ohif/core';
|
||||||
|
|
||||||
|
async function createReportAsync(servicesManager, dataSource, measurements) {
|
||||||
|
const {
|
||||||
|
UINotificationService,
|
||||||
|
UIDialogService,
|
||||||
|
DisplaySetService,
|
||||||
|
} = servicesManager.services;
|
||||||
|
const loadingDialogId = UIDialogService.create({
|
||||||
|
showOverlay: true,
|
||||||
|
isDraggable: false,
|
||||||
|
centralize: true,
|
||||||
|
// TODO: Create a loading indicator component + zeplin design?
|
||||||
|
content: Loading,
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const naturalizedReport = await DICOMSR.storeMeasurements(
|
||||||
|
measurements,
|
||||||
|
dataSource
|
||||||
|
);
|
||||||
|
|
||||||
|
DisplaySetService.makeDisplaySets([naturalizedReport], {
|
||||||
|
madeInClient: true,
|
||||||
|
});
|
||||||
|
UINotificationService.show({
|
||||||
|
title: 'STOW SR',
|
||||||
|
message: 'Measurements saved successfully',
|
||||||
|
type: 'success',
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
UINotificationService.show({
|
||||||
|
title: 'STOW SR',
|
||||||
|
message: error.message || 'Failed to store measurements',
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
UIDialogService.dismiss({ id: loadingDialogId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Loading() {
|
||||||
|
return <div className="text-primary-active">Loading...</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createReportAsync;
|
||||||
@ -19,25 +19,33 @@ const useTrackedMeasurements = () => useContext(TrackedMeasurementsContext);
|
|||||||
* @param {*} param0
|
* @param {*} param0
|
||||||
*/
|
*/
|
||||||
function TrackedMeasurementsContextProvider(
|
function TrackedMeasurementsContextProvider(
|
||||||
UIViewportDialogService,
|
{ servicesManager, extensionManager }, // Bound by consumer
|
||||||
{ children }
|
{ children } // Component props
|
||||||
) {
|
) {
|
||||||
const machineOptions = Object.assign({}, defaultOptions);
|
const machineOptions = Object.assign({}, defaultOptions);
|
||||||
machineOptions.services = Object.assign({}, machineOptions.services, {
|
machineOptions.services = Object.assign({}, machineOptions.services, {
|
||||||
promptBeginTracking: promptBeginTracking.bind(
|
promptBeginTracking: promptBeginTracking.bind(null, {
|
||||||
null,
|
servicesManager,
|
||||||
UIViewportDialogService
|
extensionManager,
|
||||||
),
|
}),
|
||||||
promptTrackNewSeries: promptTrackNewSeries.bind(
|
promptTrackNewSeries: promptTrackNewSeries.bind(null, {
|
||||||
null,
|
servicesManager,
|
||||||
UIViewportDialogService
|
extensionManager,
|
||||||
),
|
}),
|
||||||
promptTrackNewStudy: promptTrackNewStudy.bind(
|
promptTrackNewStudy: promptTrackNewStudy.bind(null, {
|
||||||
null,
|
servicesManager,
|
||||||
UIViewportDialogService
|
extensionManager,
|
||||||
),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: IMPROVE
|
||||||
|
// - Add measurement_updated to cornerstone; debounced? (ext side, or consumption?)
|
||||||
|
// - Friendlier transition/api in front of measurementTracking machine?
|
||||||
|
// - Blocked: viewport overlay shouldn't clip when resized
|
||||||
|
// TODO: PRIORITY
|
||||||
|
// - Fix "ellipses" series description dynamic truncate length
|
||||||
|
// - Fix viewport border resize
|
||||||
|
// - created/destroyed hooks for extensions (cornerstone measurement subscriptions in it's `init`)
|
||||||
|
|
||||||
const measurementTrackingMachine = Machine(
|
const measurementTrackingMachine = Machine(
|
||||||
machineConfiguration,
|
machineConfiguration,
|
||||||
@ -61,6 +69,8 @@ function TrackedMeasurementsContextProvider(
|
|||||||
|
|
||||||
TrackedMeasurementsContextProvider.propTypes = {
|
TrackedMeasurementsContextProvider.propTypes = {
|
||||||
children: PropTypes.oneOf([PropTypes.func, PropTypes.node]),
|
children: PropTypes.oneOf([PropTypes.func, PropTypes.node]),
|
||||||
|
servicesManager: PropTypes.object.isRequired,
|
||||||
|
extensionManager: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
@ -76,6 +76,12 @@ const machineConfiguration = {
|
|||||||
target: 'idle',
|
target: 'idle',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
SET_TRACKED_SERIES: [
|
||||||
|
{
|
||||||
|
target: 'tracking',
|
||||||
|
actions: ['setTrackedStudyAndMultipleSeries'],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
promptTrackNewSeries: {
|
promptTrackNewSeries: {
|
||||||
|
|||||||
@ -6,7 +6,8 @@ const RESPONSE = {
|
|||||||
SET_STUDY_AND_SERIES: 3,
|
SET_STUDY_AND_SERIES: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
function promptUser(UIViewportDialogService, ctx, evt) {
|
function promptUser({ servicesManager }, ctx, evt) {
|
||||||
|
const { UIViewportDialogService } = servicesManager.services;
|
||||||
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
||||||
|
|
||||||
return new Promise(async function(resolve, reject) {
|
return new Promise(async function(resolve, reject) {
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import createReportAsync from './../../_shared/createReportAsync.js';
|
||||||
|
|
||||||
const RESPONSE = {
|
const RESPONSE = {
|
||||||
NO_NEVER: -1,
|
NO_NEVER: -1,
|
||||||
CANCEL: 0,
|
CANCEL: 0,
|
||||||
@ -6,8 +8,13 @@ const RESPONSE = {
|
|||||||
SET_STUDY_AND_SERIES: 3,
|
SET_STUDY_AND_SERIES: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
function promptUser(UIViewportDialogService, ctx, evt) {
|
function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
||||||
|
const {
|
||||||
|
UIViewportDialogService,
|
||||||
|
MeasurementService,
|
||||||
|
} = servicesManager.services;
|
||||||
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
||||||
|
const { trackedStudy, trackedSeries } = ctx;
|
||||||
|
|
||||||
return new Promise(async function(resolve, reject) {
|
return new Promise(async function(resolve, reject) {
|
||||||
let promptResult = await _askShouldAddMeasurements(
|
let promptResult = await _askShouldAddMeasurements(
|
||||||
@ -22,9 +29,19 @@ function promptUser(UIViewportDialogService, ctx, evt) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Hook into @JamesAPetts createReport
|
|
||||||
if (promptResult === RESPONSE.CREATE_REPORT) {
|
if (promptResult === RESPONSE.CREATE_REPORT) {
|
||||||
window.alert('CREATE REPORT');
|
// TODO -> Eventually deal with multiple dataSources.
|
||||||
|
// Would need some way of saying which one is the "push" dataSource
|
||||||
|
const dataSources = extensionManager.getDataSources();
|
||||||
|
const dataSource = dataSources[0];
|
||||||
|
const measurements = MeasurementService.getMeasurements();
|
||||||
|
const trackedMeasurements = measurements.filter(
|
||||||
|
m =>
|
||||||
|
trackedStudy === m.referenceStudyUID &&
|
||||||
|
trackedSeries.includes(m.referenceSeriesUID)
|
||||||
|
);
|
||||||
|
|
||||||
|
createReportAsync(servicesManager, dataSource, trackedMeasurements);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import createReportAsync from './../../_shared/createReportAsync.js';
|
||||||
|
|
||||||
const RESPONSE = {
|
const RESPONSE = {
|
||||||
NO_NEVER: -1,
|
NO_NEVER: -1,
|
||||||
CANCEL: 0,
|
CANCEL: 0,
|
||||||
@ -6,8 +8,13 @@ const RESPONSE = {
|
|||||||
SET_STUDY_AND_SERIES: 3,
|
SET_STUDY_AND_SERIES: 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
function promptUser(UIViewportDialogService, ctx, evt) {
|
function promptUser({ servicesManager, extensionManager }, ctx, evt) {
|
||||||
|
const {
|
||||||
|
UIViewportDialogService,
|
||||||
|
MeasurementService,
|
||||||
|
} = servicesManager.services;
|
||||||
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
const { viewportIndex, StudyInstanceUID, SeriesInstanceUID } = evt;
|
||||||
|
const { trackedStudy, trackedSeries } = ctx;
|
||||||
|
|
||||||
return new Promise(async function(resolve, reject) {
|
return new Promise(async function(resolve, reject) {
|
||||||
let promptResult = await _askTrackMeasurements(
|
let promptResult = await _askTrackMeasurements(
|
||||||
@ -22,9 +29,19 @@ function promptUser(UIViewportDialogService, ctx, evt) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Hook into @JamesAPetts createReport
|
|
||||||
if (promptResult === RESPONSE.CREATE_REPORT) {
|
if (promptResult === RESPONSE.CREATE_REPORT) {
|
||||||
window.alert('CREATE REPORT');
|
// TODO -> Eventually deal with multiple dataSources.
|
||||||
|
// Would need some way of saying which one is the "push" dataSource
|
||||||
|
const dataSources = extensionManager.getDataSources();
|
||||||
|
const dataSource = dataSources[0];
|
||||||
|
const measurements = MeasurementService.getMeasurements();
|
||||||
|
const trackedMeasurements = measurements.filter(
|
||||||
|
m =>
|
||||||
|
trackedStudy === m.referenceStudyUID &&
|
||||||
|
trackedSeries.includes(m.referenceSeriesUID)
|
||||||
|
);
|
||||||
|
|
||||||
|
createReportAsync(servicesManager, dataSource, trackedMeasurements);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
|
|||||||
@ -4,11 +4,10 @@ import {
|
|||||||
useTrackedMeasurements,
|
useTrackedMeasurements,
|
||||||
} from './contexts';
|
} from './contexts';
|
||||||
|
|
||||||
function getContextModule({ servicesManager }) {
|
function getContextModule({ servicesManager, extensionManager }) {
|
||||||
const { UIViewportDialogService } = servicesManager.services;
|
|
||||||
const BoundTrackedMeasurementsContextProvider = TrackedMeasurementsContextProvider.bind(
|
const BoundTrackedMeasurementsContextProvider = TrackedMeasurementsContextProvider.bind(
|
||||||
null,
|
null,
|
||||||
UIViewportDialogService
|
{ servicesManager, extensionManager }
|
||||||
);
|
);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -5,9 +5,7 @@ import { DicomMetadataStore, DICOMSR } from '@ohif/core';
|
|||||||
import { useDebounce } from '@hooks';
|
import { useDebounce } from '@hooks';
|
||||||
import ActionButtons from './ActionButtons';
|
import ActionButtons from './ActionButtons';
|
||||||
import { useTrackedMeasurements } from '../../getContextModule';
|
import { useTrackedMeasurements } from '../../getContextModule';
|
||||||
import cornerstoneTools from 'cornerstone-tools';
|
import createReportAsync from './../../_shared/createReportAsync.js';
|
||||||
import cornerstone from 'cornerstone-core';
|
|
||||||
import dcmjs from 'dcmjs';
|
|
||||||
|
|
||||||
const DISPLAY_STUDY_SUMMARY_INITIAL_VALUE = {
|
const DISPLAY_STUDY_SUMMARY_INITIAL_VALUE = {
|
||||||
key: undefined, //
|
key: undefined, //
|
||||||
@ -24,7 +22,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
measurementChangeTimestamp,
|
measurementChangeTimestamp,
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
const { MeasurementService, DisplaySetService } = servicesManager.services;
|
const { MeasurementService } = servicesManager.services;
|
||||||
const [
|
const [
|
||||||
trackedMeasurements,
|
trackedMeasurements,
|
||||||
sendTrackedMeasurementsEvent,
|
sendTrackedMeasurementsEvent,
|
||||||
@ -34,9 +32,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(
|
||||||
@ -103,9 +99,24 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
};
|
};
|
||||||
}, [MeasurementService, sendTrackedMeasurementsEvent]);
|
}, [MeasurementService, sendTrackedMeasurementsEvent]);
|
||||||
|
|
||||||
const activeMeasurementItem = 0;
|
function createReport() {
|
||||||
|
// TODO -> Eventually deal with multiple dataSources.
|
||||||
|
// Would need some way of saying which one is the "push" dataSource
|
||||||
|
const dataSources = extensionManager.getDataSources();
|
||||||
|
const dataSource = dataSources[0];
|
||||||
|
const measurements = MeasurementService.getMeasurements();
|
||||||
|
const trackedMeasurements = measurements.filter(
|
||||||
|
m =>
|
||||||
|
trackedStudy === m.referenceStudyUID &&
|
||||||
|
trackedSeries.includes(m.referenceSeriesUID)
|
||||||
|
);
|
||||||
|
|
||||||
const exportReport = () => {
|
return createReportAsync(servicesManager, dataSource, trackedMeasurements);
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportReport() {
|
||||||
|
const dataSources = extensionManager.getDataSources();
|
||||||
|
const dataSource = dataSources[0];
|
||||||
const measurements = MeasurementService.getMeasurements();
|
const measurements = MeasurementService.getMeasurements();
|
||||||
const trackedMeasurements = measurements.filter(
|
const trackedMeasurements = measurements.filter(
|
||||||
m =>
|
m =>
|
||||||
@ -115,31 +126,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
|
|
||||||
// TODO -> local download.
|
// TODO -> local download.
|
||||||
DICOMSR.downloadReport(trackedMeasurements, dataSource);
|
DICOMSR.downloadReport(trackedMeasurements, dataSource);
|
||||||
};
|
}
|
||||||
|
|
||||||
const createReport = async () => {
|
|
||||||
const measurements = MeasurementService.getMeasurements();
|
|
||||||
const trackedMeasurements = measurements.filter(
|
|
||||||
m =>
|
|
||||||
trackedStudy === m.referenceStudyUID &&
|
|
||||||
trackedSeries.includes(m.referenceSeriesUID)
|
|
||||||
);
|
|
||||||
|
|
||||||
const dataSources = extensionManager.getDataSources();
|
|
||||||
// TODO -> Eventually deal with multiple dataSources.
|
|
||||||
// Would need some way of saying which one is the "push" dataSource
|
|
||||||
const dataSource = dataSources[0];
|
|
||||||
|
|
||||||
DICOMSR.storeMeasurements(
|
|
||||||
trackedMeasurements,
|
|
||||||
dataSource,
|
|
||||||
naturalizedReport => {
|
|
||||||
DisplaySetService.makeDisplaySets([naturalizedReport], {
|
|
||||||
madeInClient: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -169,7 +156,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) {
|
||||||
@ -189,9 +185,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',
|
||||||
@ -220,15 +213,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) &&
|
||||||
@ -239,18 +224,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);
|
||||||
|
|
||||||
@ -258,16 +241,19 @@ 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})`];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,20 +22,33 @@ function PanelStudyBrowserTracking({
|
|||||||
// doesn't have to have such an intense shape. This works well enough for now.
|
// doesn't have to have such an intense shape. This works well enough for now.
|
||||||
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
// Tabs --> Studies --> DisplaySets --> Thumbnails
|
||||||
const [{ StudyInstanceUIDs }, dispatchImageViewer] = useImageViewer();
|
const [{ StudyInstanceUIDs }, dispatchImageViewer] = useImageViewer();
|
||||||
const [{ activeViewportIndex, viewports }] = useViewportGrid();
|
const [
|
||||||
|
{ activeViewportIndex, viewports },
|
||||||
|
viewportGridService,
|
||||||
|
] = useViewportGrid();
|
||||||
const [
|
const [
|
||||||
trackedMeasurements,
|
trackedMeasurements,
|
||||||
sendTrackedMeasurementsEvent,
|
sendTrackedMeasurementsEvent,
|
||||||
] = useTrackedMeasurements();
|
] = useTrackedMeasurements();
|
||||||
const [activeTabName, setActiveTabName] = useState('primary');
|
const [activeTabName, setActiveTabName] = useState('primary');
|
||||||
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState(
|
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState([
|
||||||
[]
|
...StudyInstanceUIDs,
|
||||||
);
|
]);
|
||||||
const [studyDisplayList, setStudyDisplayList] = useState([]);
|
const [studyDisplayList, setStudyDisplayList] = useState([]);
|
||||||
const [displaySets, setDisplaySets] = useState([]);
|
const [displaySets, setDisplaySets] = useState([]);
|
||||||
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
|
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
|
||||||
const [jumpToDisplaySet, setJumpToDisplaySet] = useState(null);
|
const [jumpToDisplaySet, setJumpToDisplaySet] = useState(null);
|
||||||
|
|
||||||
|
const onDoubleClickThumbnailHandler = displaySetInstanceUID => {
|
||||||
|
viewportGridService.setDisplaysetForViewport({
|
||||||
|
viewportIndex: activeViewportIndex,
|
||||||
|
displaySetInstanceUID,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const activeDisplaySetInstanceUID =
|
||||||
|
viewports[activeViewportIndex]?.displaySetInstanceUID;
|
||||||
|
|
||||||
// TODO: Should this be somewhere else? Feels more like a mode "lifecycle" setup/destroy?
|
// TODO: Should this be somewhere else? Feels more like a mode "lifecycle" setup/destroy?
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { unsubscribe } = MeasurementService.subscribe(
|
const { unsubscribe } = MeasurementService.subscribe(
|
||||||
@ -287,11 +300,18 @@ function PanelStudyBrowserTracking({
|
|||||||
SeriesInstanceUID: displaySet.SeriesInstanceUID,
|
SeriesInstanceUID: displaySet.SeriesInstanceUID,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
onClickThumbnail={() => {}}
|
||||||
|
onDoubleClickThumbnail={onDoubleClickThumbnailHandler}
|
||||||
|
activeDisplaySetInstanceUID={activeDisplaySetInstanceUID}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelStudyBrowserTracking.propTypes = {
|
PanelStudyBrowserTracking.propTypes = {
|
||||||
|
MeasurementService: PropTypes.shape({
|
||||||
|
subscribe: PropTypes.func.isRequired,
|
||||||
|
EVENTS: PropTypes.object.isRequired,
|
||||||
|
}).isRequired,
|
||||||
DisplaySetService: PropTypes.shape({
|
DisplaySetService: PropTypes.shape({
|
||||||
EVENTS: PropTypes.object.isRequired,
|
EVENTS: PropTypes.object.isRequired,
|
||||||
activeDisplaySets: PropTypes.arrayOf(PropTypes.object).isRequired,
|
activeDisplaySets: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
|||||||
@ -55,9 +55,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ohif/core": "^2.9.6",
|
"@ohif/core": "^2.9.6",
|
||||||
"cornerstone-tools": "4.16.0",
|
|
||||||
"@ohif/ui": "^2.0.0",
|
"@ohif/ui": "^2.0.0",
|
||||||
"cornerstone-core": "^2.3.0",
|
"cornerstone-core": "^2.3.0",
|
||||||
|
"cornerstone-tools": "4.16.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.2",
|
"cornerstone-wado-image-loader": "^3.1.2",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
"gh-pages": "^2.0.1",
|
"gh-pages": "^2.0.1",
|
||||||
|
|||||||
@ -20,8 +20,8 @@ export default function mode({ modeConfiguration }) {
|
|||||||
return {
|
return {
|
||||||
// TODO: We're using this as a route segment
|
// TODO: We're using this as a route segment
|
||||||
// We should not be.
|
// We should not be.
|
||||||
id: 'longitudinal-workflow',
|
id: 'viewer',
|
||||||
displayName: 'Comparison',
|
displayName: 'Basic Viewer',
|
||||||
validationTags: {
|
validationTags: {
|
||||||
study: [],
|
study: [],
|
||||||
series: [],
|
series: [],
|
||||||
@ -95,9 +95,7 @@ export default function mode({ modeConfiguration }) {
|
|||||||
'org.ohif.dicom-sr',
|
'org.ohif.dicom-sr',
|
||||||
],
|
],
|
||||||
sopClassHandlers: [ohif.sopClassHandler, dicomsr.sopClassHandler],
|
sopClassHandlers: [ohif.sopClassHandler, dicomsr.sopClassHandler],
|
||||||
hotkeys: [
|
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||||
...hotkeys.defaults.hotkeyBindings
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@ohif/mode-example",
|
"name": "@ohif/mode-segmentation",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Example mode for OHIF",
|
"description": "Segmentation mode for OHIF",
|
||||||
"author": "OHIF",
|
"author": "OHIF",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "OHIF/Viewers",
|
"repository": "OHIF/Viewers",
|
||||||
@ -3,8 +3,10 @@ import { hotkeys } from '@ohif/core';
|
|||||||
|
|
||||||
export default function mode({ modeConfiguration }) {
|
export default function mode({ modeConfiguration }) {
|
||||||
return {
|
return {
|
||||||
id: 'example-mode',
|
// TODO: Mode uses 'id' for route when it should use `slug`, if provided, and
|
||||||
displayName: 'Basic Viewer',
|
// the route path
|
||||||
|
id: 'segmentation',
|
||||||
|
displayName: 'Segmentation',
|
||||||
validationTags: {
|
validationTags: {
|
||||||
study: [],
|
study: [],
|
||||||
series: [],
|
series: [],
|
||||||
@ -15,7 +17,7 @@ export default function mode({ modeConfiguration }) {
|
|||||||
},
|
},
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: 'viewer',
|
path: 'segmentation',
|
||||||
init: ({ servicesManager, extensionManager }) => {
|
init: ({ servicesManager, extensionManager }) => {
|
||||||
const { ToolBarService } = servicesManager.services;
|
const { ToolBarService } = servicesManager.services;
|
||||||
ToolBarService.init(extensionManager);
|
ToolBarService.init(extensionManager);
|
||||||
@ -51,7 +53,6 @@ export default function mode({ modeConfiguration }) {
|
|||||||
return {
|
return {
|
||||||
id: 'org.ohif.default.layoutTemplateModule.viewerLayout',
|
id: 'org.ohif.default.layoutTemplateModule.viewerLayout',
|
||||||
props: {
|
props: {
|
||||||
// named slots
|
|
||||||
leftPanels: ['org.ohif.default.panelModule.seriesList'],
|
leftPanels: ['org.ohif.default.panelModule.seriesList'],
|
||||||
rightPanels: ['org.ohif.default.panelModule.measure'],
|
rightPanels: ['org.ohif.default.panelModule.measure'],
|
||||||
viewports: [
|
viewports: [
|
||||||
@ -69,10 +70,8 @@ export default function mode({ modeConfiguration }) {
|
|||||||
],
|
],
|
||||||
extensions: ['org.ohif.default', 'org.ohif.cornerstone'],
|
extensions: ['org.ohif.default', 'org.ohif.cornerstone'],
|
||||||
sopClassHandlers: ['org.ohif.default.sopClassHandlerModule.stack'],
|
sopClassHandlers: ['org.ohif.default.sopClassHandlerModule.stack'],
|
||||||
hotkeys: [
|
hotkeys: [...hotkeys.defaults.hotkeyBindings],
|
||||||
...hotkeys.defaults.hotkeyBindings
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.exampleMode = mode({});
|
window.segmentationMode = mode({});
|
||||||
@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"cornerstone-core": "^2.3.0",
|
"cornerstone-core": "^2.3.0",
|
||||||
"cornerstone-tools": "4.16.0",
|
"cornerstone-tools": "4.16.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.2",
|
"cornerstone-wado-image-loader": "^3.1.2",
|
||||||
"dicom-parser": "^1.8.3"
|
"dicom-parser": "^1.8.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -79,8 +79,9 @@ const generateReport = measurementData => {
|
|||||||
* @param {object[]} measurementData An array of measurements from the measurements service
|
* @param {object[]} measurementData An array of measurements from the measurements service
|
||||||
* that you wish to serialize.
|
* that you wish to serialize.
|
||||||
* @param {object} dataSource The dataSource that you wish to use to persist the data.
|
* @param {object} dataSource The dataSource that you wish to use to persist the data.
|
||||||
|
* @return {object} The naturalized report
|
||||||
*/
|
*/
|
||||||
const storeMeasurements = async (measurementData, dataSource, onSuccess) => {
|
const storeMeasurements = async (measurementData, dataSource) => {
|
||||||
// TODO -> Eventually use the measurements directly and not the dcmjs adapter,
|
// TODO -> Eventually use the measurements directly and not the dcmjs adapter,
|
||||||
// But it is good enough for now whilst we only have cornerstone as a datasource.
|
// But it is good enough for now whilst we only have cornerstone as a datasource.
|
||||||
log.info('[DICOMSR] storeMeasurements');
|
log.info('[DICOMSR] storeMeasurements');
|
||||||
@ -90,28 +91,22 @@ const storeMeasurements = async (measurementData, dataSource, onSuccess) => {
|
|||||||
return Promise.reject({});
|
return Promise.reject({});
|
||||||
}
|
}
|
||||||
|
|
||||||
const naturalizedReport = generateReport(measurementData);
|
|
||||||
const { StudyInstanceUID } = naturalizedReport;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const naturalizedReport = generateReport(measurementData);
|
||||||
|
const { StudyInstanceUID } = naturalizedReport;
|
||||||
|
|
||||||
await dataSource.store.dicom(naturalizedReport);
|
await dataSource.store.dicom(naturalizedReport);
|
||||||
|
|
||||||
if (StudyInstanceUID) {
|
if (StudyInstanceUID) {
|
||||||
dataSource.deleteStudyMetadataPromise(StudyInstanceUID);
|
dataSource.deleteStudyMetadataPromise(StudyInstanceUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onSuccess) {
|
return naturalizedReport;
|
||||||
onSuccess(naturalizedReport);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
message: 'Measurements saved successfully',
|
|
||||||
};
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
`[DICOMSR] Error while saving the measurements: ${error.message}`
|
`[DICOMSR] Error while saving the measurements: ${error.message}`
|
||||||
);
|
);
|
||||||
throw new Error('Error while saving the measurements.');
|
throw new Error(error.message || 'Error while saving the measurements.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 19 19">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19 19">
|
||||||
<g fill="currentColor" fill-rule="evenodd">
|
<g fill="currentColor" fill-rule="evenodd">
|
||||||
<g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
|
<g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
|
||||||
<path d="M.188.187L8.813 8.812M8.813.187L.188 8.812" transform="translate(5 5)"/>
|
<path d="M.188.187L8.813 8.812M8.813.187L.188 8.812" transform="translate(5 5)"/>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 332 B |
@ -113,7 +113,7 @@ const IconButton = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
IconButton.defaultProps = {
|
IconButton.defaultProps = {
|
||||||
onClick: () => {},
|
onClick: () => { },
|
||||||
color: 'default',
|
color: 'default',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
fullWidth: false,
|
fullWidth: false,
|
||||||
|
|||||||
115
platform/ui/src/components/Snackbar/Snackbar.css
Normal file
115
platform/ui/src/components/Snackbar/Snackbar.css
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/* TODO: Create tailwind styles for this component */
|
||||||
|
.sb-topLeft {
|
||||||
|
@apply top-0 left-0 bottom-auto right-auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-topCenter {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
@apply top-0 bottom-auto left-1/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-topRight {
|
||||||
|
@apply right-0 top-0 left-auto bottom-auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-bottomLeft {
|
||||||
|
@apply right-auto left-0 bottom-0 top-auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-bottomCenter {
|
||||||
|
@apply top-auto bottom-0 left-1/2;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-bottomRight {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
@apply top-auto bottom-0 left-auto right-0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-topLeft .sb-item,
|
||||||
|
.sb-topCenter .sb-item,
|
||||||
|
.sb-topRight .sb-item {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-bottomLeft .sb-item,
|
||||||
|
.sb-bottomCenter .sb-item,
|
||||||
|
.sb-bottomRight .sb-item {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeBtn {
|
||||||
|
text-shadow: none;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
right: 5px;
|
||||||
|
top: 5px;
|
||||||
|
@apply overflow-hidden opacity-100 rounded-full p-1 bg-white cursor-pointer absolute text-center duration-300 transition-all ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeBtn:hover {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeIcon {
|
||||||
|
@apply w-full relative overflow-hidden h-full block leading-none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeIcon:after,
|
||||||
|
.sb-closeIcon:before {
|
||||||
|
content: ' ';
|
||||||
|
height: 2px;
|
||||||
|
width: 12px;
|
||||||
|
@apply duration-300 transition-all ease-in-out block bg-black opacity-100 absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeIcon:before {
|
||||||
|
left: 4px;
|
||||||
|
top: 3px;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
transform-origin: 0px 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-closeIcon:after {
|
||||||
|
right: 3px;
|
||||||
|
top: 5px;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
transform-origin: calc(100% - 3px) 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-title {
|
||||||
|
@apply break-normal text-lg font-bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-message {
|
||||||
|
@apply break-normal text-base;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb-item {
|
||||||
|
animation: fadein 1s;
|
||||||
|
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.2), 0 1px 18px 0 rgba(0, 0, 0, 0.12),
|
||||||
|
0 3px 5px -1px rgba(0, 0, 0, 0.14);
|
||||||
|
@apply relative p-5 text-white overflow-hidden rounded-md transition-height ease-in-out duration-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadein {
|
||||||
|
from {
|
||||||
|
top: 30px;
|
||||||
|
@apply opacity-0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
@apply opacity-100 top-0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Internet Explorer */
|
||||||
|
@-ms-keyframes fadein {
|
||||||
|
from {
|
||||||
|
top: 30px;
|
||||||
|
@apply opacity-0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
@apply opacity-100;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,16 +2,18 @@ import React from 'react';
|
|||||||
import SnackbarItem from './SnackbarItem';
|
import SnackbarItem from './SnackbarItem';
|
||||||
import { useSnackbar } from '../../contextProviders';
|
import { useSnackbar } from '../../contextProviders';
|
||||||
|
|
||||||
|
import './Snackbar.css';
|
||||||
|
|
||||||
const SnackbarContainer = () => {
|
const SnackbarContainer = () => {
|
||||||
const { snackbarItems, hide } = useSnackbar();
|
const { snackbarItems, hide } = useSnackbar();
|
||||||
|
|
||||||
const renderItem = item => {
|
const renderItem = item => (
|
||||||
return <SnackbarItem key={item.itemId} options={item} onClose={hide} />;
|
<SnackbarItem
|
||||||
};
|
key={item.itemId}
|
||||||
|
options={item}
|
||||||
if (!snackbarItems) {
|
onClose={hide}
|
||||||
return null;
|
/>
|
||||||
}
|
);
|
||||||
|
|
||||||
const renderItems = () => {
|
const renderItems = () => {
|
||||||
const items = {
|
const items = {
|
||||||
@ -23,11 +25,9 @@ const SnackbarContainer = () => {
|
|||||||
bottomRight: [],
|
bottomRight: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
snackbarItems.map(item => {
|
snackbarItems.forEach(item => items[item.position].push(item));
|
||||||
items[item.position].push(item);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return snackbarItems && (
|
||||||
<div>
|
<div>
|
||||||
{Object.keys(items).map(pos => {
|
{Object.keys(items).map(pos => {
|
||||||
if (!items[pos].length) {
|
if (!items[pos].length) {
|
||||||
@ -35,7 +35,7 @@ const SnackbarContainer = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={pos} className={`sb-container sb-${pos}`}>
|
<div key={pos} className={`fixed z-50 p-6 box-border h-auto sb-${pos}`}>
|
||||||
{items[pos].map((item, index) => (
|
{items[pos].map((item, index) => (
|
||||||
<div key={item.id + index}>{renderItem(item)}</div>
|
<div key={item.id + index}>{renderItem(item)}</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,25 +1,38 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import SnackbarTypes from './SnackbarTypes';
|
||||||
|
|
||||||
const SnackbarItem = ({ options, onClose }) => {
|
const SnackbarItem = ({ options, onClose }) => {
|
||||||
const handleClose = () => {
|
const handleClose = () => onClose(options.id);
|
||||||
onClose(options.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (options.autoClose) {
|
if (options.autoClose) {
|
||||||
setTimeout(() => {
|
setTimeout(() => handleClose(), options.duration);
|
||||||
handleClose();
|
|
||||||
}, options.duration);
|
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const typeClasses = {
|
||||||
|
[SnackbarTypes.INFO]: 'bg-primary-active',
|
||||||
|
[SnackbarTypes.WARNING]: 'bg-yellow-600',
|
||||||
|
[SnackbarTypes.SUCCESS]: 'bg-green-600',
|
||||||
|
[SnackbarTypes.ERROR]: 'bg-red-600'
|
||||||
|
};
|
||||||
|
|
||||||
|
const hidden = 'duration-300 transition-all ease-in-out h-0 opacity-0 pt-0 mb-0 pb-0';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div
|
||||||
<span onClick={handleClose}>
|
className={classNames(
|
||||||
<span>x</span>
|
`${options.visible ? '' : hidden} sb-item`,
|
||||||
|
typeClasses[options.type]
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="sb-closeBtn" onClick={handleClose}>
|
||||||
|
<span className="sb-closeIcon">x</span>
|
||||||
</span>
|
</span>
|
||||||
{options.title && <div>{options.title}</div>}
|
{options.title && <div className="sb-title">{options.title}</div>}
|
||||||
{options.message && <div>{options.message}</div>}
|
{options.message && <div className="sb-message">{options.message}</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
@ -25,10 +25,10 @@ const StudyBrowser = ({
|
|||||||
onClickTab,
|
onClickTab,
|
||||||
onClickStudy,
|
onClickStudy,
|
||||||
onClickThumbnail,
|
onClickThumbnail,
|
||||||
|
onDoubleClickThumbnail,
|
||||||
onClickUntrack,
|
onClickUntrack,
|
||||||
|
activeDisplaySetInstanceUID,
|
||||||
}) => {
|
}) => {
|
||||||
const [thumbnailActive, setThumbnailActive] = useState(null);
|
|
||||||
|
|
||||||
const getTabContent = () => {
|
const getTabContent = () => {
|
||||||
const tabData = tabs.find(tab => tab.name === activeTabName);
|
const tabData = tabs.find(tab => tab.name === activeTabName);
|
||||||
|
|
||||||
@ -58,18 +58,10 @@ const StudyBrowser = ({
|
|||||||
{isExpanded && displaySets && (
|
{isExpanded && displaySets && (
|
||||||
<ThumbnailList
|
<ThumbnailList
|
||||||
thumbnails={displaySets}
|
thumbnails={displaySets}
|
||||||
thumbnailActive={thumbnailActive}
|
activeDisplaySetInstanceUID={activeDisplaySetInstanceUID}
|
||||||
onThumbnailClick={displaySetInstanceUID => {
|
onThumbnailClick={onClickThumbnail}
|
||||||
setThumbnailActive(
|
onThumbnailDoubleClick={onDoubleClickThumbnail}
|
||||||
displaySetInstanceUID === thumbnailActive
|
onClickUntrack={onClickUntrack}
|
||||||
? null
|
|
||||||
: displaySetInstanceUID
|
|
||||||
);
|
|
||||||
onClickThumbnail(displaySetInstanceUID);
|
|
||||||
}}
|
|
||||||
onClickUntrack={displaySetInstanceUID => {
|
|
||||||
onClickUntrack(displaySetInstanceUID);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
@ -118,9 +110,11 @@ StudyBrowser.propTypes = {
|
|||||||
onClickTab: PropTypes.func.isRequired,
|
onClickTab: PropTypes.func.isRequired,
|
||||||
onClickStudy: PropTypes.func,
|
onClickStudy: PropTypes.func,
|
||||||
onClickThumbnail: PropTypes.func,
|
onClickThumbnail: PropTypes.func,
|
||||||
|
onDoubleClickThumbnail: PropTypes.func,
|
||||||
onClickUntrack: PropTypes.func,
|
onClickUntrack: PropTypes.func,
|
||||||
activeTabName: PropTypes.string.isRequired,
|
activeTabName: PropTypes.string.isRequired,
|
||||||
expandedStudyInstanceUIDs: PropTypes.arrayOf(PropTypes.string).isRequired,
|
expandedStudyInstanceUIDs: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
|
activeDisplaySetInstanceUID: PropTypes.string,
|
||||||
tabs: PropTypes.arrayOf(
|
tabs: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
@ -173,6 +167,7 @@ StudyBrowser.defaultProps = {
|
|||||||
onClickTab: noop,
|
onClickTab: noop,
|
||||||
onClickStudy: noop,
|
onClickStudy: noop,
|
||||||
onClickThumbnail: noop,
|
onClickThumbnail: noop,
|
||||||
|
onDoubleClickThumbnail: noop,
|
||||||
onClickUntrack: noop,
|
onClickUntrack: noop,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { useDrag } from 'react-dnd';
|
import { useDrag } from 'react-dnd';
|
||||||
//
|
|
||||||
import { Icon } from '@ohif/ui';
|
import { Icon } from '@ohif/ui';
|
||||||
|
import blurHandlerListener from '../../utils/blurHandlerListener';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -19,6 +19,7 @@ const Thumbnail = ({
|
|||||||
dragData,
|
dragData,
|
||||||
isActive,
|
isActive,
|
||||||
onClick,
|
onClick,
|
||||||
|
onDoubleClick,
|
||||||
}) => {
|
}) => {
|
||||||
// TODO: We should wrap our thumbnail to create a "DraggableThumbnail", as
|
// TODO: We should wrap our thumbnail to create a "DraggableThumbnail", as
|
||||||
// this will still allow for "drag", even if there is no drop target for the
|
// this will still allow for "drag", even if there is no drop target for the
|
||||||
@ -30,52 +31,58 @@ const Thumbnail = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const thumbnailElement = useRef(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={drag}
|
onFocus={() => blurHandlerListener(thumbnailElement)}
|
||||||
|
ref={thumbnailElement}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
className,
|
className,
|
||||||
'flex flex-col flex-1 px-3 mb-8 cursor-pointer outline-none'
|
'flex flex-col flex-1 px-3 mb-8 cursor-pointer outline-none group'
|
||||||
)}
|
)}
|
||||||
id={`thumbnail-${displaySetInstanceUID}`}
|
id={`thumbnail-${displaySetInstanceUID}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onKeyDown={onClick}
|
onDoubleClick={onDoubleClick}
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
>
|
>
|
||||||
<div
|
<div ref={drag}>
|
||||||
className={classnames(
|
<div
|
||||||
'flex flex-1 items-center justify-center rounded-md bg-black text-base text-white overflow-hidden mb-2 min-h-32',
|
className={classnames(
|
||||||
isActive
|
'flex flex-1 items-center justify-center rounded-md bg-black text-base text-white overflow-hidden mb-2 min-h-32',
|
||||||
? 'border-2 border-primary-light'
|
isActive
|
||||||
: 'border border-secondary-light hover:border-blue-300'
|
? 'border-2 border-primary-light'
|
||||||
)}
|
: 'border border-secondary-light group-focus:border-blue-300 hover:border-blue-300'
|
||||||
>
|
)}
|
||||||
{imageSrc ? (
|
>
|
||||||
<img
|
{imageSrc ? (
|
||||||
src={imageSrc}
|
<img
|
||||||
alt={imageAltText}
|
src={imageSrc}
|
||||||
className="object-none min-h-32"
|
alt={imageAltText}
|
||||||
/>
|
className="object-none min-h-32"
|
||||||
) : (
|
/>
|
||||||
<div>{imageAltText}</div>
|
) : (
|
||||||
)}
|
<div>{imageAltText}</div>
|
||||||
</div>
|
)}
|
||||||
<div className="flex flex-row items-center flex-1 text-base text-blue-300">
|
|
||||||
<div className="mr-4">
|
|
||||||
<span className="font-bold text-primary-main">{'S: '}</span>
|
|
||||||
{seriesNumber}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row items-center flex-1">
|
<div className="flex flex-row items-center flex-1 text-base text-blue-300">
|
||||||
<Icon name="group-layers" className="w-3 mr-2" /> {numInstances}
|
<div className="mr-4">
|
||||||
|
<span className="font-bold text-primary-main">{'S: '}</span>
|
||||||
|
{seriesNumber}
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row items-center flex-1">
|
||||||
|
<Icon name="group-layers" className="w-3 mr-2" /> {numInstances}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="text-base text-white break-all">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-base text-white break-all">{description}</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Thumbnail.propTypes = {
|
Thumbnail.propTypes = {
|
||||||
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
imageSrc: PropTypes.string,
|
imageSrc: PropTypes.string,
|
||||||
/**
|
/**
|
||||||
@ -95,6 +102,7 @@ Thumbnail.propTypes = {
|
|||||||
numInstances: PropTypes.number.isRequired,
|
numInstances: PropTypes.number.isRequired,
|
||||||
isActive: PropTypes.bool.isRequired,
|
isActive: PropTypes.bool.isRequired,
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
|
onDoubleClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
Thumbnail.defaultProps = {
|
Thumbnail.defaultProps = {
|
||||||
|
|||||||
@ -5,8 +5,9 @@ import { Thumbnail, ThumbnailNoImage, ThumbnailTracked } from '@ohif/ui';
|
|||||||
|
|
||||||
const ThumbnailList = ({
|
const ThumbnailList = ({
|
||||||
thumbnails,
|
thumbnails,
|
||||||
thumbnailActive,
|
activeDisplaySetInstanceUID,
|
||||||
onThumbnailClick,
|
onThumbnailClick,
|
||||||
|
onThumbnailDoubleClick,
|
||||||
onClickUntrack,
|
onClickUntrack,
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
@ -26,7 +27,8 @@ const ThumbnailList = ({
|
|||||||
imageSrc,
|
imageSrc,
|
||||||
imageAltText,
|
imageAltText,
|
||||||
}) => {
|
}) => {
|
||||||
const isActive = thumbnailActive === displaySetInstanceUID;
|
const isActive =
|
||||||
|
activeDisplaySetInstanceUID === displaySetInstanceUID;
|
||||||
|
|
||||||
switch (componentType) {
|
switch (componentType) {
|
||||||
case 'thumbnail':
|
case 'thumbnail':
|
||||||
@ -43,6 +45,9 @@ const ThumbnailList = ({
|
|||||||
viewportIdentificator={viewportIdentificator}
|
viewportIdentificator={viewportIdentificator}
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
||||||
|
onDoubleClick={() =>
|
||||||
|
onThumbnailDoubleClick(displaySetInstanceUID)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'thumbnailTracked':
|
case 'thumbnailTracked':
|
||||||
@ -60,12 +65,16 @@ const ThumbnailList = ({
|
|||||||
isTracked={isTracked}
|
isTracked={isTracked}
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
||||||
|
onDoubleClick={() =>
|
||||||
|
onThumbnailDoubleClick(displaySetInstanceUID)
|
||||||
|
}
|
||||||
onClickUntrack={() => onClickUntrack(displaySetInstanceUID)}
|
onClickUntrack={() => onClickUntrack(displaySetInstanceUID)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'thumbnailNoImage':
|
case 'thumbnailNoImage':
|
||||||
return (
|
return (
|
||||||
<ThumbnailNoImage
|
<ThumbnailNoImage
|
||||||
|
isActive={isActive}
|
||||||
key={displaySetInstanceUID}
|
key={displaySetInstanceUID}
|
||||||
displaySetInstanceUID={displaySetInstanceUID}
|
displaySetInstanceUID={displaySetInstanceUID}
|
||||||
dragData={dragData}
|
dragData={dragData}
|
||||||
@ -73,6 +82,9 @@ const ThumbnailList = ({
|
|||||||
seriesDate={seriesDate}
|
seriesDate={seriesDate}
|
||||||
description={description}
|
description={description}
|
||||||
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
onClick={() => onThumbnailClick(displaySetInstanceUID)}
|
||||||
|
onDoubleClick={() =>
|
||||||
|
onThumbnailDoubleClick(displaySetInstanceUID)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
@ -114,8 +126,9 @@ ThumbnailList.propTypes = {
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
thumbnailActive: PropTypes.string,
|
activeDisplaySetInstanceUID: PropTypes.string,
|
||||||
onThumbnailClick: PropTypes.func,
|
onThumbnailClick: PropTypes.func.isRequired,
|
||||||
|
onThumbnailDoubleClick: PropTypes.func.isRequired,
|
||||||
onClickUntrack: PropTypes.func.isRequired,
|
onClickUntrack: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import { useDrag } from 'react-dnd';
|
import { useDrag } from 'react-dnd';
|
||||||
|
|
||||||
import { Icon } from '@ohif/ui';
|
import { Icon } from '@ohif/ui';
|
||||||
|
import blurHandlerListener from '../../utils/blurHandlerListener';
|
||||||
|
|
||||||
const ThumbnailNoImage = ({
|
const ThumbnailNoImage = ({
|
||||||
displaySetInstanceUID,
|
displaySetInstanceUID,
|
||||||
@ -11,7 +11,9 @@ const ThumbnailNoImage = ({
|
|||||||
seriesDate,
|
seriesDate,
|
||||||
modality,
|
modality,
|
||||||
onClick,
|
onClick,
|
||||||
|
onDoubleClick,
|
||||||
dragData,
|
dragData,
|
||||||
|
isActive,
|
||||||
}) => {
|
}) => {
|
||||||
const [collectedProps, drag, dragPreview] = useDrag({
|
const [collectedProps, drag, dragPreview] = useDrag({
|
||||||
item: { ...dragData },
|
item: { ...dragData },
|
||||||
@ -20,26 +22,34 @@ const ThumbnailNoImage = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const thumbnailElement = useRef(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={drag}
|
ref={thumbnailElement}
|
||||||
className={'flex flex-row flex-1 px-4 py-3 cursor-pointer'}
|
onFocus={() => blurHandlerListener(thumbnailElement)}
|
||||||
|
className={classnames(
|
||||||
|
'flex flex-row flex-1 px-4 py-3 cursor-pointer outline-none border-transparent hover:border-blue-300 focus:border-blue-300 rounded',
|
||||||
|
isActive ? 'border-2 border-primary-light' : 'border'
|
||||||
|
)}
|
||||||
id={`thumbnail-${displaySetInstanceUID}`}
|
id={`thumbnail-${displaySetInstanceUID}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onKeyDown={onClick}
|
onDoubleClick={onDoubleClick}
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
>
|
>
|
||||||
<div className="flex flex-col flex-1">
|
<div ref={drag}>
|
||||||
<div className="flex flex-row items-center flex-1 mb-2">
|
<div className="flex flex-col flex-1">
|
||||||
<Icon name="list-bullets" className="w-12 text-secondary-light" />
|
<div className="flex flex-row items-center flex-1 mb-2">
|
||||||
<div className="px-3 mr-4 text-lg text-white rounded-sm bg-primary-main">
|
<Icon name="list-bullets" className="w-12 text-secondary-light" />
|
||||||
{modality}
|
<div className="px-3 mr-4 text-lg text-white rounded-sm bg-primary-main">
|
||||||
|
{modality}
|
||||||
|
</div>
|
||||||
|
<span className="text-base text-blue-300">{seriesDate}</span>
|
||||||
|
</div>
|
||||||
|
<div className="ml-12 text-base text-white break-all">
|
||||||
|
{description}
|
||||||
</div>
|
</div>
|
||||||
<span className="text-base text-blue-300">{seriesDate}</span>
|
|
||||||
</div>
|
|
||||||
<div className="ml-12 text-base text-white break-all">
|
|
||||||
{description}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -47,10 +57,24 @@ const ThumbnailNoImage = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
ThumbnailNoImage.propTypes = {
|
ThumbnailNoImage.propTypes = {
|
||||||
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
||||||
|
/**
|
||||||
|
* Data the thumbnail should expose to a receiving drop target. Use a matching
|
||||||
|
* `dragData.type` to identify which targets can receive this draggable item.
|
||||||
|
* If this is not set, drag-n-drop will be disabled for this thumbnail.
|
||||||
|
*
|
||||||
|
* Ref: https://react-dnd.github.io/react-dnd/docs/api/use-drag#specification-object-members
|
||||||
|
*/
|
||||||
|
dragData: PropTypes.shape({
|
||||||
|
/** Must match the "type" a dropTarget expects */
|
||||||
|
type: PropTypes.string.isRequired,
|
||||||
|
}),
|
||||||
description: PropTypes.string.isRequired,
|
description: PropTypes.string.isRequired,
|
||||||
modality: PropTypes.string.isRequired,
|
modality: PropTypes.string.isRequired,
|
||||||
seriesDate: PropTypes.string.isRequired,
|
seriesDate: PropTypes.string.isRequired,
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
|
onDoubleClick: PropTypes.func.isRequired,
|
||||||
|
isActive: PropTypes.bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ThumbnailNoImage;
|
export default ThumbnailNoImage;
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const ThumbnailTracked = ({
|
|||||||
numInstances,
|
numInstances,
|
||||||
dragData,
|
dragData,
|
||||||
onClick,
|
onClick,
|
||||||
|
onDoubleClick,
|
||||||
onClickUntrack,
|
onClickUntrack,
|
||||||
viewportIdentificator,
|
viewportIdentificator,
|
||||||
isTracked,
|
isTracked,
|
||||||
@ -72,6 +73,7 @@ const ThumbnailTracked = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Thumbnail
|
<Thumbnail
|
||||||
|
displaySetInstanceUID={displaySetInstanceUID}
|
||||||
imageSrc={imageSrc}
|
imageSrc={imageSrc}
|
||||||
imageAltText={imageAltText}
|
imageAltText={imageAltText}
|
||||||
dragData={dragData}
|
dragData={dragData}
|
||||||
@ -80,6 +82,7 @@ const ThumbnailTracked = ({
|
|||||||
numInstances={numInstances}
|
numInstances={numInstances}
|
||||||
isActive={isActive}
|
isActive={isActive}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
onDoubleClick={onDoubleClick}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -97,6 +100,7 @@ ThumbnailTracked.propTypes = {
|
|||||||
/** Must match the "type" a dropTarget expects */
|
/** Must match the "type" a dropTarget expects */
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
}),
|
}),
|
||||||
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
imageSrc: PropTypes.string,
|
imageSrc: PropTypes.string,
|
||||||
imageAltText: PropTypes.string,
|
imageAltText: PropTypes.string,
|
||||||
@ -104,6 +108,7 @@ ThumbnailTracked.propTypes = {
|
|||||||
seriesNumber: PropTypes.number.isRequired,
|
seriesNumber: PropTypes.number.isRequired,
|
||||||
numInstances: PropTypes.number.isRequired,
|
numInstances: PropTypes.number.isRequired,
|
||||||
onClick: PropTypes.func.isRequired,
|
onClick: PropTypes.func.isRequired,
|
||||||
|
onDoubleClick: PropTypes.func.isRequired,
|
||||||
onClickUntrack: PropTypes.func.isRequired,
|
onClickUntrack: PropTypes.func.isRequired,
|
||||||
viewportIdentificator: PropTypes.string,
|
viewportIdentificator: PropTypes.string,
|
||||||
isTracked: PropTypes.bool,
|
isTracked: PropTypes.bool,
|
||||||
|
|||||||
@ -24,6 +24,7 @@ const ViewportActionBar = ({
|
|||||||
// It shouldn't care that a tracking mode or SR exists.
|
// It shouldn't care that a tracking mode or SR exists.
|
||||||
// Things like the right/left buttons should be made into smaller
|
// Things like the right/left buttons should be made into smaller
|
||||||
// Components you can compose.
|
// Components you can compose.
|
||||||
|
// OHIF-200 ticket.
|
||||||
|
|
||||||
const {
|
const {
|
||||||
label,
|
label,
|
||||||
|
|||||||
8
platform/ui/src/contextProviders/DialogProvider.css
Normal file
8
platform/ui/src/contextProviders/DialogProvider.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* TODO: Find a better way to set the cursor for all contents of dialog. */
|
||||||
|
.DraggableItem.draggable div {
|
||||||
|
cursor: grab !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DraggableItem.draggable.dragging div {
|
||||||
|
cursor: grabbing !important;
|
||||||
|
}
|
||||||
@ -5,11 +5,14 @@ import React, {
|
|||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Draggable from 'react-draggable';
|
import Draggable from 'react-draggable';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { utils } from '@ohif/core';
|
import { utils } from '@ohif/core';
|
||||||
|
|
||||||
|
import './DialogProvider.css';
|
||||||
|
|
||||||
const DialogContext = createContext(null);
|
const DialogContext = createContext(null);
|
||||||
|
|
||||||
@ -150,6 +153,7 @@ const DialogProvider = ({ children, service }) => {
|
|||||||
onStart,
|
onStart,
|
||||||
onStop,
|
onStop,
|
||||||
onDrag,
|
onDrag,
|
||||||
|
showOverlay,
|
||||||
} = dialog;
|
} = dialog;
|
||||||
|
|
||||||
let position =
|
let position =
|
||||||
@ -158,13 +162,13 @@ const DialogProvider = ({ children, service }) => {
|
|||||||
position = centerPositions.find(position => position.id === id);
|
position = centerPositions.find(position => position.id === id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
const dragableItem = () => (
|
||||||
<Draggable
|
<Draggable
|
||||||
key={id}
|
key={id}
|
||||||
disabled={!isDraggable}
|
disabled={!isDraggable}
|
||||||
position={position}
|
position={position}
|
||||||
defaultPosition={position}
|
defaultPosition={position}
|
||||||
bounds="parent"
|
bounds='parent'
|
||||||
onStart={event => {
|
onStart={event => {
|
||||||
const e = event || window.event;
|
const e = event || window.event;
|
||||||
const target = e.target || e.srcElement;
|
const target = e.target || e.srcElement;
|
||||||
@ -215,6 +219,21 @@ const DialogProvider = ({ children, service }) => {
|
|||||||
</div>
|
</div>
|
||||||
</Draggable>
|
</Draggable>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const withOverlay = component => {
|
||||||
|
const background = 'bg-black bg-opacity-50';
|
||||||
|
const overlay = 'fixed z-50 left-0 top-0 w-full h-full overflow-auto';
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(overlay, background)}
|
||||||
|
key={id}
|
||||||
|
>
|
||||||
|
{component}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return showOverlay ? withOverlay(dragableItem()) : dragableItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -236,13 +255,11 @@ const DialogProvider = ({ children, service }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}>
|
<DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}>
|
||||||
<div className="DraggableArea">
|
{!isEmpty() &&
|
||||||
{dialogs.some(dialog => dialog.showOverlay) ? (
|
<div className='w-full h-full absolute'>
|
||||||
<div className="Overlay active">{renderDialogs()}</div>
|
{renderDialogs()}
|
||||||
) : (
|
</div>
|
||||||
renderDialogs()
|
}
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{children}
|
{children}
|
||||||
</DialogContext.Provider>
|
</DialogContext.Provider>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,11 @@ import PropTypes from 'prop-types';
|
|||||||
const DEFAULT_STATE = {
|
const DEFAULT_STATE = {
|
||||||
numRows: 1,
|
numRows: 1,
|
||||||
numCols: 1,
|
numCols: 1,
|
||||||
viewports: [],
|
viewports: [
|
||||||
|
// {
|
||||||
|
// displaySetInstanceUID: string,
|
||||||
|
// }
|
||||||
|
],
|
||||||
activeViewportIndex: 0,
|
activeViewportIndex: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -19,8 +23,9 @@ export const ViewportGridContext = createContext(DEFAULT_STATE);
|
|||||||
export function ViewportGridProvider({ children, service }) {
|
export function ViewportGridProvider({ children, service }) {
|
||||||
const viewportGridReducer = (state, action) => {
|
const viewportGridReducer = (state, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'SET_ACTIVE_VIEWPORT_INDEX':
|
case 'SET_ACTIVE_VIEWPORT_INDEX': {
|
||||||
return { ...state, ...{ activeViewportIndex: action.payload } };
|
return { ...state, ...{ activeViewportIndex: action.payload } };
|
||||||
|
}
|
||||||
case 'SET_DISPLAYSET_FOR_VIEWPORT': {
|
case 'SET_DISPLAYSET_FOR_VIEWPORT': {
|
||||||
const { viewportIndex, displaySetInstanceUID } = action.payload;
|
const { viewportIndex, displaySetInstanceUID } = action.payload;
|
||||||
const viewports = state.viewports.slice();
|
const viewports = state.viewports.slice();
|
||||||
@ -55,7 +60,7 @@ export function ViewportGridProvider({ children, service }) {
|
|||||||
|
|
||||||
const [viewportGridState, dispatch] = useReducer(
|
const [viewportGridState, dispatch] = useReducer(
|
||||||
viewportGridReducer,
|
viewportGridReducer,
|
||||||
DEFAULT_STATE,
|
DEFAULT_STATE
|
||||||
);
|
);
|
||||||
|
|
||||||
const getState = useCallback(() => viewportGridState, [viewportGridState]);
|
const getState = useCallback(() => viewportGridState, [viewportGridState]);
|
||||||
|
|||||||
10
platform/ui/src/utils/blurHandlerListener.js
Normal file
10
platform/ui/src/utils/blurHandlerListener.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export default element => {
|
||||||
|
const handleClickOutside = event => {
|
||||||
|
if (element.current && !element.current.contains(event.target)) {
|
||||||
|
element.current.blur();
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
};
|
||||||
@ -329,6 +329,7 @@ module.exports = {
|
|||||||
auto: 'auto',
|
auto: 'auto',
|
||||||
full: '100%',
|
full: '100%',
|
||||||
viewport: '0.5rem',
|
viewport: '0.5rem',
|
||||||
|
'1/2': '50%',
|
||||||
'viewport-scrollbar': '1.3rem'
|
'viewport-scrollbar': '1.3rem'
|
||||||
},
|
},
|
||||||
letterSpacing: {
|
letterSpacing: {
|
||||||
@ -683,6 +684,7 @@ module.exports = {
|
|||||||
transitionProperty: {
|
transitionProperty: {
|
||||||
none: 'none',
|
none: 'none',
|
||||||
all: 'all',
|
all: 'all',
|
||||||
|
'height': 'height',
|
||||||
default:
|
default:
|
||||||
'background-color, border-color, color, fill, stroke, opacity, box-shadow, transform',
|
'background-color, border-color, color, fill, stroke, opacity, box-shadow, transform',
|
||||||
colors: 'background-color, border-color, color, fill, stroke',
|
colors: 'background-color, border-color, color, fill, stroke',
|
||||||
@ -719,7 +721,7 @@ module.exports = {
|
|||||||
backgroundRepeat: ['responsive'],
|
backgroundRepeat: ['responsive'],
|
||||||
backgroundSize: ['responsive'],
|
backgroundSize: ['responsive'],
|
||||||
borderCollapse: ['responsive'],
|
borderCollapse: ['responsive'],
|
||||||
borderColor: ['responsive', 'hover', 'focus', 'active'],
|
borderColor: ['responsive', 'hover', 'focus', 'active', 'group-focus'],
|
||||||
borderRadius: ['responsive', 'focus', 'first', 'last'],
|
borderRadius: ['responsive', 'focus', 'first', 'last'],
|
||||||
borderStyle: ['responsive', 'focus'],
|
borderStyle: ['responsive', 'focus'],
|
||||||
borderWidth: ['responsive', 'focus', 'first', 'last'],
|
borderWidth: ['responsive', 'focus', 'first', 'last'],
|
||||||
|
|||||||
@ -55,9 +55,9 @@
|
|||||||
"@ohif/extension-dicom-html": "^1.1.0",
|
"@ohif/extension-dicom-html": "^1.1.0",
|
||||||
"@ohif/extension-dicom-microscopy": "^0.50.6",
|
"@ohif/extension-dicom-microscopy": "^0.50.6",
|
||||||
"@ohif/extension-dicom-pdf": "^1.0.1",
|
"@ohif/extension-dicom-pdf": "^1.0.1",
|
||||||
|
"@ohif/extension-dicom-sr": "^0.0.1",
|
||||||
"@ohif/extension-lesion-tracker": "^0.2.0",
|
"@ohif/extension-lesion-tracker": "^0.2.0",
|
||||||
"@ohif/extension-measurement-tracking": "^0.0.1",
|
"@ohif/extension-measurement-tracking": "^0.0.1",
|
||||||
"@ohif/extension-dicom-sr": "^0.0.1",
|
|
||||||
"@ohif/extension-vtk": "^1.5.6",
|
"@ohif/extension-vtk": "^1.5.6",
|
||||||
"@ohif/i18n": "^0.52.8",
|
"@ohif/i18n": "^0.52.8",
|
||||||
"@ohif/mode-longitudinal": "^0.0.1",
|
"@ohif/mode-longitudinal": "^0.0.1",
|
||||||
@ -67,7 +67,7 @@
|
|||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"core-js": "^3.2.1",
|
"core-js": "^3.2.1",
|
||||||
"cornerstone-math": "^0.1.8",
|
"cornerstone-math": "^0.1.8",
|
||||||
"cornerstone-tools": "4.16.0",
|
"cornerstone-tools": "4.16.1",
|
||||||
"cornerstone-wado-image-loader": "^3.1.2",
|
"cornerstone-wado-image-loader": "^3.1.2",
|
||||||
"dcmjs": "0.14.0",
|
"dcmjs": "0.14.0",
|
||||||
"dicom-parser": "^1.8.3",
|
"dicom-parser": "^1.8.3",
|
||||||
|
|||||||
@ -20,8 +20,8 @@ import createRoutes from './routes';
|
|||||||
import appInit from './appInit.js';
|
import appInit from './appInit.js';
|
||||||
|
|
||||||
// TODO: Temporarily for testing
|
// TODO: Temporarily for testing
|
||||||
import '@ohif/mode-example';
|
|
||||||
import '@ohif/mode-longitudinal';
|
import '@ohif/mode-longitudinal';
|
||||||
|
import '@ohif/mode-segmentation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ENV Variable to determine routing behavior
|
* ENV Variable to determine routing behavior
|
||||||
@ -50,7 +50,7 @@ function App({ config, defaultExtensions }) {
|
|||||||
dataSources,
|
dataSources,
|
||||||
extensionManager,
|
extensionManager,
|
||||||
servicesManager,
|
servicesManager,
|
||||||
hotkeysManager
|
hotkeysManager,
|
||||||
});
|
});
|
||||||
const {
|
const {
|
||||||
UIDialogService,
|
UIDialogService,
|
||||||
|
|||||||
@ -71,8 +71,8 @@ function appInit(appConfigOrFunc, defaultExtensions) {
|
|||||||
|
|
||||||
// TODO: Remove this
|
// TODO: Remove this
|
||||||
if (!appConfig.modes.length) {
|
if (!appConfig.modes.length) {
|
||||||
appConfig.modes.push(window.exampleMode);
|
|
||||||
appConfig.modes.push(window.longitudinalMode);
|
appConfig.modes.push(window.longitudinalMode);
|
||||||
|
appConfig.modes.push(window.segmentationMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -80,7 +80,7 @@ function appInit(appConfigOrFunc, defaultExtensions) {
|
|||||||
commandsManager,
|
commandsManager,
|
||||||
extensionManager,
|
extensionManager,
|
||||||
servicesManager,
|
servicesManager,
|
||||||
hotkeysManager
|
hotkeysManager,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6755,10 +6755,10 @@ cornerstone-math@^0.1.8:
|
|||||||
resolved "https://registry.yarnpkg.com/cornerstone-math/-/cornerstone-math-0.1.8.tgz#68ab1f9e4fdcd7c5cb23a0d2eb4263f9f894f1c5"
|
resolved "https://registry.yarnpkg.com/cornerstone-math/-/cornerstone-math-0.1.8.tgz#68ab1f9e4fdcd7c5cb23a0d2eb4263f9f894f1c5"
|
||||||
integrity sha512-x7NEQHBtVG7j1yeyj/aRoKTpXv1Vh2/H9zNLMyqYJDtJkNng8C4Q8M3CgZ1qer0Yr7eVq2x+Ynmj6kfOm5jXKw==
|
integrity sha512-x7NEQHBtVG7j1yeyj/aRoKTpXv1Vh2/H9zNLMyqYJDtJkNng8C4Q8M3CgZ1qer0Yr7eVq2x+Ynmj6kfOm5jXKw==
|
||||||
|
|
||||||
cornerstone-tools@4.16.0:
|
cornerstone-tools@4.16.1:
|
||||||
version "4.16.0"
|
version "4.16.1"
|
||||||
resolved "https://registry.yarnpkg.com/cornerstone-tools/-/cornerstone-tools-4.16.0.tgz#af3d32d13722b97bec258492642e622312280196"
|
resolved "https://registry.yarnpkg.com/cornerstone-tools/-/cornerstone-tools-4.16.1.tgz#e38f471c8fd30c6d25aab9a7995914542f3a87c5"
|
||||||
integrity sha512-kUhuSb2Ixpd2hgbdem+740rnN4hmoxzcOBNaUcsizFRWjMAsgc0yUxBFwLl0mIs811mefq79JOL+juwRA8T3Tg==
|
integrity sha512-c5gww9Px97R/avFXlS93uyr93syFbhHAHemEykO2Ot/hVQN8EDQTOmsjR/mRRSnVdLlNug4w16obLtWWAl23KQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "7.1.2"
|
"@babel/runtime" "7.1.2"
|
||||||
cornerstone-math "0.1.7"
|
cornerstone-math "0.1.7"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user