Removing trailing 'frame' query string and allowing usage of first series' instance as thumbnail
This commit is contained in:
parent
335c3526cc
commit
ae39f1841d
@ -180,6 +180,11 @@ export const UISettings = new SimpleSchema({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
label: 'Define if the series\' images shall be sorted by incoming order. Sort by Instance Number by default.',
|
label: 'Define if the series\' images shall be sorted by incoming order. Sort by Instance Number by default.',
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
|
},
|
||||||
|
useMiddleSeriesInstanceAsThumbnail: {
|
||||||
|
type: Boolean,
|
||||||
|
label: 'Define if the middle instance of a series will be used as thumbnail. If not, the first instance will be used.',
|
||||||
|
defaultValue: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
import { Template } from 'meteor/templating';
|
import { Template } from 'meteor/templating';
|
||||||
import { Tracker } from 'meteor/tracker';
|
import { Tracker } from 'meteor/tracker';
|
||||||
import { Session } from 'meteor/session';
|
import { Session } from 'meteor/session';
|
||||||
@ -8,16 +9,18 @@ Template.imageThumbnail.onCreated(() => {
|
|||||||
|
|
||||||
// Get the image ID for current thumbnail
|
// Get the image ID for current thumbnail
|
||||||
instance.getThumbnailImageId = () => {
|
instance.getThumbnailImageId = () => {
|
||||||
|
const settingPath = 'public.ui.useMiddleSeriesInstanceAsThumbnail';
|
||||||
|
const useMiddleFrame = OHIF.utils.ObjectPath.get(Meteor.settings, settingPath);
|
||||||
const stack = instance.data.thumbnail.stack;
|
const stack = instance.data.thumbnail.stack;
|
||||||
const lastIndex = (stack.numImageFrames || stack.images.length || 1) - 1;
|
const lastIndex = (stack.numImageFrames || stack.images.length || 1) - 1;
|
||||||
let imageIndex = Math.floor(lastIndex / 2);
|
let imageIndex = useMiddleFrame ? Math.floor(lastIndex / 2) : 0;
|
||||||
let imageInstance;
|
let imageInstance;
|
||||||
|
|
||||||
if (stack.isMultiFrame) {
|
if (stack.isMultiFrame) {
|
||||||
imageInstance = stack.images[0];
|
imageInstance = stack.images[0];
|
||||||
} else {
|
} else {
|
||||||
imageInstance = stack.images[imageIndex];
|
imageInstance = stack.images[imageIndex];
|
||||||
imageIndex = 0;
|
imageIndex = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return imageInstance.getImageId(imageIndex, true);
|
return imageInstance.getImageId(imageIndex, true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user