Skip to content

Commit 6132489

Browse files
Fix/idc slim issue#84 (#101)
* Update pyramid.js Fix wrong comparison in function _areImagePyramidsEqual * Update utils.js Relax accepted difference between two number to be considered equal
1 parent 409792a commit 6132489

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/pyramid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function _computeImagePyramid ({ metadata }) {
269269

270270
function _areImagePyramidsEqual (pyramid, refPyramid) {
271271
// Check that all the channels have the same pyramid parameters
272-
if (!are2DArraysAlmostEqual(pyramid.extent, refPyramid.extent)) {
272+
if (!are1DArraysAlmostEqual(pyramid.extent, refPyramid.extent)) {
273273
console.warn(
274274
'pyramid has different extent as reference pyramid: ',
275275
pyramid.extent,
@@ -285,7 +285,7 @@ function _areImagePyramidsEqual (pyramid, refPyramid) {
285285
)
286286
return false
287287
}
288-
if (!are2DArraysAlmostEqual(pyramid.resolutions, refPyramid.resolutions)) {
288+
if (!are1DArraysAlmostEqual(pyramid.resolutions, refPyramid.resolutions)) {
289289
console.warn(
290290
'pyramid has different resolutions as reference pyramid: ',
291291
pyramid.resolutions,

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ function mapSlideCoordToPixelCoord ({ point, offset, orientation, spacing }) {
418418
*
419419
* @memberof utils
420420
*/
421-
function are2DArraysAlmostEqual (a, b, eps = 1.e-6) {
421+
function are2DArraysAlmostEqual (a, b, eps = 1.e-5) {
422422
if (a === b) return true
423423
if (a == null || b == null) return false
424424
if (a.length !== b.length) return false
@@ -445,7 +445,7 @@ function are2DArraysAlmostEqual (a, b, eps = 1.e-6) {
445445
*
446446
* @memberof utils
447447
*/
448-
function are1DArraysAlmostEqual (a, b, eps = 1.e-6) {
448+
function are1DArraysAlmostEqual (a, b, eps = 1.e-5) {
449449
if (a == null || b == null) return false
450450
if (a.length !== b.length) return false
451451

0 commit comments

Comments
 (0)