Hi Everyone! I have been looking for a bit and can't find a solution for part of my workflow yet. I would like to define several 3x3 pixel ROIs on an image in a similar way to the specify ROI plugin under Edit->selection, but in a more high throughput manner. I am using find maxima to identify many foci of interest in a time series stack I am using for stepwise photobleaching. I am using the macro at the end of this post to export the xy coordinates of these points to the data table.
I do not want to enter each ROI by hand if I don't need to, since there will be quite a few of them. Can anyone conceive of a way to use these xy coordinates, perhaps from an exported .csv file, to specify several ROI at once with set dimensions i.e.. 3x3, 5x5? I guess a brute force approach would get this done in only a couple hours by hand, but I figured it is worth asking for some assistance. Thank you for any ideas! Daniel --- After finding maxima I export the XY coordinates from each point with this macro. I would like to use these coordinates to place each ROI (about 50-100 per image series). getSelectionCoordinates(xCoordinates, yCoordinates); for(i=0; i<lengthOf(xCoordinates); i++) { setResult("X", i, xCoordinates[i]); setResult("Y", i, yCoordinates[i]); } updateResults(); |
Only to understand better, you need something that permits you to firstly select some "Maxima/Foci points" and then create a square ROI of user definied dimension?
If yes, I have some plugins that do something similar so maybe I can help you. Have a nice day, Emanuele
Image Analyst @Ifom-IEO research campus -MI-
|
This post was updated on .
Hi Emanuele,
Yes, that is what I am looking to do. I have already designed a macro for selecting maxima using find maxima and exporting xy coordinates with the process above. So I only really need the defined dimensions ROI step, but if you have something that does all this in a different way, all at once, I'm sure that would help. Thank you, Daniel |
Hi again,
I have found a thread that does essentially what I want to do at the link below. Is this something similar to what you would suggest? http://imagej.1557.x6.nabble.com/Add-ROIs-from-a-list-of-coordinates-in-a-CSV-file-td5009300.html I run into a problem in the "run(specify..." line of the code referenced below. I get an error saying numerical value is expected. Here is a screen shot. Does this mean the x and Y variables are not being properly written from my cvs file? Thank you for your help! Dan Here is the actual code as I have edited it: // Import it into a results table. run("Results... ", "open=/Users/Danny/Desktop/roi/test.csv"); for (i = 0; i < nResults; i++) { // You may need to change the "frame", etc strings to match your csv file. slice = getResult("f", i); x = getResult("x", i); y = getResult("y", i); // Using square ROI of size 10x10 pixels centered around your coordinate. run("Specify...", "width=10 height=10 x=&x y=&y slice=&slice centered"); // Add to the ROI manager. roiManager("Add"); } |
The X and Y in my CSV file were capitalized and the code was all lowercase. Once I fixed this the macro ran well. I guess my issues are solved. A little more creative searching terms brought me to the answer. Guess I should have been more persistent before posting. Thanks for the help anyhow!
-Daniel |
In reply to this post by dparrell
It could be that the data you read from your cvs file is internally
represented as a string rather than a number. Try using: *parseInt(string) *(see ImageJ Macro commands) Hope this helps, Volko On 18/09/2015 23:05, dparrell wrote: > Hi again, > I have found a thread that does essentially what I want to do at the link > below. Is this something similar to what you would suggest? > http://imagej.1557.x6.nabble.com/Add-ROIs-from-a-list-of-coordinates-in-a-CSV-file-td5009300.html > > I run into a problem in the "run(specify..." line of the code referenced > below. I get an error saying numerical value is expected. Here is a screen > shot. Does this mean the x and Y variables are not being properly written > from my cvs file? Thank you for your help! > Dan > > <http://imagej.1557.x6.nabble.com/file/n5014368/Screen_Shot_2015-09-18_at_6.png> > > Here is the actual code as I have edited it: > > // Import it into a results table. > run("Results... ", "open=/Users/Danny/Desktop/roi/test.csv"); > > for (i = 0; i < nResults; i++) > { > // You may need to change the "frame", etc strings to match your csv > file. > slice = getResult("f", i); > x = getResult("x", i); > y = getResult("y", i); > > // Using square ROI of size 10x10 pixels centered around your > coordinate. > run("Specify...", "width=10 height=10 x=&x y=&y slice=&slice > centered"); > > // Add to the ROI manager. > roiManager("Add"); > } > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Specify-Multiple-ROI-W-xy-coordinates-tp5014356p5014368.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > 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 |