Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Sep 15, 2023
1 parent 97b65a6 commit 1c1fb34
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 49 deletions.
31 changes: 15 additions & 16 deletions extensions/cornerstone-dicom-seg/src/commandsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,25 @@ const commandsModule = ({
*
*/
createEmptySegmentationForViewport: async ({ viewportId }) => {
const viewport = getTargetViewport({ viewportId, viewportGridService });
// Todo: add support for multiple display sets
const displaySetInstanceUID = viewport.displaySetInstanceUIDs[0];

const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);

if (!displaySet.isReconstructable) {
uiNotificationService.show({
title: 'Segmentation',
message: 'Segmentation is not supported for non-reconstructible displaysets yet',
type: 'error',
});
return;
}

updateViewportsForSegmentationRendering({
viewportId,
servicesManager,
loadFn: async () => {
const viewport = getTargetViewport({ viewportId, viewportGridService });

// Todo: add support for multiple display sets
const displaySetInstanceUID = viewport.displaySetInstanceUIDs[0];

const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);

if (!displaySet.isReconstructable) {
uiNotificationService.show({
title: 'Segmentation',
message: 'Segmentation is not supported for non-reconstructible displaysets yet',
type: 'error',
});
return;
}

const currentSegmentations = segmentationService.getSegmentations();
const segmentationId = await segmentationService.createSegmentationForDisplaySet(
displaySetInstanceUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ function SegmentationToolbox({ servicesManager, extensionManager }) {
},
{
type: 'custom',
id: 'threshold-range',
children: () => {
return (
<div>
Expand Down
32 changes: 1 addition & 31 deletions modes/segmentation/src/toolbarButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const toolGroupIds = ['default', 'mpr', 'SRToolGroup'];
* @returns {Array} an array of 'setToolActive' commands
*/
function _createSetToolActiveCommands(toolName) {
const temp = toolGroupIds.map((toolGroupId) => ({
const temp = toolGroupIds.map(toolGroupId => ({
commandName: 'setToolActive',
commandOptions: {
toolGroupId,
Expand Down Expand Up @@ -335,36 +335,6 @@ const toolbarButtons = [
],
'Magnify'
),
_createToolButton(
'Rectangle',
'tool-rectangle',
'Rectangle',
[
{
commandName: 'setToolActive',
commandOptions: {
toolName: 'RectangleROI',
},
context: 'CORNERSTONE',
},
],
'Rectangle'
),
_createToolButton(
'CalibrationLine',
'tool-calibration',
'Calibration',
[
{
commandName: 'setToolActive',
commandOptions: {
toolName: 'CalibrationLine',
},
context: 'CORNERSTONE',
},
],
'Calibration Line'
),
_createActionButton(
'TagBrowser',
'list-bullets',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function ToolSettings({ options }) {
buttons.push({
children: label,
onClick: () => option.onChange(optionValue),
key: `button-${option.name}-${index}`, // A unique key
key: `button-${option.id}-${index}`, // A unique key
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const InputDoubleRange: React.FC<InputDoubleRangeProps> = ({
const rangeValuePercentageEnd = ((rangeValue[1] - minValue) / (maxValue - minValue)) * 100;

return (
<div className={`flex items-center space-x-2${containerClassName ?? ''}`}>
<div className={`flex select-none items-center space-x-2 ${containerClassName ?? ''}`}>
{showLabel && LabelOrEditableNumber(rangeValue[0], 0)}
<div
className="relative flex h-10 w-full items-center"
Expand Down

0 comments on commit 1c1fb34

Please sign in to comment.