dear all
i woullike to unsubscribe what shall i do? -- /max/ |
NO, NO, you CANNOT, you are condemned to stay with us
forever.................. Honestly, I still have the text of my subscription confirmation, it says there: You may leave the list at any time by sending a "SIGNOFF IMAGEJ" command to [hidden email]. Bye, bye!! M S <signamax@GMAIL. An: [hidden email] COM> Kopie: (Blindkopie: Joachim Wesner/DEWET/LMSCentral/Leica) Gesendet von: Thema: unsubscribe ImageJ Interest Group <[hidden email] .GOV> 02.05.2006 15:05 Bitte antworten an ImageJ Interest Group dear all i woullike to unsubscribe what shall i do? -- /max/ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Is it possible to create a circular ROI, then create a line that divides it into two and calculate measurements from each division?
Please let me know, thank you so much! ~Katherine |
> Is it possible to create a circular ROI, then create a line that divides it
> into two and calculate measurements from each division? > Please let me know, thank you so much! Katherine, I don¹t know if anyone has developed a more elegant solution, but you could do something like the macro below as a workaround. macro "demo hemispheres [f1]" { run("Blobs (25K)"); makeOval(23, 22, 200, 200); run("Clear Outside"); run("Duplicate...", "title=circle"); w = getWidth(); h = getHeight(); makeRectangle(0, 0, w, h/2); setThreshold(0, 89); run("Measure"); makeRectangle(0, h/2, w, h); setThreshold(89, 255); run("Measure"); selectWindow("Results"); } I hope this helps. Chris Coulon The GAIA Group Global Automated Image Analysis http://www.gaiag.net [hidden email] We welcome image analysis problems in all fields. Christopher Coulon, Ph.D., Founder |
In reply to this post by Katherine Huang
Katherine Huang wrote:
> Is it possible to create a circular ROI, then create a line that divides it into two and calculate measurements from each division? > Please let me know, thank you so much! > ~Katherine > See: http://rsb.info.nih.gov/ij/macros/HalfCircleSelections.txt I've also adapted these to measure circle quadrants, if you're interested Bo |
Exactly how do I incorporate code into the imagej? (sorry I'm really new).
Thanks! ~Katherine ----- Original Message ----- From: Bo de Lange To: [hidden email] Sent: Tuesday, May 02, 2006 11:57 PM Subject: Re: ROI help Katherine Huang wrote: > Is it possible to create a circular ROI, then create a line that divides it into two and calculate measurements from each division? > Please let me know, thank you so much! > ~Katherine > See: http://rsb.info.nih.gov/ij/macros/HalfCircleSelections.txt I've also adapted these to measure circle quadrants, if you're interested Bo |
Hi Katherine,
There is a lot to take in when starting with ImageJ, but once you get the hang of how macro's are recorded and run, it not that difficult. Firstly, there is lots useful documentation on all aspects of ImageJ use on the website. E.g. from http://rsb.info.nih.gov/ij/developer/macro/macros.html : "There are more than 90 example macros <http://rsb.info.nih.gov/ij/macros/> on the ImageJ Web site. To try one of the examples, download it, open it using /File/Open/, and run it using the built in text editor's /File/Run Macro/ command (ctrl-R). Most of the example macros are also available in the macros folder, which is inside the ImageJ folder." Briefly: download the macro (textfile), open it in ImageJ using file/open and run it by pressing Ctrl-R. However, if you plan to use a certain macro regularly, you may also copy the whole text and paste it in the StartupMacros.txt file inside your macros folder inside your ImageJ folder. When you restart ImageJ it will then load automatically. You can then run it from the Plugins menu/Macros or by pressing a single shortcut key that you have assigned to it. That's done by adding a shortcut key in square brackets in the macro name as below. Try this then. Save the text below as a text file (.txt extension). Open ImageJ. Open the textfile. Open an image. Draw a circular selection with the elliptical selections tool. Press r. You now have a selection of the right half of the original ellips. Pressing m will then measure it (whatever you have ticked in the Analyze/Set Measurements window). macro "Make right half circle [r]" { if (selectionType!=1) exit("Elliptical selection required"); getBoundingRect(x, y, width, height); midx = x + width/2; getSelectionCoordinates(sx, sy); for (i=0; i<sx.length; i++) { if (sx[i]<midx) sx[i] = midx; } makeSelection(3, sx, sy); } Good luck, Bo Katherine Huang wrote: > Exactly how do I incorporate code into the imagej? (sorry I'm really new). > Thanks! > ~Katherine > ----- Original Message ----- > From: Bo de Lange > To: [hidden email] > Sent: Tuesday, May 02, 2006 11:57 PM > Subject: Re: ROI help > > > Katherine Huang wrote: > > Is it possible to create a circular ROI, then create a line that divides it into two and calculate measurements from each division? > > Please let me know, thank you so much! > > ~Katherine > > > See: http://rsb.info.nih.gov/ij/macros/HalfCircleSelections.txt > I've also adapted these to measure circle quadrants, if you're interested > > Bo > -- R.P.J. de Lange, PhD Rudolf Magnus Institute of Neurosciences P.O. box 80040 3508 TA Utrecht The Netherlands visiting address: Stratenum, room 4.241 Universiteitsweg 100 3584 CG Utrecht tel: +31-30-253 8924 +31-30-253 8837 (lab) fax: +31-30-253 9032 |
Hi there,
some time ago there was the question about generating a new ROI from a given binary image. As ImageJ seems to support "multi-connected" (with holes in it etc.) free-hand ROIs, that also can be read back as bitmaps, this task seems to be pretty easy, but it is surprisingly not implemented (yet) and seems to be difficult to replicate with a macro, the solutions that were suggested IMHO are very clumsy (i.e. using the wand tool etc.). As I now myself could really need such a conversion, I would be happy to write that plugin. I have to say I have not yet browsed thoroughly through that part of the sources, I would like to ask some preliminary questions: How is such a complex freehand ROI stored inside ImageJ? Is the reason that the conversion is complicated that the selection is actually only stored as the circumference (i.e. the yellow line) and the bitmap is only created when asked for by some procedure like "winding rule" or similar? This could be the case, as I noted that strangely the built-in "contains(ix, iy)" method is WAY slower than a simple replacement (at least on multi-part free-hand ROIs): When I use the following quck hack instead (not very OO, sorry,) // Do this only once somewhere at the start of the run() method Roi roi = imp.getRoi(); byte rMask[] = null; Rectangle rRect = null; if (roi != null) { ImageProcessor ipm = roi.getMask(); if (ipm != null) { rMask = (byte[])ipm.getPixels(); rRect = roi.getBounds(); } } . . . for (int iy = ..................) { for (int ix = ..................) { if (myContains(ix, iy, rMask, rRect)) { } } } boolean myContains(int ix, int iy, byte[] mask, Rectangle rect) { if (mask == null) return true; if (!rect.contains(ix, iy)) return false; return (mask[(iy-rect.y)*rect.width+(ix-rect.x)] != 0); } it is MUCH faster on complex ROIs!! Is this because the built-in contains() recreates the bitmap from the "yellow line" any time it is called? Joachim Wesner ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Hi,
On Thu, 4 May 2006, Joachim Wesner wrote: > some time ago there was the question about generating a new ROI from a > given binary image. As ImageJ seems to support "multi-connected" (with > holes in it etc.) free-hand ROIs, that also can be read back as bitmaps, > this task seems to be pretty easy, but it is surprisingly not > implemented (yet) Wasn't the conclusion that threshold is doing the job? Ciao, Dscho |
In reply to this post by Joachim Wesner
> some time ago there was the question about generating a new
> ROI from a given binary image. As ImageJ seems to support > "multi-connected" (with holes in it etc.) free-hand ROIs, > that also can be read back as bitmaps, this task seems to > be pretty easy, but it is surprisingly not implemented (yet) > and seems to be difficult to replicate with a macro, > the solutions that were suggested IMHO are very > clumsy (i.e. using the wand tool etc.). As I now myself > could really need such a conversion, > I would be happy to write that plugin. There is an example macro at http://rsb.info.nih.gov/ij/macros/ConvertMaskToCompositeROI.txt that converts a binary image to a composite ROI, but it is very slow. If what you want to do is measure using a mask then use the "Redirect To:" feature of the Measure command. Here is an example: requires("1.37e"); run("Blobs (25K)"); newImage("mask", "8-bit black", getWidth, getHeight, 1); setColor(255); fillOval(40, 40, 50, 50); fillOval(140, 140, 50, 50); run("Set Measurements...", "area mean redirect=blobs.gif decimal=3"); selectWindow("mask"); run("Measure"); The mask must be named "mask" and you have to upgrade to ImageJ 1.37e, which is due later this week. > I have to say I have not yet browsed thoroughly through that > part of the sources, I would like to ask some preliminary questions: > > How is such a complex freehand ROI stored inside ImageJ? It is stored as a ShapeRoi (ij.gui.ShapeRoi.java) object, and ShapeRoi is implemented using the java.awt.Shape interface. > Is the reason that > the conversion is complicated that the selection is actually > only stored as the circumference (i.e. the yellow line) > and the bitmap is only created when asked for by > some procedure like "winding rule" or similar? A Shape is a path made up of segments. The segments can be straight lines, quadratic curves and cubic curves. You can create a bitmap mask from a ShapeRoi by calling its getMask() method, which uses the Graphics2D fill() method. I do not know of an easy way to create a Shape from a bitmap. > This could be the case, as I noted that strangely the built-in > "contains(ix, iy)" method is WAY slower than a simple replacement > (at least on multi-part free-hand ROIs): The ShapeRoi contains() method simply calls the Shape interface contains() method. It would be much faster (after the first call) if it created a mask and tested to see if the corresponding mask byte was zero or not, but this would require a lot more memory. -wayne |
In reply to this post by dscho
Hi,
either I'm totally off here or the true nature of the problem is difficult to grasp, what I want is to create a ROI *from* a thresholded (that´s what I meant with binary) image that can be applied to *another* or future image. In my case it´s amplitude and phase images but in a more common application it could be say fluorescent images where in one "color channel" I apply a threshold to identify the areas where somethings interesting is located and look at *another* color channel image (in the same places, using that ROI I just created) what the intensity of a certain marker there is, count particles, etc etc. If one thinks of ROI as being a simple bitmap the conversion should be easy, yet, as Wayne Rasband explained, it seems that actually it´s only the boundary that is stored. So ROI creation from a composite ROI would mean locating all the boundaries in the binary image and repeatedly applying a "wand" to recreate all "yellow boundary lines". JW Johannes Schindelin An: [hidden email] <Johannes.Schinde Kopie: (Blindkopie: Joachim Wesner/DEWET/LMSCentral/Leica) [hidden email]> Thema: Re: Just another ROI question Gesendet von: ImageJ Interest Group <[hidden email]. GOV> 04.05.2006 17:20 Bitte antworten an ImageJ Interest Group Hi, On Thu, 4 May 2006, Joachim Wesner wrote: > some time ago there was the question about generating a new ROI from a > given binary image. As ImageJ seems to support "multi-connected" (with > holes in it etc.) free-hand ROIs, that also can be read back as bitmaps, > this task seems to be pretty easy, but it is surprisingly not > implemented (yet) Wasn't the conclusion that threshold is doing the job? Ciao, Dscho ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
In reply to this post by Wayne Rasband
On Thursday 04 May 2006 18:19, Wayne Rasband wrote:
> A Shape is a path made up of segments. The segments can be straight > lines, quadratic curves and cubic curves. You can create a bitmap mask > from a ShapeRoi by calling its getMask() method, which uses the > Graphics2D fill() method. I do not know of an easy way to create a > Shape from a bitmap. I tried to program this, but it does not work: 1. run the ConvertMaskToCompositeROI.txt macro and store the ROIs as "set 1" or similar 2. now Invert the image, so the holes in the mask become objects, and run the same macro above, but store the ROIs as "set 2". 3. Invert again to return to original mask 4. (now this is what I do not seem to be able to do) . Apply the "set 1", then by pressing "Alt" and applying the ROIs in "set 2" this should subtract them from the "set 1". It seems to work if one does it by hand (i.e. adding and subtracting ROIs 1 at a time). Cheers, Gabriel |
In reply to this post by dscho
On Thursday 04 May 2006 16:20, Johannes Schindelin wrote:
> On Thu, 4 May 2006, Joachim Wesner wrote: > > some time ago there was the question about generating a new ROI from a > > given binary image. As ImageJ seems to support "multi-connected" (with > > holes in it etc.) free-hand ROIs, that also can be read back as bitmaps, > > this task seems to be pretty easy, but it is surprisingly not > > implemented (yet) > > Wasn't the conclusion that threshold is doing the job? ROIs can be used to do other things other than getting the intensity of pixels a blob. One could filter inside the ROI, one can move ROIs around, transfer them to another image, etc. So the ability to do complex ROIs would be a bonus to IJ. Cheers, G. |
In reply to this post by Gabriel Landini
Here is a macro that seem to work. It runs the particle to find the
objects, inverts the image so holes become objects, runs the particle analyzer a second time, then creates a composite ROI by adding all the object outlines and subtracting all the hole outlines. run("Set Measurements...", "area perimeter circularity decimal=3"); run("Analyze Particles...", "size=1 circularity=0 show=Nothing clear record"); count1 = nResults; run("Invert"); run("Analyze Particles...", "size=1 circularity=0 show=Nothing record exclude"); run("Invert"); for (i=0; i<nResults; i++) { x = getResult('XStart', i); y = getResult('YStart', i); if (i<count1) setKeyDown("shift"); //add else setKeyDown("alt"); //subtract doWand(x,y); } Note that this macro fails with ImageJ 1.37e, which has a flood filling bug that is fixed in 1.37f. -wayne On May 5, 2006, at 4:26 AM, Gabriel Landini wrote: > On Thursday 04 May 2006 18:19, Wayne Rasband wrote: >> A Shape is a path made up of segments. The segments can be straight >> lines, quadratic curves and cubic curves. You can create a bitmap mask >> from a ShapeRoi by calling its getMask() method, which uses the >> Graphics2D fill() method. I do not know of an easy way to create a >> Shape from a bitmap. > > I tried to program this, but it does not work: > > 1. run the ConvertMaskToCompositeROI.txt macro and store the ROIs as > "set 1" > or similar > 2. now Invert the image, so the holes in the mask become objects, and > run the > same macro above, but store the ROIs as "set 2". > 3. Invert again to return to original mask > 4. (now this is what I do not seem to be able to do) . Apply the "set > 1", then > by pressing "Alt" and applying the ROIs in "set 2" this should > subtract them > from the "set 1". > It seems to work if one does it by hand (i.e. adding and subtracting > ROIs 1 at > a time). > > Cheers, > > Gabriel > |
Free forum by Nabble | Edit this page |