Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] spacingBetweenSlices always null on sortImageIdsAndGetSpacing #1805

Open
ghetolay opened this issue Feb 4, 2025 · 2 comments
Open

Comments

@ghetolay
Copy link

ghetolay commented Feb 4, 2025

Describe the Bug

In this code inside sortImageIdsAndGetSpacing()

  const {
    imagePositionPatient: origin,
    sliceThickness,
    spacingBetweenSlices,
  } = metaData.get('imagePlaneModule', sortedImageIds[0]);

spacingBetweenSlices will always be null because it does not seem to be part of ImagePlaneModule from this type and this implementation.

Could make a PR but dunno how you want to go about this, adding spacingBetweenSlices to ImagePlaneModule or retrieving it another way.

Also I could make another issue, but I came across this from a multiframe image, and in such case all the code before that line is just useless. Could totally check if image is multiframe and avoid it completely

Steps to Reproduce

Load a multiframe image to build a volume

The current behavior

the if (spacingBetweenSlices) is never valid and zspacing is then based on sliceThickness instead of spacingBetweenSlices

The expected behavior

zspacing should fallback to spacingBetweenSlices on multiframe images

OS

Windows 11

Node version

v22.11.0

Browser

any

@sedghi
Copy link
Member

sedghi commented Feb 4, 2025

Hmmm, I don't understand the issue. What issue are you facing? Anything not rendering correctly?

@ghetolay
Copy link
Author

ghetolay commented Feb 4, 2025

In the end yes slightly because SliceThickness is not the same as SpacingBetweenSlices so we could have a more accurate rendering.

But it's really a code issue, we're trying to retrieve something that will never get returned, metaData.get('imagePlaneModule') does not return a SpacingBetweenSlices so SpacingBetweenSlices is always undefined.

For the second issue it is also just about code, rendering will be the same.
But we're just doing stuff that won't be used so we could skip it.
We're computing distance between images but on a multiframe we're just getting the same metadata for each image so every disance will be 0 and so we will fallback to SpacingBetweenSlices, we could just detect it's a multiframe as a start and directly fallback rather than doing all the computations to realise we end up with a zSpacing of 0.

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

No branches or pull requests

2 participants