dcmjs-org / dcmjs

Javascript implementation of DICOM manipulation
https://dcmjs.netlify.com/
MIT License
299 stars 112 forks source link

Images are sorted in Normalizer, but Labelmap are not #193

Closed vsaase closed 3 years ago

vsaase commented 3 years ago

https://github.com/dcmjs-org/dcmjs/blob/e2a877b8760297d72f97698fbbcd892eff406115/src/adapters/Cornerstone/Segmentation_4X.js#L61

Here the assumption is that after creating the Segmentation object, the references are still orderd like the images and the labelmaps. However, Normalizer sorts the images by physical position, resulting in mixing of the labelmaps in the stack.

See also the discussion in issue #144

vsaase commented 3 years ago

ok, sorry, seems to be sorted out in #154

vsaase commented 3 years ago

I think the problem is really in the fillSegmentation method that assumes same ordering as in segmentation object. The inputLabelmaps3D object does not have enough information, as this depends on the ordering of the images in the viewer. A solution would be to provide a map that maps from the labelmap indices to the referenced SOPInstanceUIDs, and the let fillSegmentation sort it out.