cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

Add Step Scaling to reduce Artifacts when scaled

Open kofifus opened this issue 8 years ago • 11 comments

we are having an issue where some big images have artifacts when scaled down.

This is a general canvas issue and a common solution is step scaling see: https://jsfiddle.net/AbdiasSoftware/M4cTx/

Is there a way to make cornerstone step scale images ?

thanks!

kofifus avatar Apr 20 '17 02:04 kofifus

Hello,

There is no way to make Cornerstone do this at the moment. It sounds like an interesting technique but it might have a significant effect on performance.

swederik avatar Apr 20 '17 06:04 swederik

it will mean keeping an original copy of the image and on each scaling creating scaled copy to work with (As in the fiddle), zooming will definitely end up slower (but maybe ok) but we get the improved image quality plus I imagine window leveling will become very fast as the image is actually much smaller.

On some images (ie 6 mega pixels CR with a grid in front of the plate), the different in quality is quite dramatic.

kofifus avatar Apr 20 '17 07:04 kofifus

Yeah. This technique is usually referred as mip mapping. Basically, you need to apply a low pass filter when re-sampling in accordance with the Nyquist sampling theorem in order to avoid aliasing. This is the functional equivalent to interpolation for downscaling.

With that said, implementing may be a nice to have, but reduce performance at startup (to build the pyramid) and would take an additional 1/3 memory. The patterns that produce aliasing artefacts are not all that common in medical imaging and they should be examined as close to full resolution for diagnostic purposes.

Once the pyramid computed, it could indeed increase the performance of W/L when zoomed out.

It would be nice if the browser could just apply it by itself just like it does interpolation...

jpambrun avatar Apr 20 '17 12:04 jpambrun

@kofifus, Do you have a DICOM file that shows these artefacts that you could share by chance?

jpambrun avatar Apr 21 '17 15:04 jpambrun

Nvm, I created a sample : aliasing1000x1000.dcm.zip

Also, a video of the issue: alias.mp4.zip

jpambrun avatar Apr 21 '17 15:04 jpambrun

ok great, I will try to also get my dicom file to you.

so is there any ideas about solving this with cornerstone ?

thx!

kofifus avatar Apr 23 '17 22:04 kofifus

It would be nice if you can get any real case showing this issue. I'm not convinced, given the tradeoffs, that this would add significant clinical value.

On Sun, Apr 23, 2017, 6:58 PM Kofifus [email protected] wrote:

ok great, I will try to also get my dicom file to you.

so is there any ideas about solving this with cornerstone ?

thx!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/chafey/cornerstone/issues/114#issuecomment-296495126, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr2MLxQG4ZP_gQ8ZajUtTRsGa_-Whq-ks5ry9eTgaJpZM4NCeyr .

jpambrun avatar Apr 23 '17 23:04 jpambrun

Here is a sample image: https://www.dropbox.com/s/7gxsqajpovnij0a/Cornerstone_aliasing.zip?dl=0

You will see the artifacts as you zoom in and out.

The image was taken with a grid in front of the plate (I can find out the name of the procedure).

Thanks!

kofifus avatar Apr 24 '17 04:04 kofifus

I could see the artefacts between 30% and 40% magnification.

I suppose mip mapping could be added behind a flag as it increases resource requirements for a limited return.

Unfortunately, I don't think this is on anybody's road map... Contributions are welcomed.

JF

On Mon, Apr 24, 2017 at 12:19 AM Kofifus [email protected] wrote:

Here is a sample image: https://www.dropbox.com/s/7gxsqajpovnij0a/Cornerstone_aliasing.zip?dl=0

You will see the artifacts as you zoom in and out.

The image was taken with a grid in front of the plate (I can find out the name of the procedure).

Thanks!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/chafey/cornerstone/issues/114#issuecomment-296521473, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr2MHWVbhF-9JMWdi7A4kUYDLVHV0fAks5rzCLIgaJpZM4NCeyr .

jpambrun avatar Apr 24 '17 12:04 jpambrun

FWIW, most viewers do not worry about this use case as images must be displayed at full resolution (or higher) for interpretation.

On Mon, Apr 24, 2017 at 5:36 AM, Jean Francois Pambrun < [email protected]> wrote:

I could see the artefacts between 30% and 40% magnification.

I suppose mip mapping could be added behind a flag as it increases resource requirements for a limited return.

Unfortunately, I don't think this is on anybody's road map... Contributions are welcomed.

JF

On Mon, Apr 24, 2017 at 12:19 AM Kofifus [email protected] wrote:

Here is a sample image: https://www.dropbox.com/s/7gxsqajpovnij0a/Cornerstone_aliasing.zip?dl=0

You will see the artifacts as you zoom in and out.

The image was taken with a grid in front of the plate (I can find out the name of the procedure).

Thanks!

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub <https://github.com/chafey/cornerstone/issues/114#issuecomment-296521473 , or mute the thread <https://github.com/notifications/unsubscribe-auth/AAr2MHWVbhF- 9JMWdi7A4kUYDLVHV0fAks5rzCLIgaJpZM4NCeyr> .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chafey/cornerstone/issues/114#issuecomment-296650852, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNb2mfe9MTa0lTSM9GMIDIXjOf82h87ks5rzJdmgaJpZM4NCeyr .

chafey avatar Apr 24 '17 13:04 chafey

As already mentioned here, I suggest the step scaling approach, which involves keeping an original copy of the image and creating scaled copies to work with. This technique is usually referred to as mip mapping, and would require additional memory and potentially reduce performance at startup, but could improve image quality and potentially increase performance for certain functions such as window leveling when zoomed out. It seems that this feature is not currently on anyone's roadmap for development, but we can try to work around.

FMCalisto avatar Apr 15 '23 16:04 FMCalisto