Closed igoroctaviano closed 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.
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.
I have updated the metadata provider to get the highest TotalPixelMatrixOriginSequence attribute among the sequences (under PerFrameFunctionalGroupsSequence) and assign it at the top level of the pyramid metadata to work as an approximation. With that, at least the viewer stopped breaking and I can add the annotations in certain places. The problem now is that the calculation is probably not correct, looks like there is a gap/offset between the image and the overlay causing the coordinates of the annotation to be negative in a small percentage of the viewer's (top).
@hackermd if TotalPixelMatrixOriginSequence is absent (at the top level of the pyramid metadata), how can we calculate it based on the nested sequence values?
Do we have to update here to consider the offsets under PerFrameFunctionalGroupsSequence?