Skip to content

Conversation

@LinkunGao
Copy link
Contributor

@LinkunGao LinkunGao commented Apr 4, 2023

Fixed #25718

Description

  • To correctly display the nrrd images, we need to display the millimeter, not the pixels.
    • When we load the nrrd image, we need to convert pixels to millimeters should Based on this formula:
    • pixels * space = millimeters
    • So the RASDimention show the width, height, and depth millimeter of nrrd image.

Thus in the code we can use this formula to get the image's real distance:

volume.RASDimensions = new Vector3(
      Math.floor(volume.xLength * spacingX),
      Math.floor(volume.yLength * spacingY),
      Math.floor(volume.zLength * spacingZ)
   ).toArray();
  • To get the 16-bits nrrd images' correct space in threejs environment, we don't need a normalized direction.

This contribution is funded by Load breast image

@Mugen87 Mugen87 added this to the r152 milestone Apr 4, 2023
@Mugen87 Mugen87 changed the title fixed the nrrd images' spacing issue on loading 16 bits images NRRDLoader: Fix spacing issue when loading 16 bit images. Apr 4, 2023
@Mugen87 Mugen87 merged commit e7d1573 into mrdoob:dev Apr 4, 2023
@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 4, 2023

Let's give this a try!

@Methuselah96 Methuselah96 mentioned this pull request Apr 28, 2023
38 tasks
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.

Nrrd loader in segmentaion mode cannot display the 3d mesh in correct position for each slice.

4 participants