Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PantelisGeorgiadis committed Nov 4, 2023
1 parent 0615244 commit e638bd0
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 56 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import log = require('loglevel');
import log from 'loglevel';

declare namespace StandardColorPalette {
const Grayscale: number;
Expand Down
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcmjs-imaging",
"version": "0.1.19",
"version": "0.1.20",
"description": "DICOM image and overlay rendering for Node.js and browser using dcmjs",
"main": "build/dcmjs-imaging.min.js",
"module": "build/dcmjs-imaging.min.js",
Expand Down Expand Up @@ -44,7 +44,7 @@
"funding": "https://github.com/PantelisGeorgiadis/dcmjs-imaging?sponsor=1",
"homepage": "https://github.com/PantelisGeorgiadis/dcmjs-imaging",
"dependencies": {
"dcmjs": "^0.29.10",
"dcmjs": "^0.29.12",
"loglevel": "^1.8.1",
"loglevel-plugin-prefix": "^0.8.4"
},
Expand All @@ -57,7 +57,7 @@
"clang-format": "^1.8.0",
"copy-webpack-plugin": "^11.0.0",
"docdash": "^2.0.2",
"eslint": "^8.52.0",
"eslint": "^8.53.0",
"jsdoc": "^4.0.2",
"karma": "^6.4.2",
"karma-browserify": "^8.1.0",
Expand All @@ -71,7 +71,7 @@
"pako": "^2.1.0",
"prettier": "^3.0.3",
"shx": "^0.3.4",
"sinon": "^17.0.0",
"sinon": "^17.0.1",
"terser-webpack-plugin": "^5.3.9",
"ts-node": "^10.9.1",
"tsd": "^0.29.0",
Expand Down
26 changes: 13 additions & 13 deletions src/Pixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,39 +773,39 @@ class PixelPipeline {
throw new Error(`Unsupported pixel data value for bits stored: ${pixel.getBitsStored()}`);
}
} else if (
photometricInterpretation == PhotometricInterpretation.Rgb ||
photometricInterpretation == PhotometricInterpretation.YbrFull ||
photometricInterpretation == PhotometricInterpretation.YbrFull422 ||
photometricInterpretation == PhotometricInterpretation.YbrPartial422 ||
photometricInterpretation == PhotometricInterpretation.Cmyk ||
photometricInterpretation == PhotometricInterpretation.Argb ||
photometricInterpretation == PhotometricInterpretation.Hsv
photometricInterpretation === PhotometricInterpretation.Rgb ||
photometricInterpretation === PhotometricInterpretation.YbrFull ||
photometricInterpretation === PhotometricInterpretation.YbrFull422 ||
photometricInterpretation === PhotometricInterpretation.YbrPartial422 ||
photometricInterpretation === PhotometricInterpretation.Cmyk ||
photometricInterpretation === PhotometricInterpretation.Argb ||
photometricInterpretation === PhotometricInterpretation.Hsv
) {
let pixels = pixel.getFrameDataU8(frame);
if (pixel.getPlanarConfiguration() === PlanarConfiguration.Planar) {
pixels = PixelConverter.planarToInterleaved24(pixels);
}
if (photometricInterpretation === PhotometricInterpretation.YbrFull) {
pixels = PixelConverter.ybrFullToRgb(pixels);
} else if (photometricInterpretation == PhotometricInterpretation.YbrFull422) {
} else if (photometricInterpretation === PhotometricInterpretation.YbrFull422) {
pixels = PixelConverter.ybrFull422ToRgb(pixels, pixel.getWidth());
} else if (photometricInterpretation == PhotometricInterpretation.YbrPartial422) {
} else if (photometricInterpretation === PhotometricInterpretation.YbrPartial422) {
pixels = PixelConverter.ybrPartial422ToRgb(pixels, pixel.getWidth());
} else if (photometricInterpretation == PhotometricInterpretation.Cmyk) {
} else if (photometricInterpretation === PhotometricInterpretation.Cmyk) {
if (pixel.getSamplesPerPixel() !== 4) {
throw new Error(
`Unsupported samples per pixel value for CMYK: ${pixel.getSamplesPerPixel()}`
);
}
pixels = PixelConverter.cmykToRgb(pixels, pixel.getWidth(), pixel.getHeight());
} else if (photometricInterpretation == PhotometricInterpretation.Argb) {
} else if (photometricInterpretation === PhotometricInterpretation.Argb) {
if (pixel.getSamplesPerPixel() !== 4) {
throw new Error(
`Unsupported samples per pixel value for ARGB: ${pixel.getSamplesPerPixel()}`
);
}
pixels = PixelConverter.argbToRgb(pixels, pixel.getWidth(), pixel.getHeight());
} else if (photometricInterpretation == PhotometricInterpretation.Hsv) {
} else if (photometricInterpretation === PhotometricInterpretation.Hsv) {
pixels = PixelConverter.hsvToRgb(pixels);
}

Expand Down Expand Up @@ -1262,7 +1262,7 @@ class PixelConverter {
);
output[p++] = this._truncAndClamp(1.1644 * (y2 - 16) + 2.0173 * (cb - 128) + 0.5, 0x00, 0xff);

if (++col == width) {
if (++col === width) {
col = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = '0.1.19';
module.exports = '0.1.20';
6 changes: 6 additions & 0 deletions test/ColorPalette.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ describe('ColorPalette', () => {
ColorPalette.getColorPalettePaletteColor(pixel);
}).to.throw();
});

it('should throw for non existent standard color palette', () => {
expect(() => {
ColorPalette.getColorPaletteStandard(-1);
}).to.throw();
});
});

0 comments on commit e638bd0

Please sign in to comment.