@@ -580,6 +580,7 @@ class _Channel {
580580 const imageResolutions = [ ]
581581 const imageOrigins = [ ]
582582 const imagePixelSpacings = [ ]
583+ const physicalSizes = [ ]
583584 const offset = [ 0 , - 1 ]
584585 const baseTotalPixelMatrixColumns = image . pyramidBaseMetadata . TotalPixelMatrixColumns
585586 const baseTotalPixelMatrixRows = image . pyramidBaseMetadata . TotalPixelMatrixRows
@@ -600,6 +601,11 @@ class _Channel {
600601 nRows
601602 ] )
602603 imagePixelSpacings . push ( pixelSpacing )
604+
605+ physicalSizes . push ( [
606+ ( totalPixelMatrixColumns * pixelSpacing [ 0 ] ) . toFixed ( 4 ) ,
607+ ( totalPixelMatrixRows * pixelSpacing [ 1 ] ) . toFixed ( 4 )
608+ ] )
603609 /*
604610 * Compute the resolution at each pyramid level, since the zoom
605611 * factor may not be the same between adjacent pyramid levels.
@@ -619,6 +625,16 @@ class _Channel {
619625 imageOrigins . reverse ( )
620626 imagePixelSpacings . reverse ( )
621627
628+ const uniquePhysicalSizes = [
629+ ...new Set ( physicalSizes . map ( v => v . toString ( ) ) )
630+ ] . map ( v => v . split ( ',' ) )
631+ if ( uniquePhysicalSizes . length > 1 ) {
632+ console . warn (
633+ 'images of the image pyramid have different sizes (in millimeter): ' ,
634+ physicalSizes
635+ )
636+ }
637+
622638 /** Frames may extend beyond the size of the total pixel matrix.
623639 * The excess pixels are empty, i.e. have only a padding value.
624640 * We set the extent to the size of the actual image without taken
0 commit comments