Hi,I have to analyse the grey level with a histogram for a lot of
images.using macro helps, but I lose a lot of time adapting the name to the opened image that is currently in the code.selectWindow("vlcsnap-00024.tiff");run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, 127, 70, 25);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(159, 282, 125, 36);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, 453, 73, 52);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(393, 246, 113, 56);run("Histogram");selectWindow("vlcsnap-00024.tiff");How can I automate the select window to the opened image?thank you -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
One thing that might help is if you manipulated a single common image file name. Then manipulate.
You could rename your file to a common name: rename("ImageROIs");// name of file is ImageROIs selectWindow("ImageROIs");run("Histogram"); selectWindow("ImageROIs");makeRectangle(232, 127, 70,25);run("Histogram"); selectWindow("ImageROIs");makeRectangle(159, 282, 125,25);run("Histogram"); etc. Ethan Cohen -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Mrtin_11
Hi Martin,
Unless I am missing something this should be easy. You can use getTitle() to get the name of your image, or getImageID() top get the unique identifier of the currently selected image. You can then use this information as a variable in your code, e.g.: curImage = getTitle(); selectWindow(curImage); run("Histogram"); selectWindow(curImage); makeRectangle(232,127,70,25); run("Histogram"); etc. See macro documentation for information on macro commands. I hope this helps. Volko To: [hidden email] <[hidden email]> Subject: Automate "name" in selectWindow("name"); Hi,I have to analyse the grey level with a histogram for a lot of images.using macro helps, but I lose a lot of time adapting the name to the opened image that is currently in the code.selectWindow("vlcsnap-00024.tiff");run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, 127, 70, 25);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(159, 282, 125, 36);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, 453, 73, 52);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(393, 246, 113, 56);run("Histogram");selectWindow("vlcsnap-00024.tiff");How can I automate the select window to the opened image?thank you -- Sent from: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2F&data=02%7C01%7Cvs64%40leicester.ac.uk%7C1e291d3aacd341824a0708d7cd10c680%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637203344251338226&sdata=UEy13OfV3ymEXVnFWUfpamJLeq9KdYDMSVjwzXCnITw%3D&reserved=0 -- ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Cvs64%40leicester.ac.uk%7C1e291d3aacd341824a0708d7cd10c680%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637203344251338226&sdata=GkOIgBMc4ORieqgbYwtU8AEEQzqi%2Bl6Aq%2Bhji9je23s%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi,
> You can use getTitle() to get the name of your image, or getImageID() > top get the unique identifier of the currently selected image. In general, I prefer using image IDs over image titles. This avoids potential problems when there are multiple windows with the same title. While ImageJ takes steps to avoid this happening in common cases, it is still possible. But each image is always given a unique ID value. First, get the ID of the active image using "id = getImageID()". Then when you need to reactivate that image window, call "selectImage(id)". Regards, Curtis -- Curtis Rueden Software architect, LOCI/Eliceiri lab - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Have you tried the Image.sc Forum? https://forum.image.sc/ On Sat, Mar 21, 2020 at 2:02 AM Straub, Volko A. (Dr.) <[hidden email]> wrote: > Hi Martin, > > Unless I am missing something this should be easy. You can use getTitle() > to get the name of your image, or getImageID() top get the unique > identifier of the currently selected image. You can then use this > information as a variable in your code, e.g.: > > curImage = getTitle(); > selectWindow(curImage); > run("Histogram"); > selectWindow(curImage); > makeRectangle(232,127,70,25); > run("Histogram"); > etc. > > See macro documentation for information on macro commands. > I hope this helps. > Volko > > > > > To: [hidden email] <[hidden email]> > Subject: Automate "name" in selectWindow("name"); > > Hi,I have to analyse the grey level with a histogram for a lot of > images.using macro helps, but I lose a lot of time adapting the name to the > opened image that is currently in the > > code.selectWindow("vlcsnap-00024.tiff");run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, > 127, 70, > 25);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(159, > 282, 125, > 36);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(232, > 453, 73, > 52);run("Histogram");selectWindow("vlcsnap-00024.tiff");makeRectangle(393, > 246, 113, 56);run("Histogram");selectWindow("vlcsnap-00024.tiff");How can I > automate the select window to the opened image?thank you > > > > -- > Sent from: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2F&data=02%7C01%7Cvs64%40leicester.ac.uk%7C1e291d3aacd341824a0708d7cd10c680%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637203344251338226&sdata=UEy13OfV3ymEXVnFWUfpamJLeq9KdYDMSVjwzXCnITw%3D&reserved=0 > > -- > ImageJ mailing list: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Cvs64%40leicester.ac.uk%7C1e291d3aacd341824a0708d7cd10c680%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637203344251338226&sdata=GkOIgBMc4ORieqgbYwtU8AEEQzqi%2Bl6Aq%2Bhji9je23s%3D&reserved=0 > > -- > 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 |