Skip to content

Commit

Permalink
chore: update dependencies (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 15, 2021
1 parent 675bafe commit d3700aa
Show file tree
Hide file tree
Showing 105 changed files with 1,002 additions and 5,839 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ parserOptions:
rules:
import/no-cycle: off
import/no-extraneous-dependencies: off
# TODO: re-enable once https://github.com/benmosher/eslint-plugin-import/issues/2063 is fixed.
import/newline-after-import: off

settings:
import/core-modules: [test]
10 changes: 6 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 16.x
- name: Install dependencies
run: npm install
- name: Run ESLint
run: npm run eslint
- name: Run Prettier
run: npm run prettier
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [10.x, 12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2-beta
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
package*.json
package*.json
CHANGELOG.md
lib
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# image-js

Advanced image processing and manipulation in JavaScript.

image-js is a full-featured library that can deal with simple image processing
Expand All @@ -16,11 +17,11 @@ boundary rectangle (MBR), particle size and orientation, cell imaging, etc.).
Maintained by <a href="https://www.zakodium.com">Zakodium</a>
</p>

[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

</h3>

## [API Documentation](https://image-js.github.io/image-js/)
Expand Down
7 changes: 4 additions & 3 deletions benchmark/dataFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ for (var i = 0; i < channels; i++) {
}
}


test('Uint8Array', function () {
let newData = new Array(channels);
for (var i = 0; i < channels; i++) {
Expand Down Expand Up @@ -424,7 +423,7 @@ test('Uint8Array original', function () {
let jLeft = x * channels;

for (let i = y; i < y1; i++) {
let j = (i * width * channels) + jLeft;
let j = i * width * channels + jLeft;
let jL = j + xWidth;
for (; j < jL; j++) {
newData[ptr++] = data8[j];
Expand All @@ -441,7 +440,9 @@ function getValue(data, i, j) {
}

function test(name, func) {
func(); func(); func();
func();
func();
func();
let start = process.hrtime();
for (let i = 0; i < ITER; i++) {
func();
Expand Down
1 change: 0 additions & 1 deletion benchmark/erode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const { Image } = require('..');


function getImage() {
const image = new Image(1000, 500, { kind: 'BINARY' });
for (let x = 0; x < image.width; x++) {
Expand Down
42 changes: 22 additions & 20 deletions benchmark/gaussianFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ const suite = new Benchmark.Suite();

const filename = 'cells/cells.jpg';

Image.load(path.join(__dirname, '../test/img', filename)).then(function (img) {
img = img.resize({ factor: 0.25 });
suite
.add('direct', function () {
img.gaussianFilter({ algorithm: 'direct', radius: 17 });
})
.add('fft', function () {
img.gaussianFilter({ algorithm: 'fft', radius: 17 });
})
.add('separable', function () {
img.gaussianFilter({ algorithm: 'separable', radius: 17 });
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
})
.run();
}).catch(console.error);
Image.load(path.join(__dirname, '../test/img', filename))
.then(function (img) {
img = img.resize({ factor: 0.25 });
suite
.add('direct', function () {
img.gaussianFilter({ algorithm: 'direct', radius: 17 });
})
.add('fft', function () {
img.gaussianFilter({ algorithm: 'fft', radius: 17 });
})
.add('separable', function () {
img.gaussianFilter({ algorithm: 'separable', radius: 17 });
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
})
.run();
})
.catch(console.error);
54 changes: 28 additions & 26 deletions benchmark/invert.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,34 @@ let filename = 'cells/cells.jpg';
// filename='ecoli.png';
// filename='cat.jpg';

Image.load(Test.getImage(filename)).then(function (img) {
suite
.add('invert', function () {
img.invert();
})
.add('invertOneLoop', function () {
img.invertOneLoop();
})
/* .add('invertIterator', function () {
Image.load(Test.getImage(filename))
.then(function (img) {
suite
.add('invert', function () {
img.invert();
})
.add('invertOneLoop', function () {
img.invertOneLoop();
})
/* .add('invertIterator', function () {
img.invertIterator();
})
*/
.add('invertApply', function () {
img.invertApply();
})
.add('invertApplyAll', function () {
img.invertApplyAll();
})
.add('invertPixel', function () {
img.invertPixel();
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
})
.run();
}).catch(console.error);
.add('invertApply', function () {
img.invertApply();
})
.add('invertApplyAll', function () {
img.invertApplyAll();
})
.add('invertPixel', function () {
img.invertPixel();
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
})
.run();
})
.catch(console.error);
1 change: 0 additions & 1 deletion benchmark/invertBinaryImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let Test = require('../test/test');

let suite = new Benchmark.Suite();


Image.load(Test.getImage('rgb8.png')).then(function (img) {
let mask = img.split()[0].mask();

Expand Down
4 changes: 1 addition & 3 deletions benchmark/invertFilters/invertApply.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// this method is 50 times SLOWER than invert !!!!!!

export default function invertApply() {


if (this.bitDepth === 1) {
// we simply invert all the integers value
// there could be a small mistake if the number of points
Expand All @@ -18,7 +16,7 @@ export default function invertApply() {
}
} else {
this.checkProcessable('invertApply', {
bitDepth: [8, 16]
bitDepth: [8, 16],
});
this.apply(function (index) {
for (let k = 0; k < this.components; k++) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/invertFilters/invertBinaryLoop.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function invertBinaryLoop() {
this.checkProcessable('invertBinaryLoop', {
bitDepth: [1]
bitDepth: [1],
});

for (let i = 0; i < this.size; i++) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/invertFilters/invertGetSet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function invert() {
this.checkProcessable('invert', {
bitDepth: [1, 8, 16]
bitDepth: [1, 8, 16],
});

if (this.bitDepth === 1) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/invertFilters/invertIterator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function invertIterator() {
this.checkProcessable('invert', {
bitDepth: [1, 8, 16]
bitDepth: [1, 8, 16],
});

if (this.bitDepth === 1) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/invertFilters/invertOneLoop.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function invertOneLoop() {
this.checkProcessable('invertOneLoop', {
bitDepth: [8, 16]
bitDepth: [8, 16],
});

let data = this.data;
Expand Down
4 changes: 1 addition & 3 deletions benchmark/invertFilters/invertPixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

export default function invertPixel() {
this.checkProcessable('invertPixel', {
bitDepth: [8, 16]
bitDepth: [8, 16],
});


for (let x = 0; x < this.width; x++) {
for (let y = 0; y < this.height; y++) {
let value = this.getPixelXY(x, y);
Expand All @@ -18,5 +17,4 @@ export default function invertPixel() {
this.setPixelXY(x, y, value);
}
}

}
Loading

0 comments on commit d3700aa

Please sign in to comment.