Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(decode): add colorTransform option #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 16, 2018

Conversation

skogsbaer
Copy link
Contributor

Currently, the cornerstoneWADOImageLoader library uses an internal and outdated copy of jpeg-js (for historical reasons). We want now to use the jpeg-js library directly.

This PR adds support for skipping the color transformation (cornerstoneWADOImageLoader does its own)

We also need support for 16bit JPEGs. The cornerstoneWADOImageLoader has a getData16 function for this purpose (see https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/codecs/jpeg.js). What would be the best way to bring support for 16bit JPEGs to jpeg-js? Just copy get getData16 function?

Stefan Wehr added 2 commits May 16, 2018 08:47
Without this fix, two unequal buffers did not lead to a test failure.
The cornerstoneWADOImageLoader
(https://github.com/cornerstonejs/cornerstoneWADOImageLoader) does its
own color transform, so it needs an option to skip to builtin color
transform.
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution!

lib/decoder.js Outdated
};
if (opts) {
if (typeof opts === 'object') {
opts = Object.assign(defaultOpts, opts);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is failing travis since jpeg-js supports much older versions of node that lack Object.assign

I'm not sure how others feel about continuing support for <4, https://nodesource.com/node-by-numbers seems to suggest 0.10 and 0.12 have about ~2% share by # downloads, and supposedly many systems running 0.10/0.12 are not downloading fresh copies.

since we only have 2 options, how do you feel about something explicit?

opts = {
  useTArray: typeof opts.useTArray === 'undefined' ? defaultOpts.useTArray : opts.useTArray,
  colorTransform: typeof opts.colorTransform === 'undefined' ? defaultOpts.colorTransform : opts.colorTransform,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I updated to PR.

Any ideas for how to support 16bit JPEGs?

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need support for 16bit JPEGs. The cornerstoneWADOImageLoader has a getData16 function for this purpose (see https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/codecs/jpeg.js). What would be the best way to bring support for 16bit JPEGs to jpeg-js? Just copy get getData16 function?

Hmm, yeah probably best to just bring in the separate function and keep it a clearly separate flow for now. Let's do that in a different PR though this one looks GTG from my perspective % nit :)

lib/decoder.js Outdated
defaultOpts.useTArray : opts.useTArray),
colorTransform: (typeof opts.colorTransform === 'undefined' ?
defaultOpts.colorTransform : opts.colorTransform)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@patrickhulce patrickhulce changed the title Additions required for cornerstoneWADOImageLoader feat(decode): add colorTransform option May 16, 2018
@patrickhulce patrickhulce merged commit 79c4c7e into jpeg-js:master May 16, 2018
@patrickhulce
Copy link
Collaborator

thanks @skogsbaer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants