Skip to content

Commit

Permalink
fix(seg): Use ReferencedSegmentNumber in shared fg (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
igoroctaviano committed Feb 3, 2021
1 parent d9a4105 commit 0ed3347
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/adapters/src/adapters/Cornerstone/Segmentation_4X.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@ function checkSEGsOverlapping(
break;
}

const segmentIndex =
PerFrameFunctionalGroups.SegmentIdentificationSequence
.ReferencedSegmentNumber;
const segmentIndex = getSegmentIndex(multiframe);

let SourceImageSequence;

Expand Down Expand Up @@ -778,9 +776,7 @@ function insertOverlappingPixelDataPlanar(
const PerFrameFunctionalGroups =
PerFrameFunctionalGroupsSequence[i];

const segmentIndex =
PerFrameFunctionalGroups.SegmentIdentificationSequence
.ReferencedSegmentNumber;
const segmentIndex = getSegmentIndex(multiframe);

if (segmentIndex !== segmentIndexToProcess) {
continue;
Expand Down Expand Up @@ -896,6 +892,18 @@ function insertOverlappingPixelDataPlanar(
}
}

const getSegmentIndex = multiframe => {
const {
SharedFunctionalGroupsSequence,
PerFrameFunctionalGroupsSequence
} = multiframe;
return PerFrameFunctionalGroupsSequence.SegmentIdentificationSequence
? PerFrameFunctionalGroupsSequence.SegmentIdentificationSequence
.ReferencedSegmentNumber
: SharedFunctionalGroupsSequence.SegmentIdentificationSequence
.ReferencedSegmentNumber;
};

function insertPixelDataPlanar(
segmentsOnFrame,
segmentsOnFrameArray,
Expand Down Expand Up @@ -951,9 +959,7 @@ function insertPixelDataPlanar(
break;
}

const segmentIndex =
PerFrameFunctionalGroups.SegmentIdentificationSequence
.ReferencedSegmentNumber;
const segmentIndex = getSegmentIndex(multiframe);

let SourceImageSequence;

Expand Down

0 comments on commit 0ed3347

Please sign in to comment.