fix: Initial sort not consistent (#5224)
* fix: Initial sort not consistent * Add better sort criteria * Remove sorting changes * Start replacing screen shots * Update bun lock for version * Leave default sort for test mode * fix: Add consistent sorting for same series splits * PR comments * docs: add notes for series/display set sort * Updated example docs * Update sortVector to be compareSameStudy * Add unit test * PR comments
This commit is contained in:
1 parent
14bc99124d
commit
77f9f8e1c4
8 files changed
+253
-66
No files matched your search
@@ -67,7 +67,7 @@ function getDisplaySetInfo(instances) {
|
||||
};
|
||||
}
|
||||
|
||||
const makeDisplaySet = instances => {
|
||||
const makeDisplaySet = (instances, index) => {
|
||||
// Need to sort the instances in order to get a consistent instance/thumbnail
|
||||
sortStudyInstances(instances);
|
||||
const instance = instances[0];
|
||||
@@ -190,7 +190,7 @@ function getDisplaySetsFromSeries(instances) {
|
||||
// into their own specific display sets. Place the rest of each
|
||||
// series into another display set.
|
||||
const stackableInstances = [];
|
||||
instances.forEach(instance => {
|
||||
instances.forEach((instance, instanceIndex) => {
|
||||
// All imaging modalities must have a valid value for sopClassUid (x00080016) or rows (x00280010)
|
||||
if (!isImage(instance.SOPClassUID) && !instance.Rows) {
|
||||
return;
|
||||
@@ -198,7 +198,7 @@ function getDisplaySetsFromSeries(instances) {
|
||||
|
||||
let displaySet;
|
||||
if (isMultiFrame(instance)) {
|
||||
displaySet = makeDisplaySet([instance]);
|
||||
displaySet = makeDisplaySet([instance], instanceIndex);
|
||||
displaySet.setAttributes({
|
||||
sopClassUids,
|
||||
numImageFrames: instance.NumberOfFrames,
|
||||
@@ -207,7 +207,7 @@ function getDisplaySetsFromSeries(instances) {
|
||||
});
|
||||
displaySets.push(displaySet);
|
||||
} else if (isSingleImageModality(instance.Modality)) {
|
||||
displaySet = makeDisplaySet([instance]);
|
||||
displaySet = makeDisplaySet([instance], instanceIndex);
|
||||
displaySet.setAttributes({
|
||||
sopClassUids,
|
||||
instanceNumber: instance.InstanceNumber,
|
||||
@@ -220,7 +220,7 @@ function getDisplaySetsFromSeries(instances) {
|
||||
});
|
||||
|
||||
if (stackableInstances.length) {
|
||||
const displaySet = makeDisplaySet(stackableInstances);
|
||||
const displaySet = makeDisplaySet(stackableInstances, displaySets.length);
|
||||
displaySet.setAttribute('studyInstanceUid', instances[0].StudyInstanceUID);
|
||||
displaySet.setAttributes({
|
||||
sopClassUids,
|
||||
|
||||
Reference in new issue
Block a user