ImagingDataCommons / dicom-microscopy-viewer

Web-based DICOM slide microscopy viewer library
https://imagingdatacommons.github.io/dicom-microscopy-viewer/
MIT License
100 stars 36 forks source link

Offset issue / TotalPixelMatrixOriginSequence is different per layer #44

Closed igoroctaviano closed 3 years ago

igoroctaviano commented 3 years ago

To summarise, the method coordinateFormatGeometry2Scoord was only considering the top-level TotalPixelMatrixOriginSequence attribute even if it was absent.

There is a case where a study didn't have this top-level attribute causing the viewer to break when attempting to add new ROIs. Although this attribute did exist nested inside the sequences.

hackermd commented 3 years ago

if TotalPixelMatrixOriginSequence is absent (at the top level of the pyramid metadata), how can we calculate it based on the nested sequence values?

This attribute is type 1 (required) for a good reason. I don't think we can compute the image position (offset in slide coordinate system) from other metadata. We could try of course to register the images, but I would consider this beyond the scope of the viewer.

Do we have to update here to consider the offsets under PerFrameFunctionalGroupsSequence?

If the PerFrameFunctionalGroupsSequence attribute exists, you could construct TotalPixelMatrixOriginSequence using the values of XOffsetInSlideCoordinateSystem and XOffsetInSlideCoordinateSystem for the frame item (see Plane Position (Slide) Macro) that represents the top-left tile in the tiled Total Pixel Matrix.