Skip to content

Commit bf1050d

Browse files
authored
Fix updating window on frame change (#642)
* Fix updating window on frame change * Fix styling
1 parent 5d17bd2 commit bf1050d

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

web_client/src/components/WindowWidget.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export default defineComponent({
3232
width: currentWindowWidth.value,
3333
level: currentWindowLevel.value,
3434
}));
35-
const data = props.representation.getInputDataSet();
36-
const distribution = data.computeHistogram(data.getBounds());
37-
const widthMin = computed(() => distribution.minimum || 0);
38-
const widthMax = computed(() => distribution.maximum || 0);
35+
const data = computed(() => props.representation.getInputDataSet());
36+
const distribution = computed(() => data.value.computeHistogram(data.value.getBounds()));
37+
const widthMin = computed(() => distribution.value.minimum || 0);
38+
const widthMax = computed(() => distribution.value.maximum || 0);
3939
const selectedPreset = ref();
4040
const windowLocked = computed(() => store.state.windowLocked.lock);
4141
const windowLockImage = computed(() => store.state.windowLocked.associatedImage);
@@ -71,8 +71,8 @@ export default defineComponent({
7171
function autoRange() {
7272
if (windowLocked.value) return;
7373
currentRange.value = [
74-
Math.floor(distribution.minimum + distribution.sigma),
75-
Math.floor(distribution.maximum - distribution.sigma),
74+
Math.floor(distribution.value.minimum + distribution.value.sigma),
75+
Math.floor(distribution.value.maximum - distribution.value.sigma),
7676
];
7777
const ww = currentRange.value[1] - currentRange.value[0];
7878
const wl = currentRange.value[0] + Math.floor(ww / 2);

web_client/src/store/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ function prepareProxyManager(proxyManager) {
5151
view.getRepresentations().forEach((representation) => {
5252
representation.setInterpolationType(InterpolationType.NEAREST);
5353
representation.onModified(macro.debounce(() => {
54-
view.render(true);
54+
if (view.getRepresentations()) {
55+
view.render(true);
56+
}
5557
}, 0));
5658
// debounce timer doesn't need a wait time because
5759
// the many onModified changes that it needs to collapse to a single rerender

0 commit comments

Comments
 (0)