ami
ami copied to clipboard
[bug] Shifted segmentation and image
Description
The aim is to display a brain segmentation overlapped on a T1 MRI image (both Nifti) using AMI. The problem is that the brain segmentation appears shifted from the T1. However, when I load these images with Papaya web viewer, FreeView or MRView, everything is properly registered.
Live Demo
You can find a minimal live example here (a modified version of the example viewers_labelmap): https://codesandbox.io/s/mqx57mwzlp
Steps to Reproduce
Please load the example with Google Chrome, I think its not working with Mozilla Firefox. Just wait for the images to be loaded and displayed.
Expected Results
Image properly registered, loaded with the Papaya web viewer.

Actual Results
Image badly registered, loaded with AMI.js (code example given just above)

Browsers Affected
- [ ] All
- [X] Chrome
- [X] Firefox
- [ ] Edge
- [ ] Safari 9
- [ ] Safari 8
- [ ] IE 11
Versions
- AMI: v0.22.0
- THREEJS: v0.92.23
I had the same issue using segmentations and a T1 processed by Freesurfer. I addressed it by moving each individual frame in the stack.
stack._frame.forEach(frame => { frame._imagePosition = [-128, 128, 128] })
This seems a good fix, @TheBrainChain! Thank you for the suggestion :+1: Nevertheless, it would be awesome to find a better fix, I mean, correcting the Nifti parsing that does not seem correct for now.