image-js 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-js.esm.js +48 -19
- package/dist/image-js.esm.js.map +1 -1
- package/dist/image-js.esm.min.js +2 -2
- package/dist/image-js.esm.min.js.map +1 -1
- package/dist/image-js.umd.js +52 -21
- package/dist/image-js.umd.js.map +1 -1
- package/dist/image-js.umd.min.js +2 -2
- package/dist/image-js.umd.min.js.map +1 -1
- package/dist-types/image-js.d.ts +2 -4
- package/lib/Stack.d.ts +1 -2
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/align/affineTransfrom/getAffineTransform.d.ts +1 -2
- package/lib/align/affineTransfrom/getAffineTransform.d.ts.map +1 -1
- package/lib/align/affineTransfrom/getAffineTransform.js +4 -1
- package/lib/align/affineTransfrom/getAffineTransform.js.map +1 -1
- package/lib/load/decodeBmp.d.ts.map +1 -1
- package/lib/load/decodeBmp.js +17 -0
- package/lib/load/decodeBmp.js.map +1 -1
- package/lib/load/decodePng.d.ts.map +1 -1
- package/lib/load/decodePng.js +26 -15
- package/lib/load/decodePng.js.map +1 -1
- package/lib/maskAnalysis/getContourMoore.d.ts.map +1 -1
- package/lib/maskAnalysis/getContourMoore.js +2 -2
- package/lib/maskAnalysis/getContourMoore.js.map +1 -1
- package/package.json +8 -5
- package/src/Stack.ts +1 -3
- package/src/align/affineTransfrom/getAffineTransform.ts +5 -3
- package/src/load/decodeBmp.ts +22 -0
- package/src/load/decodePng.ts +25 -17
- package/src/maskAnalysis/getContourMoore.ts +2 -3
package/dist/image-js.umd.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* image-js v1.6.
|
|
2
|
+
* image-js v1.6.2
|
|
3
3
|
* Image processing and manipulation in JavaScript
|
|
4
4
|
* https://github.com/image-js/image-js#readme
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the MIT license.
|
|
7
7
|
*/
|
|
8
8
|
(function (global, factory) {
|
|
9
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports
|
|
10
|
-
typeof define === 'function' && define.amd ? define(['exports'
|
|
11
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IJS = {}
|
|
12
|
-
})(this, (function (exports
|
|
9
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
10
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
11
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IJS = {}));
|
|
12
|
+
})(this, (function (exports) { 'use strict';
|
|
13
13
|
|
|
14
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
15
|
function getDefaultExportFromCjs (x) {
|
|
@@ -14088,7 +14088,7 @@ ${indent}columns: ${matrix.columns}
|
|
|
14088
14088
|
contour.push(currentPoint);
|
|
14089
14089
|
}
|
|
14090
14090
|
const next = findNextPoint(mask, currentPoint, backtrackPoint);
|
|
14091
|
-
assert
|
|
14091
|
+
assert(next, 'Next border point is undefined.');
|
|
14092
14092
|
backtrackPoint = next.prevPoint;
|
|
14093
14093
|
currentPoint = next.currPoint;
|
|
14094
14094
|
if (currentPoint.column === startingPoint.column && currentPoint.row === startingPoint.row) {
|
|
@@ -23805,7 +23805,7 @@ ${indent}columns: ${matrix.columns}
|
|
|
23805
23805
|
},
|
|
23806
23806
|
maxRansacNbIterations,
|
|
23807
23807
|
debug = false,
|
|
23808
|
-
debugImagePath
|
|
23808
|
+
debugImagePath
|
|
23809
23809
|
} = options;
|
|
23810
23810
|
if (source.colorModel !== ImageColorModel.GREY) {
|
|
23811
23811
|
source = source.grey();
|
|
@@ -23885,6 +23885,9 @@ ${indent}columns: ${matrix.columns}
|
|
|
23885
23885
|
}
|
|
23886
23886
|
// create debug image
|
|
23887
23887
|
if (debug) {
|
|
23888
|
+
if (!debugImagePath) {
|
|
23889
|
+
throw new RangeError('Debug image file path is not specified.');
|
|
23890
|
+
}
|
|
23888
23891
|
const montage = new Montage(source, destination, {
|
|
23889
23892
|
disposition: MontageDisposition.VERTICAL
|
|
23890
23893
|
});
|
|
@@ -25058,10 +25061,27 @@ ${indent}columns: ${matrix.columns}
|
|
|
25058
25061
|
}
|
|
25059
25062
|
return new Image(decodedData.width, decodedData.height, {
|
|
25060
25063
|
colorModel,
|
|
25061
|
-
data: decodedData.data
|
|
25064
|
+
data: decodedData.data,
|
|
25065
|
+
resolution: getBmpResolution(decodedData)
|
|
25062
25066
|
});
|
|
25063
25067
|
}
|
|
25064
25068
|
}
|
|
25069
|
+
/**
|
|
25070
|
+
* Gets image's resolution from its parsed data. BMP stores resolution in
|
|
25071
|
+
* pixels per meter.
|
|
25072
|
+
* @param bmp - Parsed BMP image.
|
|
25073
|
+
* @returns Object with resolution data if it is defined.
|
|
25074
|
+
*/
|
|
25075
|
+
function getBmpResolution(bmp) {
|
|
25076
|
+
if (!bmp.xPixelsPerMeter || !bmp.yPixelsPerMeter) {
|
|
25077
|
+
return undefined;
|
|
25078
|
+
}
|
|
25079
|
+
return {
|
|
25080
|
+
x: bmp.xPixelsPerMeter,
|
|
25081
|
+
y: bmp.yPixelsPerMeter,
|
|
25082
|
+
unit: 'meter'
|
|
25083
|
+
};
|
|
25084
|
+
}
|
|
25065
25085
|
|
|
25066
25086
|
const tagsById$2 = {
|
|
25067
25087
|
0x829a: 'ExposureTime',
|
|
@@ -26361,18 +26381,7 @@ ${indent}columns: ${matrix.columns}
|
|
|
26361
26381
|
default:
|
|
26362
26382
|
throw new RangeError(`invalid number of channels: ${png.channels}`);
|
|
26363
26383
|
}
|
|
26364
|
-
|
|
26365
|
-
if (png.resolution) {
|
|
26366
|
-
resolution = png.resolution.unit === 1 ? /*If the resolution unit is meters*/{
|
|
26367
|
-
x: png.resolution.x,
|
|
26368
|
-
y: png.resolution.y,
|
|
26369
|
-
unit: 'meter'
|
|
26370
|
-
} : /*If resolution unit is unknown */{
|
|
26371
|
-
x: png.resolution.x,
|
|
26372
|
-
y: png.resolution.y,
|
|
26373
|
-
unit: 'unknown'
|
|
26374
|
-
};
|
|
26375
|
-
}
|
|
26384
|
+
const resolution = getResolution(png);
|
|
26376
26385
|
return new Image(png.width, png.height, {
|
|
26377
26386
|
colorModel,
|
|
26378
26387
|
bitDepth,
|
|
@@ -26404,9 +26413,11 @@ ${indent}columns: ${matrix.columns}
|
|
|
26404
26413
|
data[dataIndex++] = paletteChannel;
|
|
26405
26414
|
}
|
|
26406
26415
|
}
|
|
26416
|
+
const resolution = getResolution(png);
|
|
26407
26417
|
return new Image(png.width, png.height, {
|
|
26408
26418
|
data,
|
|
26409
|
-
colorModel: png.palette[0].length === 4 ? 'RGBA' : 'RGB'
|
|
26419
|
+
colorModel: png.palette[0].length === 4 ? 'RGBA' : 'RGB',
|
|
26420
|
+
resolution
|
|
26410
26421
|
});
|
|
26411
26422
|
}
|
|
26412
26423
|
function decodeBinary(png) {
|
|
@@ -26426,6 +26437,26 @@ ${indent}columns: ${matrix.columns}
|
|
|
26426
26437
|
}
|
|
26427
26438
|
return result;
|
|
26428
26439
|
}
|
|
26440
|
+
/**
|
|
26441
|
+
* Gets image's resolution from its parsed data.
|
|
26442
|
+
* @param png - Parsed .png image.
|
|
26443
|
+
* @returns Object with resolution data if exists.
|
|
26444
|
+
*/
|
|
26445
|
+
function getResolution(png) {
|
|
26446
|
+
if (png.resolution) {
|
|
26447
|
+
return png.resolution.unit === 1 ? /*If the resolution unit is meters*/{
|
|
26448
|
+
x: png.resolution.x,
|
|
26449
|
+
y: png.resolution.y,
|
|
26450
|
+
unit: 'meter'
|
|
26451
|
+
} : /*If resolution unit is unknown */{
|
|
26452
|
+
x: png.resolution.x,
|
|
26453
|
+
y: png.resolution.y,
|
|
26454
|
+
unit: 'unknown'
|
|
26455
|
+
};
|
|
26456
|
+
} else {
|
|
26457
|
+
return undefined;
|
|
26458
|
+
}
|
|
26459
|
+
}
|
|
26429
26460
|
|
|
26430
26461
|
/**
|
|
26431
26462
|
* Decode a TIFF. See the tiff module.
|