Is it possible to read the movement of the scroll wheel on a mouse in a macro, to change a threshold or something similar.
I know that Image/adjust/threshold does this perfectly but the requirement is to keep the user ignorant of the actual number they have selected while hiding the histogram. In part to follow how users make use of the histogram when setting thresholds. I have looked at getCursorLoc but cannot see how to read the scroll wheel. Quite separately, could the thresholding window be altered with (i) a log option, it is difficult to spot the existence of low frequency intensities which become noticeable in Analyse/Histogram and (ii) increase the height of histogram in threshold for the same reason. Jeremy Adler Uppsala U När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Jeremy,
The macro method getCursorLoc(x, y, z, modifiers) indicates with x and y the position of the mouse on the picture and with z the slice position (see "z.setValue(imp.getCurrentSlice()-1);" within the ij.macro.Functions.jave file) which in the case of a stack picture can be modified with the mouse wheel. Thus in order to have a handle to the MouseWheelListener in macros, the addition of a new method is needed or alternatively a modification of the z output of the getCursorLoc(x, y, z, modifiers) macro method. As for the MouseWheelListener improvement within the Image>adjust>threshold tool, I had made this improvement a couple of years ago (within the Threshold Java code) and submitted this change to Wayne who validated it. For the "log option" of your (i) request, the log feature you are looking for could simply be obtained with Analyze>Histogram (or Ctrl+H) and then from the plot window you can click the List button to get the histogram values. As for your (ii) request, this would more or less mean to add the ImageJ plots (now very powerful) features where you can modify the x and y scaling and range within the basic histogram plot. I'm not sure whether this could easily be done on one side and validated on the other. More than probably Michael will answer on this one since he has probably the best overview of what could be done with the plot classes. Have a nice end of week-end, Philippe Philippe CARL Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 42 89 ----- Mail original ----- De: "Jeremy Adler" <[hidden email]> À: "imagej" <[hidden email]> Envoyé: Dimanche 24 Mai 2020 10:46:50 Objet: reading the scroll wheel on a mouse Is it possible to read the movement of the scroll wheel on a mouse in a macro, to change a threshold or something similar. I know that Image/adjust/threshold does this perfectly but the requirement is to keep the user ignorant of the actual number they have selected while hiding the histogram. In part to follow how users make use of the histogram when setting thresholds. I have looked at getCursorLoc but cannot see how to read the scroll wheel. Quite separately, could the thresholding window be altered with (i) a log option, it is difficult to spot the existence of low frequency intensities which become noticeable in Analyse/Histogram and (ii) increase the height of histogram in threshold for the same reason. Jeremy Adler Uppsala U När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Jeremy Adler
Hi Jeremy,
java uses a 'call-back' (listener) mechanism for events like that of a scroll wheel rotated, but the ImageJ macro language is not designed for callback. Also, if you want to do something like the 'Threshold' panel without that panel being in the foreground, note the following: When an image is in the foreground, the scroll wheel already has some functions like panning at high magnification and zooming with the shift key pressed. Also, getCursorLoc(x, y, z, modifiers) is with respect to a given image, and the cursor position is well a defined entity for that image (and supplied by the mouseMoved event). There is no equivalent for mouse wheel events, they only contain how much the wheel position has *changed*; there is nothing like a 'mouse wheel position' as such. So the best that comes into my mind for your purposes is taking the source code of the ThresholdAdjuster and converting it into a plugin, modifying it according to your needs. I guess that modifying the first line from package ij.plugin.frame; to import ij.plugin.frame.*; would be enough to convert it into an external plugin that can be compiled with 'Compile&Run' in ImageJ1; rename to something with an underscore (e.g. Adjust_Threshold) to make it appear in the Plugins menu and callable from a macro. (Then you also have to modify the name in the 'public class' statement and the constructor 'public ThresholdAdjuster()' accordingly). -- Concerning the histogram of the ThresholdAdjuster: I think that one can see whether there are any pixels of a given value at all (it seems that even a single pixel with a given value already appears above the baseline). With the histogram being painted according to the LUT (which is a very nice feature), it would be difficult to add a second log-scaled histogram in a nice way (as with the 'log' button of normal Histograms), without confusing the user. One could think about a right-click contex menu, but that would require someone to do the programming... Michael ________________________________________________________________ On 24.05.20 10:46, Jeremy Adler wrote: > Is it possible to read the movement of the scroll wheel on a mouse in a macro, to change a threshold or something similar. > > > I know that Image/adjust/threshold does this perfectly but the requirement is to keep the user ignorant of the actual number they have selected while hiding the histogram. In part to follow how users make use of the histogram when setting thresholds. > > I have looked at getCursorLoc but cannot see how to read the scroll wheel. > > > > Quite separately, could the thresholding window be altered with (i) a log option, it is difficult to spot the existence of low frequency intensities which become noticeable in Analyse/Histogram and (ii) increase the height of histogram in threshold for the same reason. > > > Jeremy Adler > > Uppsala U > > > > > > > > > > > > > När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ > > E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |