@@ -22,7 +22,7 @@ import {
22
22
ChunkStatus ,
23
23
ChunkImageEvents ,
24
24
} from '@/src/core/streaming/chunkImage' ;
25
- import { ComputedRef , Ref , computed , ref } from 'vue' ;
25
+ import { ComputedRef , computed } from 'vue' ;
26
26
import mitt , { Emitter } from 'mitt' ;
27
27
28
28
const { fastComputeRange } = vtkDataArray ;
@@ -74,16 +74,16 @@ export default class DicomChunkImage implements ChunkImage {
74
74
private events : Emitter < ChunkImageEvents > ;
75
75
public imageData : Maybe < vtkImageData > ;
76
76
public dataId : Maybe < string > ;
77
- public chunkStatus : Ref < ChunkStatus [ ] > ;
77
+ public chunkStatus : ChunkStatus [ ] ;
78
78
public isLoading : ComputedRef < boolean > ;
79
79
80
80
constructor ( ) {
81
81
this . chunks = [ ] ;
82
82
this . chunkListeners = [ ] ;
83
83
this . dataId = null ;
84
- this . chunkStatus = ref ( [ ] ) ;
84
+ this . chunkStatus = [ ] ;
85
85
this . isLoading = computed ( ( ) =>
86
- this . chunkStatus . value . some (
86
+ this . chunkStatus . some (
87
87
( status ) =>
88
88
status !== ChunkStatus . Loaded && status !== ChunkStatus . Errored
89
89
)
@@ -112,7 +112,7 @@ export default class DicomChunkImage implements ChunkImage {
112
112
this . chunks . length = 0 ;
113
113
this . imageData = null ;
114
114
this . dataId = null ;
115
- this . chunkStatus . value = [ ] ;
115
+ this . chunkStatus = [ ] ;
116
116
this . thumbnailCache = new WeakMap ( ) ;
117
117
}
118
118
@@ -150,7 +150,7 @@ export default class DicomChunkImage implements ChunkImage {
150
150
// save the newly sorted chunk order
151
151
[ this . dataId , this . chunks ] = volumes [ 0 ] ;
152
152
153
- this . chunkStatus . value = this . chunks . map ( ( chunk ) => {
153
+ this . chunkStatus = this . chunks . map ( ( chunk ) => {
154
154
switch ( chunk . state ) {
155
155
case ChunkState . Init :
156
156
case ChunkState . MetaLoading :
@@ -255,7 +255,7 @@ export default class DicomChunkImage implements ChunkImage {
255
255
dims [ 0 ] * dims [ 1 ] * scalars . getNumberOfComponents ( ) * chunkIndex ;
256
256
pixelData . set ( result . image . data as TypedArray , offset ) ;
257
257
258
- const rangeAlreadyInitialized = this . chunkStatus . value . some (
258
+ const rangeAlreadyInitialized = this . chunkStatus . some (
259
259
( status ) => status === ChunkStatus . Loaded
260
260
) ;
261
261
@@ -275,22 +275,21 @@ export default class DicomChunkImage implements ChunkImage {
275
275
scalars . setRange ( { min : newMin , max : newMax } , comp ) ;
276
276
}
277
277
278
+ this . chunkStatus [ chunkIndex ] = ChunkStatus . Loaded ;
278
279
this . events . emit ( 'chunkLoaded' , {
279
280
chunk,
280
281
updatedExtent : [ 0 , dims [ 0 ] - 1 , 0 , dims [ 1 ] - 1 , chunkIndex , chunkIndex ] ,
281
282
} ) ;
282
283
283
- this . chunkStatus . value [ chunkIndex ] = ChunkStatus . Loaded ;
284
-
285
284
this . imageData . modified ( ) ;
286
285
}
287
286
288
287
private onChunkErrored ( chunkIndex : number , err : unknown ) {
288
+ this . chunkStatus [ chunkIndex ] = ChunkStatus . Errored ;
289
289
this . events . emit ( 'chunkErrored' , {
290
290
chunk : this . chunks [ chunkIndex ] ,
291
291
error : err ,
292
292
} ) ;
293
- this . chunkStatus . value [ chunkIndex ] = ChunkStatus . Errored ;
294
293
}
295
294
296
295
private updateDicomStore ( ) {
0 commit comments