Skip to content

Commit

Permalink
fix(segmentation): black preview when loading a seg, and crash on ope…
Browse files Browse the repository at this point in the history
…ning panel (#4602)
  • Loading branch information
IbrahimCSAE authored Dec 20, 2024
1 parent 921e8f9 commit faf5515
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
6 changes: 4 additions & 2 deletions extensions/cornerstone/src/panels/PanelSegmentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,15 @@ export default function PanelSegmentation({
const firstImageId = referencedImageIds[0];

const instance = metaData.get('instance', firstImageId);
const { SOPInstanceUID, SeriesInstanceUID } = instance;
const SOPInstanceUID = instance.SOPInstanceUID || instance.SopInstanceUID;
const SeriesInstanceUID = instance.SeriesInstanceUID;

const displaySet = displaySetService.getDisplaySetForSOPInstanceUID(
SOPInstanceUID,
SeriesInstanceUID
);
const isExportable = displaySet.isReconstructable;

const isExportable = displaySet?.isReconstructable;

return {
segmentationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
imageLoader,
Types as csTypes,
utilities as csUtils,
metaData,
} from '@cornerstonejs/core';
import {
Enums as csToolsEnums,
Expand Down Expand Up @@ -360,11 +361,11 @@ class SegmentationService extends PubSubService {
options.segments && Object.keys(options.segments).length > 0
? options.segments
: {
1: {
label: 'Segment 1',
active: true,
},
1: {
label: 'Segment 1',
active: true,
},
},
cachedStats: {
info: `S${displaySet.SeriesNumber}: ${displaySet.SeriesDescription}`,
},
Expand All @@ -381,8 +382,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string;
type: SegmentationRepresentations;
} = {
type: LABELMAP,
}
type: LABELMAP,
}
): Promise<string> {
const { type } = options;
let { segmentationId } = options;
Expand Down Expand Up @@ -414,7 +415,10 @@ class SegmentationService extends PubSubService {
imageIds as string[]
);

segDisplaySet.images = derivedSegmentationImages;
segDisplaySet.images = derivedSegmentationImages.map(image => ({
...image,
...metaData.get('instance', image.referencedImageId),
}));

const segmentsInfo = segDisplaySet.segMetadata.data;

Expand Down Expand Up @@ -531,8 +535,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string;
type: SegmentationRepresentations;
} = {
type: CONTOUR,
}
type: CONTOUR,
}
): Promise<string> {
const { type } = options;
let { segmentationId } = options;
Expand Down
3 changes: 2 additions & 1 deletion extensions/default/src/DicomLocalDataSource/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ function createDicomLocalApi(dicomLocalConfig) {
// return instance.imageId;
// }

const { StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID } = instance;
const { StudyInstanceUID, SeriesInstanceUID } = instance;
const SOPInstanceUID = instance.SOPInstanceUID || instance.SopInstanceUID;
const storedInstance = DicomMetadataStore.getInstance(
StudyInstanceUID,
SeriesInstanceUID,
Expand Down

0 comments on commit faf5515

Please sign in to comment.