@@ -2,7 +2,7 @@ import { computed, reactive, ref, toRaw, watch } from 'vue';
22import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray' ;
33import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData' ;
44import vtkBoundingBox from '@kitware/vtk.js/Common/DataModel/BoundingBox' ;
5- import type { RGBAColor , TypedArray } from '@kitware/vtk.js/types' ;
5+ import type { TypedArray } from '@kitware/vtk.js/types' ;
66import { defineStore } from 'pinia' ;
77import { useImageStore } from '@/src/store/datasets-images' ;
88import { join , normalize } from '@/src/utils/path' ;
@@ -32,7 +32,6 @@ const LabelmapArrayType = Uint8Array;
3232export type LabelmapArrayType = Uint8Array ;
3333
3434export const LABELMAP_BACKGROUND_VALUE = 0 ;
35- export const DEFAULT_SEGMENT_COLOR : RGBAColor = [ 255 , 0 , 0 , 255 ] ;
3635export const makeDefaultSegmentName = ( value : number ) => `Segment ${ value } ` ;
3736export const makeDefaultSegmentGroupName = ( baseName : string , index : number ) =>
3837 `Segment Group ${ index } for ${ baseName } ` ;
@@ -254,7 +253,7 @@ export const useSegmentGroupStore = defineStore('segmentGroup', () => {
254253 function getNextColor ( ) {
255254 const color = CATEGORICAL_COLORS [ nextColorIndex ] ;
256255 nextColorIndex = ( nextColorIndex + 1 ) % CATEGORICAL_COLORS . length ;
257- return [ ...color , 255 ] ;
256+ return [ ...color , 255 ] as const ;
258257 }
259258
260259 async function decodeSegments (
@@ -290,7 +289,7 @@ export const useSegmentGroupStore = defineStore('segmentGroup', () => {
290289 return values . map ( ( value ) => ( {
291290 value,
292291 name : makeDefaultSegmentName ( value ) ,
293- color : getNextColor ( ) ,
292+ color : [ ... getNextColor ( ) ] ,
294293 visible : true ,
295294 } ) ) ;
296295 }
@@ -398,7 +397,7 @@ export const useSegmentGroupStore = defineStore('segmentGroup', () => {
398397 return {
399398 name : makeDefaultSegmentName ( value ) ,
400399 value,
401- color : DEFAULT_SEGMENT_COLOR ,
400+ color : [ ... getNextColor ( ) ] ,
402401 visible : true ,
403402 } ;
404403 }
0 commit comments