File Exchange

image thumbnail

Adjust window level of image using mouse button

version (1.42 KB) by Yi Sui
You can adjust the window level using mouse


Updated 12 Jun 2013

View Version History

View License

You can adjust the window level by mouse
1 clicking and holding the RIGHT mouse button and moving: adjust current image

2 mid-button or shift+left button: adjust all images in current figure.

Cite As

Yi Sui (2021). Adjust window level of image using mouse button (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Liz Tunnicliffe

Brent Foster

José Rosario

It works very well!


The updated version of your code is much nicer - thanks!
The local variables are now stored in the figure's UserData, wuch that it can be applied to multiple figures without confusions.

I still see a problem in the missing documentation. While the code does not contain a help section, the only specification is found here in the FEX: "adjust the window level". But what exactly is adjusted?

Now I think, that this function is probably useful. Only the lack of a documentation reduces the usability substantially. A small help sections with a H1-line, which decribes the inputs and the applied procedure clearly, would be enough.

Yi Sui

Thank you for your long comments. Should you ever try the code, you would know it is useful, usable and does work for more than 1 figure at the same time.

uc3m Cristobal

Can you explain how the function works?


This function does not contain any documentation. If a FEX user downloads it, even the short single line of the description here is not available anymore.
On the other hand the purpose of the function is not getting clear when the source code is read also. There are some deprecated large strings used as callbacks - function handles would be smarter, safer and more clear.
The code contains a magic string: "
randstr = 'oE_3rT4x_'". Magic strings are a bad programming pattern. In addition I wonder, if this function will run correctly, if it is applied to more than 1 figure at the same time.
My conclusion: Not usable. I cannot decide if it is useful. No docs or comments. Bad programming style.

Please brush up the function to make it more useful and usable. Then I will rate this again.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!