Skip to content

fix: update index calculation for x-axis#2701

Open
kofmania wants to merge 3 commits into
cornerstonejs:mainfrom
kofmania:fix/update-getSliceData-caculation-for-X-axis
Open

fix: update index calculation for x-axis#2701
kofmania wants to merge 3 commits into
cornerstonejs:mainfrom
kofmania:fix/update-getSliceData-caculation-for-X-axis

Conversation

@kofmania
Copy link
Copy Markdown

@kofmania kofmania commented Apr 16, 2026

Context

Generating image slice(sagittal plane) data return wrong image in voxelManager.getSliceData

Changes & Results

Update index calculation code

file packages/core/src/utilities/VoxelManager.ts

current

this.setSliceDataValue(sliceData, i * depth + j, this._get(index));

new

this.setSliceDataValue(sliceData, i + j * height, this._get(index));
Screenshot From 2026-04-18 22-03-27

Testing

  1. checkout test repo
  1. run
  • npm i && npm run dev
  1. open url

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • "OS: Ubuntu 24.04
  • "Node version: 22.16
  • "Browser: Chrome Version 147.0.7727.101 (Official Build) (64-bit)

@kofmania kofmania marked this pull request as ready for review April 18, 2026 13:13
@sedghi sedghi requested review from Copilot and wayfarer3130 April 20, 2026 15:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect slice buffer indexing for sagittal (YZ) slice extraction in VoxelManager.getSliceData, which was causing wrong images when generating slice data.

Changes:

  • Adjusted the linear index calculation used when writing into the sliceData buffer for slicePlane === 0 (YZ plane).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/utilities/VoxelManager.ts
Copy link
Copy Markdown
Collaborator

@wayfarer3130 wayfarer3130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks ok, can you create the requested unit test and document the return function?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants