Skip to content

Commit 19ede97

Browse files
committed
fix: compute image stats for SEG DICOM files
Changed image-stats to watch activeScalars directly instead of using useVtkComputed. This ensures stats are computed when SEG images replace their vtkImageData object after loading, fixing the paint tool error when selecting segmentation files.
1 parent 19d50e4 commit 19ede97

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/components/DicomQuickInfoButton.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,3 @@ const dicomInfo = computed(() => {
9292
</template>
9393

9494
<style scoped src="@/src/components/styles/utils.css"></style>
95-
<style scoped></style>

src/store/image-stats.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import * as Comlink from 'comlink';
1212
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
1313
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
14-
import { useVtkComputed } from '@/src/core/vtk/useVtkComputed';
1514
import { WLAutoRanges, WL_HIST_BINS } from '@/src/constants';
1615
import { HistogramWorker } from '@/src/utils/histogram.worker';
1716
import { Maybe } from '@/src/types';
@@ -134,13 +133,13 @@ export const useImageStatsStore = defineStore('image-stats', () => {
134133
const activeScalars = computed(() =>
135134
imageData.value?.getPointData()?.getScalars()
136135
);
137-
const scalarRange = useVtkComputed(activeScalars, () =>
138-
activeScalars.value?.getRange(0)
139-
);
140136

141137
watch(
142-
scalarRange,
143-
(range) => {
138+
activeScalars,
139+
(scalars) => {
140+
if (!scalars) return;
141+
142+
const range = scalars.getRange(0);
144143
if (range) {
145144
internalSetScalarRange(id, range[0], range[1]);
146145
}

0 commit comments

Comments
 (0)