Skip to content

Commit

Permalink
Fix/idc slim issue#84 (#101)
Browse files Browse the repository at this point in the history
* Update pyramid.js

Fix wrong comparison in function _areImagePyramidsEqual

* Update utils.js

Relax accepted difference between two number to be considered equal
  • Loading branch information
rodrigobasilio2022 authored Aug 24, 2023
1 parent 409792a commit 6132489
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pyramid.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function _computeImagePyramid ({ metadata }) {

function _areImagePyramidsEqual (pyramid, refPyramid) {
// Check that all the channels have the same pyramid parameters
if (!are2DArraysAlmostEqual(pyramid.extent, refPyramid.extent)) {
if (!are1DArraysAlmostEqual(pyramid.extent, refPyramid.extent)) {
console.warn(
'pyramid has different extent as reference pyramid: ',
pyramid.extent,
Expand All @@ -285,7 +285,7 @@ function _areImagePyramidsEqual (pyramid, refPyramid) {
)
return false
}
if (!are2DArraysAlmostEqual(pyramid.resolutions, refPyramid.resolutions)) {
if (!are1DArraysAlmostEqual(pyramid.resolutions, refPyramid.resolutions)) {
console.warn(
'pyramid has different resolutions as reference pyramid: ',
pyramid.resolutions,
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function mapSlideCoordToPixelCoord ({ point, offset, orientation, spacing }) {
*
* @memberof utils
*/
function are2DArraysAlmostEqual (a, b, eps = 1.e-6) {
function are2DArraysAlmostEqual (a, b, eps = 1.e-5) {
if (a === b) return true
if (a == null || b == null) return false
if (a.length !== b.length) return false
Expand All @@ -445,7 +445,7 @@ function are2DArraysAlmostEqual (a, b, eps = 1.e-6) {
*
* @memberof utils
*/
function are1DArraysAlmostEqual (a, b, eps = 1.e-6) {
function are1DArraysAlmostEqual (a, b, eps = 1.e-5) {
if (a == null || b == null) return false
if (a.length !== b.length) return false

Expand Down

0 comments on commit 6132489

Please sign in to comment.