Fixes after rebasing
This commit is contained in:
1 parent
70b7158c9b
commit
f3f50d11fe
105 files changed
+920
-3853
No files matched your search
+2
-6
@@ -12,12 +12,8 @@ const BrushColorSelector = ({ defaultColor, index, onNext, onPrev }) => (
|
||||
{index}
|
||||
</div>
|
||||
<div className="selector-buttons">
|
||||
<button onClick={onPrev}>
|
||||
Previous
|
||||
</button>
|
||||
<button onClick={onNext}>
|
||||
Next
|
||||
</button>
|
||||
<button onClick={onPrev}>Previous</button>
|
||||
<button onClick={onNext}>Next</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ BrushRadius.propTypes = {
|
||||
};
|
||||
|
||||
BrushRadius.defaultProps = {
|
||||
onChange: () => { },
|
||||
onChange: () => {},
|
||||
min: 1,
|
||||
max: 50,
|
||||
step: 1,
|
||||
|
||||
@@ -17,7 +17,15 @@ ColoredCircle.propTypes = {
|
||||
color: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
const SegmentItem = ({ index, label, onClick, itemClass, color, visible = true, onVisibilityChange }) => {
|
||||
const SegmentItem = ({
|
||||
index,
|
||||
label,
|
||||
onClick,
|
||||
itemClass,
|
||||
color,
|
||||
visible = true,
|
||||
onVisibilityChange,
|
||||
}) => {
|
||||
const [isVisible, setIsVisible] = useState(visible);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -61,7 +69,7 @@ const SegmentItem = ({ index, label, onClick, itemClass, color, visible = true,
|
||||
<span style={{ marginRight: '4px' }}>
|
||||
<Icon name="edit" width="14px" height="14px" />
|
||||
</span>
|
||||
Relabel
|
||||
Relabel
|
||||
</button>
|
||||
<button
|
||||
className="btnAction"
|
||||
@@ -70,7 +78,7 @@ const SegmentItem = ({ index, label, onClick, itemClass, color, visible = true,
|
||||
<span style={{ marginRight: '4px' }}>
|
||||
<Icon name="edit" width="14px" height="14px" />
|
||||
</span>
|
||||
Description
|
||||
Description
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -90,7 +98,7 @@ SegmentItem.propTypes = {
|
||||
|
||||
SegmentItem.defaultProps = {
|
||||
itemClass: '',
|
||||
onClick: () => { }
|
||||
onClick: () => {},
|
||||
};
|
||||
|
||||
export default SegmentItem;
|
||||
@@ -21,7 +21,7 @@ SegmentationItem.propTypes = {
|
||||
};
|
||||
|
||||
SegmentationItem.defaultProps = {
|
||||
description: ''
|
||||
description: '',
|
||||
};
|
||||
|
||||
export default SegmentationItem;
|
||||
+35
-20
@@ -68,8 +68,7 @@ const SegmentationPanel = ({
|
||||
*/
|
||||
const [state, setState] = useState({
|
||||
brushRadius: DEFAULT_BRUSH_RADIUS,
|
||||
brushColor:
|
||||
'rgba(221, 85, 85, 1)',
|
||||
brushColor: 'rgba(221, 85, 85, 1)',
|
||||
selectedSegment: null,
|
||||
selectedSegmentation: null,
|
||||
showSegmentationSettings: false,
|
||||
@@ -77,7 +76,7 @@ const SegmentationPanel = ({
|
||||
labelmapList: [],
|
||||
segmentList: [],
|
||||
cachedSegmentsProperties: [],
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -111,7 +110,10 @@ const SegmentationPanel = ({
|
||||
* allows us to easily watch the module or the segmentations loading process in any other component
|
||||
* without subscribing to external events.
|
||||
*/
|
||||
document.addEventListener('extensiondicomsegmentationsegloaded', refreshSegmentations);
|
||||
document.addEventListener(
|
||||
'extensiondicomsegmentationsegloaded',
|
||||
refreshSegmentations
|
||||
);
|
||||
|
||||
/*
|
||||
* These are specific to each element;
|
||||
@@ -126,7 +128,10 @@ const SegmentationPanel = ({
|
||||
);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('extensiondicomsegmentationsegloaded', refreshSegmentations);
|
||||
document.removeEventListener(
|
||||
'extensiondicomsegmentationsegloaded',
|
||||
refreshSegmentations
|
||||
);
|
||||
cornerstoneTools.store.state.enabledElements.forEach(enabledElement =>
|
||||
enabledElement.removeEventListener(
|
||||
'cornerstonetoolslabelmapmodified',
|
||||
@@ -173,15 +178,17 @@ const SegmentationPanel = ({
|
||||
segmentList: [],
|
||||
}));
|
||||
}
|
||||
}, [
|
||||
viewports,
|
||||
activeIndex,
|
||||
state.isLoading
|
||||
]);
|
||||
}, [viewports, activeIndex, state.isLoading]);
|
||||
|
||||
useEffect(() => {
|
||||
refreshSegmentations();
|
||||
}, [viewports, activeIndex, state.selectedSegmentation, activeContexts, state.isLoading]);
|
||||
}, [
|
||||
viewports,
|
||||
activeIndex,
|
||||
state.selectedSegmentation,
|
||||
activeContexts,
|
||||
state.isLoading,
|
||||
]);
|
||||
|
||||
/* Handle open/closed panel behaviour */
|
||||
useEffect(() => {
|
||||
@@ -369,9 +376,13 @@ const SegmentationPanel = ({
|
||||
return !segmentsHidden[segmentIndex];
|
||||
};
|
||||
|
||||
const cachedSegmentProperties = state.cachedSegmentsProperties[segmentNumber];
|
||||
const cachedSegmentProperties =
|
||||
state.cachedSegmentsProperties[segmentNumber];
|
||||
let visible = isSegmentVisible();
|
||||
if (cachedSegmentProperties && cachedSegmentProperties.visible !== visible) {
|
||||
if (
|
||||
cachedSegmentProperties &&
|
||||
cachedSegmentProperties.visible !== visible
|
||||
) {
|
||||
toggleSegmentVisibility();
|
||||
}
|
||||
|
||||
@@ -399,7 +410,9 @@ const SegmentationPanel = ({
|
||||
onSegmentVisibilityChange(segmentNumber, newVisibility);
|
||||
}
|
||||
|
||||
updateCachedSegmentsProperties(segmentNumber, { visible: newVisibility });
|
||||
updateCachedSegmentsProperties(segmentNumber, {
|
||||
visible: newVisibility,
|
||||
});
|
||||
refreshViewport();
|
||||
}}
|
||||
/>
|
||||
@@ -422,10 +435,9 @@ const SegmentationPanel = ({
|
||||
const segmentsProperties = state.cachedSegmentsProperties;
|
||||
const segmentProperties = state.cachedSegmentsProperties[segmentNumber];
|
||||
|
||||
segmentsProperties[segmentNumber] =
|
||||
segmentProperties ?
|
||||
{ ...segmentProperties, ...properties } :
|
||||
properties;
|
||||
segmentsProperties[segmentNumber] = segmentProperties
|
||||
? { ...segmentProperties, ...properties }
|
||||
: properties;
|
||||
|
||||
updateState('cachedSegmentsProperties', segmentsProperties);
|
||||
};
|
||||
@@ -495,7 +507,10 @@ const SegmentationPanel = ({
|
||||
refreshViewport();
|
||||
};
|
||||
|
||||
const disabledConfigurationFields = ['outlineAlpha', 'shouldRenderInactiveLabelmaps'];
|
||||
const disabledConfigurationFields = [
|
||||
'outlineAlpha',
|
||||
'shouldRenderInactiveLabelmaps',
|
||||
];
|
||||
if (state.showSegmentationSettings) {
|
||||
return (
|
||||
<SegmentationSettings
|
||||
@@ -622,7 +637,7 @@ const _setActiveLabelmap = async (
|
||||
displaySet,
|
||||
firstImageId,
|
||||
activeLabelmapIndex,
|
||||
callback = () => { },
|
||||
callback = () => {},
|
||||
onDisplaySetLoadFailure
|
||||
) => {
|
||||
if (displaySet.labelmapIndex === activeLabelmapIndex) {
|
||||
|
||||
@@ -19,7 +19,7 @@ const uiGrayDark = computedstyle.getPropertyValue('--ui-gray-dark');
|
||||
const segmentationSelectStyles = {
|
||||
singleValue: (base, state) => ({
|
||||
...base,
|
||||
width: '100%'
|
||||
width: '100%',
|
||||
}),
|
||||
control: (base, state) => ({
|
||||
...base,
|
||||
|
||||
+67
-44
@@ -4,7 +4,12 @@ import { Range } from '@ohif/ui';
|
||||
|
||||
import './SegmentationSettings.css';
|
||||
|
||||
const SegmentationSettings = ({ configuration, onBack, onChange, disabledFields = [] }) => {
|
||||
const SegmentationSettings = ({
|
||||
configuration,
|
||||
onBack,
|
||||
onChange,
|
||||
disabledFields = [],
|
||||
}) => {
|
||||
const [state, setState] = useState({
|
||||
renderFill: configuration.renderFill,
|
||||
renderOutline: configuration.renderOutline,
|
||||
@@ -13,7 +18,7 @@ const SegmentationSettings = ({ configuration, onBack, onChange, disabledFields
|
||||
outlineAlpha: configuration.outlineAlpha,
|
||||
outlineWidth: configuration.outlineWidth,
|
||||
fillAlphaInactive: configuration.fillAlphaInactive,
|
||||
outlineAlphaInactive: configuration.outlineAlphaInactive
|
||||
outlineAlphaInactive: configuration.outlineAlphaInactive,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -78,7 +83,9 @@ const SegmentationSettings = ({ configuration, onBack, onChange, disabledFields
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
onChange={event => save('outlineAlpha', toFloat(event.target.value))}
|
||||
onChange={event =>
|
||||
save('outlineAlpha', toFloat(event.target.value))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!disabledFields.includes('outlineWidth') && (
|
||||
@@ -89,50 +96,64 @@ const SegmentationSettings = ({ configuration, onBack, onChange, disabledFields
|
||||
step={1}
|
||||
min={0}
|
||||
max={5}
|
||||
onChange={event => save('outlineWidth', parseInt(event.target.value))}
|
||||
onChange={event =>
|
||||
save('outlineWidth', parseInt(event.target.value))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{(state.renderFill || state.renderOutline) && !disabledFields.includes('shouldRenderInactiveLabelmaps') && (
|
||||
<div
|
||||
className="settings-group"
|
||||
style={{ marginBottom: state.shouldRenderInactiveLabelmaps ? 15 : 0 }}
|
||||
>
|
||||
<CustomCheck
|
||||
label="Render inactive segmentations"
|
||||
checked={state.shouldRenderInactiveLabelmaps}
|
||||
onChange={() => check('shouldRenderInactiveLabelmaps')}
|
||||
/>
|
||||
{state.shouldRenderInactiveLabelmaps && (
|
||||
<>
|
||||
{state.renderFill && !disabledFields.includes('fillAlphaInactive') && (
|
||||
<CustomRange
|
||||
label="Fill Opacity"
|
||||
showPercentage
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
value={state.fillAlphaInactive * 100}
|
||||
onChange={event => save('fillAlphaInactive', toFloat(event.target.value))}
|
||||
/>
|
||||
)}
|
||||
{state.renderOutline && !disabledFields.includes('outlineAlphaInactive') && (
|
||||
<CustomRange
|
||||
label="Outline Opacity"
|
||||
showPercentage
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
value={state.outlineAlphaInactive * 100}
|
||||
onChange={event => save('outlineAlphaInactive', toFloat(event.target.value))}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{(state.renderFill || state.renderOutline) &&
|
||||
!disabledFields.includes('shouldRenderInactiveLabelmaps') && (
|
||||
<div
|
||||
className="settings-group"
|
||||
style={{
|
||||
marginBottom: state.shouldRenderInactiveLabelmaps ? 15 : 0,
|
||||
}}
|
||||
>
|
||||
<CustomCheck
|
||||
label="Render inactive segmentations"
|
||||
checked={state.shouldRenderInactiveLabelmaps}
|
||||
onChange={() => check('shouldRenderInactiveLabelmaps')}
|
||||
/>
|
||||
{state.shouldRenderInactiveLabelmaps && (
|
||||
<>
|
||||
{state.renderFill &&
|
||||
!disabledFields.includes('fillAlphaInactive') && (
|
||||
<CustomRange
|
||||
label="Fill Opacity"
|
||||
showPercentage
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
value={state.fillAlphaInactive * 100}
|
||||
onChange={event =>
|
||||
save('fillAlphaInactive', toFloat(event.target.value))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{state.renderOutline &&
|
||||
!disabledFields.includes('outlineAlphaInactive') && (
|
||||
<CustomRange
|
||||
label="Outline Opacity"
|
||||
showPercentage
|
||||
step={1}
|
||||
min={0}
|
||||
max={100}
|
||||
value={state.outlineAlphaInactive * 100}
|
||||
onChange={event =>
|
||||
save(
|
||||
'outlineAlphaInactive',
|
||||
toFloat(event.target.value)
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -169,8 +190,10 @@ SegmentationSettings.propTypes = {
|
||||
renderFill: PropTypes.bool.isRequired,
|
||||
renderOutline: PropTypes.bool.isRequired,
|
||||
shouldRenderInactiveLabelmaps: PropTypes.bool.isRequired,
|
||||
fillAlpha: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /* TODO: why fillAlpha is string? */
|
||||
outlineAlpha: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /* TODO: why fillAlpha is string? */
|
||||
fillAlpha: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||
.isRequired /* TODO: why fillAlpha is string? */,
|
||||
outlineAlpha: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||
.isRequired /* TODO: why fillAlpha is string? */,
|
||||
outlineWidth: PropTypes.number.isRequired,
|
||||
fillAlphaInactive: PropTypes.number.isRequired,
|
||||
outlineAlphaInactive: PropTypes.number.isRequired,
|
||||
|
||||
Reference in new issue
Block a user