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.
Yi Sui (2020). Adjust window level of image using mouse button (https://www.mathworks.com/matlabcentral/fileexchange/38491-adjust-window-level-of-image-using-mouse-button), MATLAB Central File Exchange. Retrieved .
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.
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.
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.
rewrite the code