Skip to content

Commit

Permalink
feat: 🎸 Seg jump to slice + show/hide
Browse files Browse the repository at this point in the history
* Add segment part 2 (jump to frame and visibility toggle)

* Cr updates

* Filter displaysets with images

* feat: 🎸 Seg jump to slice + show/hide

Co-authored-by: James Petts <[email protected]>
  • Loading branch information
igoroctaviano and JamesAPetts authored Apr 24, 2020
1 parent fc40d84 commit 835f64d
Show file tree
Hide file tree
Showing 19 changed files with 380 additions and 232 deletions.
2 changes: 1 addition & 1 deletion extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "4.12.5",
"cornerstone-wado-image-loader": "^3.1.0",
"dcmjs": "^0.10.1",
"dcmjs": "^0.12.2",
"dicom-parser": "^1.8.3",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/commandsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ const commandsModule = ({ servicesManager }) => {
const study = studyMetadataManager.get(StudyInstanceUID);

const displaySet = study.findDisplaySet(ds => {
return ds.images.find(i => i.getSOPInstanceUID() === SOPInstanceUID)
return ds.images && ds.images.find(i => i.getSOPInstanceUID() === SOPInstanceUID)
});

displaySet.SOPInstanceUID = SOPInstanceUID;
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"peerDependencies": {
"@ohif/core": "^0.50.0",
"dcmjs": "^0.10.1",
"dcmjs": "^0.12.2",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-rt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ohif/core": "^0.50.0",
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "^4.0.9",
"dcmjs": "^0.8.3",
"dcmjs": "^0.12.2",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@
}

.dcmrt-structure-set-item .item-label {
overflow: hidden;
max-width: calc(100% - 15px); /* calc(100% - 50px); 20px = eye icon */
text-overflow: ellipsis;
overflow-wrap: normal;
white-space: nowrap;

display: flex;
justify-content: space-between;
padding-right: 10px;
}

.dcmrt-structure-set-item .item-label span {
overflow-wrap: normal;
white-space: nowrap;
overflow: hidden;
max-width: calc(100% - 40px); /* calc(100% - 50px); 20px = eye icon */
text-overflow: ellipsis;
}

.dcmrt-structure-set-item .item-label .eye-icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const StructureSetItem = ({
>
<div>
<div className="item-label" style={{ marginBottom: 4 }}>
{label}
<span>{label}</span>
<Icon
className={`eye-icon ${isVisible && '--visible'}`}
name={isVisible ? 'eye' : 'eye-closed'}
Expand Down
11 changes: 5 additions & 6 deletions extensions/dicom-rt/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ export default {
};

return (
<RTPanel
{...props}
onContourItemClick={contourItemClickHandler}
/>
<RTPanel {...props} onContourItemClick={contourItemClickHandler} />
);
};

Expand All @@ -51,8 +48,10 @@ export default {
if (study && study.series) {
for (let j = 0; j < study.series.length; j++) {
const series = study.series[j];
console.log(studies);
if (['RTSTRUCT', 'RTPLAN', 'RTDOSE'].includes(series.Modality)) {
if (
/* Could be expanded to contain RTPLAN and RTDOSE information in the future */
['RTSTRUCT'].includes(series.Modality)
) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/dicom-segmentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ohif/core": "^0.50.0",
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "4.12.5",
"dcmjs": "^0.6.1",
"dcmjs": "^0.12.2",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
height: 20px;
}

.dcmseg-segment-item .segment-label {
overflow: hidden;
max-width: calc(100% - 50px);
text-overflow: ellipsis;
overflow-wrap: normal;
white-space: nowrap;
}

.dcmseg-segment-item .segment-info {
display: inline-block;
margin-top: 9px;
Expand Down Expand Up @@ -62,3 +54,30 @@
.dcmseg-segment-item .segment-actions .btnAction i {
margin-right: 4px;
}

.dcmseg-segment-item .segment-label {
display: flex;
justify-content: space-between;
padding-right: 20px;
}

.dcmseg-segment-item .segment-label span {
overflow-wrap: normal;
white-space: nowrap;
overflow: hidden;
max-width: calc(100% - 40px); /* calc(100% - 50px); 20px = eye icon */
text-overflow: ellipsis;
}

.dcmseg-segment-item .segment-label .eye-icon {
cursor: pointer;
color: var(--active-color);
}

.dcmseg-segment-item .segment-label .eye-icon:hover {
color: var(--hover-color);
}

.dcmseg-segment-item .segment-label .eye-icon.--visible {
color: var(--default-color);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { TableListItem, Icon } from '@ohif/ui';

Expand All @@ -17,48 +17,63 @@ ColoredCircle.propTypes = {
color: PropTypes.array.isRequired,
};

const SegmentItem = ({ index, label, onClick, itemClass, color }) => (
<div className="dcmseg-segment-item">
<TableListItem
key={index}
itemKey={index}
itemIndex={index}
itemClass={itemClass}
itemMeta={<ColoredCircle color={color} />}
itemMetaClass="segment-color-section"
onItemClick={onClick}
>
<div>
<div className="segment-label" style={{ marginBottom: 4 }}>
{label}
</div>
{false && <div className="segment-info">{'...'}</div>}
{false && (
<div className="segment-actions">
<button
className="btnAction"
onClick={() => console.log('Relabelling...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
const SegmentItem = ({ index, label, onClick, itemClass, color, visible = true, onVisibilityChange }) => {
const [isVisible, setIsVisible] = useState(visible);
return (
<div className="dcmseg-segment-item">
<TableListItem
key={index}
itemKey={index}
itemIndex={index}
itemClass={itemClass}
itemMeta={<ColoredCircle color={color} />}
itemMetaClass="segment-color-section"
onItemClick={onClick}
>
<div>
<div className="segment-label" style={{ marginBottom: 4 }}>
<span>{label}</span>
<Icon
className={`eye-icon ${isVisible && '--visible'}`}
name={isVisible ? 'eye' : 'eye-closed'}
width="20px"
height="20px"
onClick={event => {
event.stopPropagation();
const newVisibility = !isVisible;
setIsVisible(newVisibility);
onVisibilityChange(newVisibility);
}}
/>
</div>
{false && <div className="segment-info">{'...'}</div>}
{false && (
<div className="segment-actions">
<button
className="btnAction"
onClick={() => console.log('Relabelling...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Relabel
</button>
<button
className="btnAction"
onClick={() => console.log('Editing description...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
<button
className="btnAction"
onClick={() => console.log('Editing description...')}
>
<span style={{ marginRight: '4px' }}>
<Icon name="edit" width="14px" height="14px" />
</span>
Description
</button>
</div>
)}
</div>
</TableListItem>
</div>
);
</div>
)}
</div>
</TableListItem>
</div>
);
};

SegmentItem.propTypes = {
index: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
Expand Down
Loading

0 comments on commit 835f64d

Please sign in to comment.