Skip to content

Conversation

@daker
Copy link
Contributor

@daker daker commented Oct 16, 2025

This pull request primarily updates the dependency on @kitware/vtk.js to version 34.13.2 across multiple packages and refines rendering configuration handling in the core rendering engine. The most significant impact is improved compatibility with the latest VTK.js and more consistent usage of the preferSizeOverAccuracy rendering option.

Dependency Updates

  • Updated @kitware/vtk.js dependency to version 34.13.2 in packages/core/package.json, packages/labelmap-interpolation/package.json, and packages/polymorphic-segmentation/package.json for improved compatibility and access to new features. [1] [2] [3]

Rendering Configuration Improvements

  • Added explicit usage of getConfiguration().rendering.preferSizeOverAccuracy in createVolumeActor.ts to set the rendering accuracy for volume actors, ensuring consistent behavior. [1] [2]
  • Removed the conditional setting of preferSizeOverAccuracy in createVolumeMapper.ts and StackViewport.ts, centralizing configuration logic and reducing redundant code. [1] [2]

Internal API Consistency

  • Refactored the vtkStreamingOpenGLTexture.js API to accept parameters as an object instead of positional arguments, improving readability and maintainability.

Minor Code Consistency

  • Standardized string quotes in version.ts for consistency.

@sedghi
Copy link
Member

sedghi commented Oct 18, 2025

let's see tests passing or not, there seem to be some build errors though

$ tsc --project ./tsconfig.json
src/cache/classes/Mesh.ts:61:15 - error TS2339: Property 'setInputConnection' does not exist on type 'Readonly<{}>'.

61       normals.setInputConnection(reader.getOutputPort());
                 ~~~~~~~~~~~~~~~~~~

src/cache/classes/Mesh.ts:62:41 - error TS2339: Property 'getOutputPort' does not exist on type 'Readonly<{}>'.

62       mapper.setInputConnection(normals.getOutputPort());
                                           ~~~~~~~~~~~~~

src/RenderingEngine/renderPasses/sharpeningRenderPass.ts:19:21 - error TS2339: Property 'setDelegates' does not exist on type 'Readonly<{}>'.

19     convolutionPass.setDelegates([renderPass]);
                       ~~~~~~~~~~~~

src/RenderingEngine/renderPasses/sharpeningRenderPass.ts:27:21 - error TS2339: Property 'setKernelDimension' does not exist on type 'Readonly<{}>'.

27     convolutionPass.setKernelDimension(3);
                       ~~~~~~~~~~~~~~~~~~

src/RenderingEngine/renderPasses/sharpeningRenderPass.ts:28:21 - error TS2339: Property 'setKernel' does not exist on type 'Readonly<{}>'.

28     convolutionPass.setKernel([-k, -k, -k, -k, 1 + 8 * k, -k, -k, -k, -k]);
                       ~~~~~~~~~

also i'm not sure why we are removing preferSizeOverAccuracy? does that not work anymore in 34?

…multi-input volumes

- Added logic to determine the number of components based on valid inputs.
- Updated the use of independent components based on volume properties for multi-component data.
@daker
Copy link
Contributor Author

daker commented Oct 19, 2025

I am not sure why the TestPattern tests are failing

image

@sedghi
Copy link
Member

sedghi commented Oct 19, 2025

I will check

@sedghi
Copy link
Member

sedghi commented Oct 20, 2025

can you fix the rest of issues? these

mapper.setInputConnection(reader.getOutputPort());
this._actors.push(createActorWithMapper(mapper));
} else if (this._format === MeshType.STL) {
const mapper = vtkMapper.newInstance();
const reader = vtkSTLReader.newInstance();
reader.parseAsArrayBuffer(props.arrayBuffer);
normals.setInputConnection(reader.getOutputPort());
mapper.setInputConnection(normals.getOutputPort());
this._actors.push(createActorWithMapper(mapper));
} else if (this._format === MeshType.OBJ) {

@daker
Copy link
Contributor Author

daker commented Oct 20, 2025

@sedghi yes i can look at them if have you fixed the TestPattern tests

@sedghi
Copy link
Member

sedghi commented Oct 20, 2025

it is super weird since we don't have much image mapper related custom loading, we just use the vtkImageMapper.

@daker
Copy link
Contributor Author

daker commented Oct 20, 2025

@sedghi i don't see those errors on my machine, maybe if you push to see what ci says it will help

@sedghi
Copy link
Member

sedghi commented Oct 20, 2025

@daker here is the ci for bun build

erna notice cli v8.2.1
lerna info ci enabled

 Lerna (powered by Nx)   Running target build for 7 projects:

- @cornerstonejs/adapters
- @cornerstonejs/ai
- @cornerstonejs/core
- @cornerstonejs/labelmap-interpolation
- @cornerstonejs/nifti-volume-loader
- @cornerstonejs/polymorphic-segmentation
- @cornerstonejs/tools



> @cornerstonejs/core:build

@cornerstonejs/core: $ node ../../scripts/generate-version.js ./
@cornerstonejs/core: Version exported to src/version.ts
@cornerstonejs/core: $ bun run build:esm
@cornerstonejs/core: $ tsc --project ./tsconfig.json

> @cornerstonejs/tools:build


> @cornerstonejs/nifti-volume-loader:build

@cornerstonejs/nifti-volume-loader: $ node ../../scripts/generate-version.js ./
@cornerstonejs/tools: $ node ../../scripts/generate-version.js ./
@cornerstonejs/nifti-volume-loader: Version exported to src/version.ts
@cornerstonejs/tools: Version exported to src/version.ts
@cornerstonejs/nifti-volume-loader: $ bun run build:all
@cornerstonejs/tools: $ bun run build:esm
@cornerstonejs/tools: $ tsc --project ./tsconfig.json
@cornerstonejs/nifti-volume-loader: $ bun run build:esm
@cornerstonejs/nifti-volume-loader: $ tsc --project ./tsconfig.json
@cornerstonejs/tools: src/tools/VolumeCroppingTool.ts(838,26): error TS2352: Conversion of type 'vtkMapper | vtkVolumeMapper | vtkAbstractImageMapper | CanvasMapper' to type 'vtkVolumeMapper' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@cornerstonejs/tools: src/tools/VolumeCroppingTool.ts(1131,20): error TS2352: Conversion of type 'vtkMapper | vtkVolumeMapper | vtkAbstractImageMapper | CanvasMapper' to type 'vtkVolumeMapper' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@cornerstonejs/tools:   Type 'CanvasMapper' is missing the following properties from type 'vtkVolumeMapper': getBounds, getBlendMode, getBlendModeAsString, getSampleDistance, and 71 more.
@cornerstonejs/tools: src/tools/displayTools/Labelmap/addVolumesAsIndependentComponents.ts(52,21): error TS2352: Conversion of type 'ActorEntry' to type '{ actor: vtkVolume; }' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@cornerstonejs/tools:   Types of property 'actor' are incompatible.
@cornerstonejs/tools:     Type 'vtkActor | vtkVolume | vtkImageSlice | CanvasActor' is not comparable to type 'vtkVolume'.
@cornerstonejs/tools:       Type 'CanvasActor' is missing the following properties from type 'vtkVolume': getVolumes, getBounds, getBoundsByReference, getMTime, and 81 more.
@cornerstonejs/tools: src/tools/displayTools/Labelmap/addVolumesAsIndependentComponents.ts(107,49): error TS2345: Argument of type 'import("/home/circleci/repo/packages/tools/node_modules/@kitware/vtk.js/Rendering/Core/VolumeMapper").vtkVolumeMapper' is not assignable to parameter of type 'import("/home/circleci/repo/node_modules/@kitware/vtk.js/Rendering/Core/VolumeMapper").vtkVolumeMapper'.
@cornerstonejs/tools:   Type 'vtkVolumeMapper' is missing the following properties from type 'vtkVolumeMapper': setOpacityTextureWidth, getOpacityTextureWidth, setColorTextureWidth, getColorTextureWidth, and 2 more.
@cornerstonejs/tools: src/tools/displayTools/Labelmap/addVolumesAsIndependentComponents.ts(108,19): error TS2345: Argument of type 'import("/home/circleci/repo/node_modules/@kitware/vtk.js/Rendering/Core/VolumeMapper").vtkVolumeMapper' is not assignable to parameter of type 'import("/home/circleci/repo/packages/tools/node_modules/@kitware/vtk.js/Rendering/Core/VolumeMapper").vtkVolumeMapper'.
@cornerstonejs/tools:   Type 'vtkVolumeMapper' is missing the following properties from type 'vtkVolumeMapper': getAverageIPScalarRange, getAverageIPScalarRangeByReference, getVolumetricScatteringBlending, getGlobalIlluminationReach, and 15 more.
@cornerstonejs/tools: src/tools/displayTools/Labelmap/addVolumesAsIndependentComponents.ts(125,5): error TS2322: Type 'vtkVolume' is not assignable to type 'vtkActor | vtkVolume | vtkImageSlice | CanvasActor'.
@cornerstonejs/tools:   Type 'vtkVolume' is missing the following properties from type 'vtkImageSlice': getBoundsForSlice, getImages, getIsOpaque, getMinXBound, and 10 more.
@cornerstonejs/tools: src/tools/displayTools/Labelmap/labelmapDisplay.ts(317,25): error TS2352: Conversion of type 'vtkActor | vtkVolume | vtkImageSlice | CanvasActor' to type 'vtkVolume | vtkImageSlice' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@cornerstonejs/tools:   Type 'CanvasActor' is not comparable to type 'vtkVolume | vtkImageSlice'.
@cornerstonejs/tools:     Type 'CanvasActor' is missing the following properties from type 'vtkImageSlice': getActors, getBounds, getBoundsByReference, getBoundsForSlice, and 93 more.
@cornerstonejs/tools: src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts(115,5): error TS2322: Type 'vtkActor' is not assignable to type 'vtkActor | vtkVolume | vtkImageSlice | CanvasActor'.
@cornerstonejs/tools:   Type 'vtkActor' is missing the following properties from type 'vtkActor': getProperties, setProperties, getBoundsByReference
@cornerstonejs/tools: src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts(76,7): error TS2322: Type 'vtkImageData' is not assignable to type 'CPUImageData | vtkImageData'.
@cornerstonejs/tools:   Property 'initialize' is missing in type 'import("/home/circleci/repo/packages/tools/node_modules/@kitware/vtk.js/Common/DataModel/ImageData").vtkImageData' but required in type 'import("/home/circleci/repo/node_modules/@kitware/vtk.js/Common/DataModel/ImageData").vtkImageData'.
@cornerstonejs/tools: src/tools/segmentation/strategies/compositions/regionFill.ts(34,7): error TS2322: Type 'vtkImageData' is not assignable to type 'CPUImageData | vtkImageData'.
@cornerstonejs/tools: src/utilities/pointInSurroundingSphereCallback.ts(57,5): error TS2322: Type 'vtkImageData' is not assignable to type 'CPUImageData | vtkImageData'.



 Lerna (powered by Nx)   Running target build for 7 projects failed

Tasks not run because their dependencies failed or --nx-bail=true:

- @cornerstonejs/adapters:build
- @cornerstonejs/ai:build
- @cornerstonejs/labelmap-interpolation:build
- @cornerstonejs/polymorphic-segmentation:build

Failed tasks:

- @cornerstonejs/tools:build

error: script "build" exited with code 1

Exited with code exit status 1

@daker
Copy link
Contributor Author

daker commented Oct 20, 2025

@sedghi i might think it's an easy fix but i don't have bun installed, you just need to update vtk.js in the @cornerstonejs/tools package, the bun.lock uses "@cornerstonejs/tools/@kitware/vtk.js": ["@kitware/[email protected]", "

8102ca3#diff-bfd0ef82a01108fa1e836c2500b98b7de8a92bb1ae352a8efcbd9d6ffcaabd60R4421

image

@sedghi
Copy link
Member

sedghi commented Oct 20, 2025

@daker I wasn't able to figure out the color, i posted to vtk forum to see https://discourse.vtk.org/t/color-images-not-rendering-after-upgrade-to-vtk-js-34-0-0/16104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants