magic wand

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

magic wand

Knecht, David
Is there an equivalent in ImageJ to using the magic wand in  
Photoshop?  In PS you can set the wand tolerance so you are not  
limited to single pixel value and after initial selection you can use  
the "grow" or "similar" to enlarge the selection.  Dave

Dr. David Knecht
Department of Molecular and Cell Biology
Co-head Flow Cytometry and Confocal Microscopy Facility
U-3125
91 N. Eagleville Rd.
University of Connecticut
Storrs, CT 06269
860-486-2200
860-486-4331 (fax)
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Michael Schmid
Hi David,

two possibilities:

(1) use the threshold to define the range that the wand should accept:
Image>Adjust>Threshold

(2) There are several plugins, search the internet for "ImageJ Magic  
Wand plugin". E.g. Yawi3D, NeuronJ for linear features, ...

Michael
________________________________________________________________

On 26 May 2009, at 17:48, David Knecht wrote:

> Is there an equivalent in ImageJ to using the magic wand in  
> Photoshop?  In PS you can set the wand tolerance so you are not  
> limited to single pixel value and after initial selection you can  
> use the "grow" or "similar" to enlarge the selection.  Dave
>
> Dr. David Knecht
> Department of Molecular and Cell Biology
> Co-head Flow Cytometry and Confocal Microscopy Facility
> U-3125
> 91 N. Eagleville Rd.
> University of Connecticut
> Storrs, CT 06269
> 860-486-2200
> 860-486-4331 (fax)
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Wayne Rasband
In reply to this post by Knecht, David
> Is there an equivalent in ImageJ to using the magic wand in Photoshop?
>  In PS you can set the wand tolerance so you are not limited to single
> pixel value and after initial selection you can use the "grow" or
> "similar" to enlarge the selection.  Dave

You can use the wand tool in conjunction with the thresholding tool
(Edit>Adjust>Threshold) but you have recreate the wand selection after
you change the threshold.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Giorgio Cadoro
In reply to this post by Knecht, David
There is this tools  based on wand
http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:yawi_2d:start
, and we are currently working on a new plugin based on the grow from
initial selection.


Example:
Grow(int indexOfSeed,byte[] srcImage, ArrayList<Integer>
visitedPixel,boolean []bVisitedPixel){
                  Stack<Integer> stckPixel = new Stack<Integer>();
                        stckPixel.push(index of seed);
                        bVisitedPixel[ndex of seed]=true;
                        while(! stckPixel.empty()){
                                int pxSrc = stckPixel.pop();
                                ArrayList<Integer> Ad=NEIGHBORPIXEL(8|4);
                                for (int px : Ad){
                                                int srcByte = srcImage[px] & 0xff;
                                                if( !bVisitedPixel[px] && ( srcByte>=minThreshold &&
srcByte<=maxThreshold)
                                                        stckPixel.push(px);
                                                        Al.add(px);
                                                        }
                                }
                }
Cadoro Giorgio

2009/5/26 David Knecht <[hidden email]>:

> Is there an equivalent in ImageJ to using the magic wand in Photoshop?  In
> PS you can set the wand tolerance so you are not limited to single pixel
> value and after initial selection you can use the "grow" or "similar" to
> enlarge the selection.  Dave
>
> Dr. David Knecht
> Department of Molecular and Cell Biology
> Co-head Flow Cytometry and Confocal Microscopy Facility
> U-3125
> 91 N. Eagleville Rd.
> University of Connecticut
> Storrs, CT 06269
> 860-486-2200
> 860-486-4331 (fax)
>
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

dscho
Hi,

On Tue, 26 May 2009, Giorgio Cadoro wrote:

> There is this tools  based on wand
> http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:yawi_2d:start
> , and we are currently working on a new plugin based on the grow from
> initial selection.

Do you mean something like Fiji's Blow tool?  
Plugins>Segmentation>Blow/Lasso Tool

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Giorgio Cadoro
Yes it's a good tool, but the roi is not based on the values of initial seed?!

Ciao,
Giorgio

2009/5/26 Johannes Schindelin <[hidden email]>:

> Hi,
>
> On Tue, 26 May 2009, Giorgio Cadoro wrote:
>
>> There is this tools  based on wand
>> http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:yawi_2d:start
>> , and we are currently working on a new plugin based on the grow from
>> initial selection.
>
> Do you mean something like Fiji's Blow tool?
> Plugins>Segmentation>Blow/Lasso Tool
>
> Ciao,
> Dscho
>
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Knecht, David
In reply to this post by Giorgio Cadoro
I am confused.  Why is the sourceforge page and the description for  
Yawi 3D but the file is called Yawi2D?  Is it a 2D or 3D wand?   Dave

On May 26, 2009, at 3:25 PM, Giorgio Cadoro wrote:

> There is this tools  based on wand
> http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:yawi_2d:start
> , and we are currently working on a new plugin based on the grow from
> initial selection.
>
>
> Example:
> Grow(int indexOfSeed,byte[] srcImage, ArrayList<Integer>
> visitedPixel,boolean []bVisitedPixel){
>  Stack<Integer> stckPixel = new Stack<Integer>();
> stckPixel.push(index of seed);
> bVisitedPixel[ndex of seed]=true;
> while(! stckPixel.empty()){
> int pxSrc = stckPixel.pop();
> ArrayList<Integer> Ad=NEIGHBORPIXEL(8|4);
> for (int px : Ad){
> int srcByte = srcImage[px] & 0xff;
> if( !bVisitedPixel[px] && ( srcByte>=minThreshold &&
> srcByte<=maxThreshold)
> stckPixel.push(px);
> Al.add(px);
> }
> }
> }
> Cadoro Giorgio
>
> 2009/5/26 David Knecht <[hidden email]>:
>> Is there an equivalent in ImageJ to using the magic wand in  
>> Photoshop?  In
>> PS you can set the wand tolerance so you are not limited to single  
>> pixel
>> value and after initial selection you can use the "grow" or  
>> "similar" to
>> enlarge the selection.  Dave
>>
>> Dr. David Knecht
>> Department of Molecular and Cell Biology
>> Co-head Flow Cytometry and Confocal Microscopy Facility
>> U-3125
>> 91 N. Eagleville Rd.
>> University of Connecticut
>> Storrs, CT 06269
>> 860-486-2200
>> 860-486-4331 (fax)
>>

Dr. David Knecht
Department of Molecular and Cell Biology
Co-head Flow Cytometry and Confocal Microscopy Facility
U-3125
91 N. Eagleville Rd.
University of Connecticut
Storrs, CT 06269
860-486-2200
860-486-4331 (fax)
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

dscho
In reply to this post by Giorgio Cadoro
Hi,

On Wed, 27 May 2009, Giorgio Cadoro wrote:

> Yes it's a good tool, but the roi is not based on the values of initial
> seed?!

You did not Cc: me, so I almost missed your mail between the 100 new mails
I had in my inbox this morning.

The ROI from the tool is of course based on the values of the initial
seed.

Ciao,
Dscho

P.S.: If you do not know which tool I am talking about, it is because you
did not quote my mail properly.
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Michael Schmid
In reply to this post by Knecht, David
Hi all,

below is quickly written proof-of-concept wand tool that does  
Photoshop-like selections and also has the possibility to stop the  
selection based on the gradient.

It does not support the ALT and SHIFT keys so far, and has a few  
other restrictions. Also, the code needs polishing.

Note that the mailer may break up long lines, which may sometimes  
cause problems.

Michael
________________________________________________________________
import ij.*;
import ij.process.*;
import ij.gui.*;
import ij.plugin.*;
import ij.plugin.filter.ThresholdToSelection;
import ij.plugin.frame.Recorder;
import java.awt.*;

/** An ImageJ magic wand with selectable tolerance and gradient  
detection.
   * This PlugIn works on the gray value for RGB images
   *
   * Parameters
   * ==========
   *
   * Gray Value Tolerance:
   * The selection is expanded to all image points as long as the  
difference
   * between the gray level (brightness) of the point clicked and the
   * image point is less than the Gray Value Tolerance.
   *
   * Gradient Tolerance:
   * Irrespective of Gray Value Tolerance, the selection is not expanded
   * if the gray level gradient is larger than the Gradient Tolerance.
   *
   * Usage
   * =====
   * - When called from the plugins menu, the tool is installed in  
the ImageJ Toolbar
   *   This replaces all other custom tools, e..g those from the  
startup macro.
   * - Put the following into your ImageJ/macros/StartupMacros.txt file
   *   to have this Wand Tool as a standard tool:
         macro 'Wand Tool-Cf00Lee55O2233' {
             getCursorLoc(x, y, z, flags);
             call('Wand_Tool.mousePressed', x, y, flags);
         }
         macro 'Wand Tool Options' {
             call('Wand_Tool.showDialog');
         }"
   * Left-click the tool icon for selecting the tool
   * Right-click or double-click the tool icon for the options menu
   * where the tolerance can be selected
   *
   * To do:
   * - shift-click, alt-click
   * - include holes option
   * - fix exception on cancel dialog
   * - units for calibrated images, spatial calibration for gradient
   * - save roi
   * - preview (with last seed) in dialog
   *
   * Michael Schmid, 2009-May-25
   */

public class Wand_Tool implements PlugIn {

     static double toleranceGrayVal = 20;
     static double toleranceGrayGrad = 5;

     int width, height;
     int[] dirOffset, dirXoffset, dirYoffset;    // offsets of  
neighbor pixels for addressing
     ByteProcessor maskIp;
     int[] coordinates;
     int coordinateMask;


     public void run(String arg) {
         if (IJ.versionLessThan("1.39a")) return;
         if (IJ.isMacro()) {
             showDialog();
             return;
         }
         String macro =
             "macro 'Wand Tool-Cf00Lee55O2233' {\n" +
             "  getCursorLoc(x, y, z, flags);\n" +
             "  call('Wand_Tool.mousePressed', x, y, flags);\n"+
             "}\n" +
             "macro 'Wand Tool Options' {\n" +
             "  call('Wand_Tool.showDialog');\n"+
             "}";
         new MacroInstaller().install(macro);
     }

     public static void mousePressed(String xString, String yString,  
String flagString) {
         int x = Integer.parseInt(xString);
         int y = Integer.parseInt(yString);
         int flags = Integer.parseInt(flagString);
         ImagePlus imp = WindowManager.getCurrentImage();
         if (imp==null) return;
         imp.getWindow().setCursor(Cursor.CROSSHAIR_CURSOR);
         new Wand_Tool().doWand(imp, x, y, flags);
     }

     public static void showDialog() {
         boolean save = Recorder.recordInMacros;
         if (Recorder.record) {
             Recorder.recordInMacros = true;
             Recorder.setCommand("Wand Tool");
         }
         GenericDialog gd = new GenericDialog("Wand Tool Options");
         gd.addNumericField("Gray Value Tolerance", toleranceGrayVal,  
2);
         gd.addNumericField("Gradient Tolerance", toleranceGrayGrad, 2);
         gd.showDialog();
         if (!gd.wasCanceled()) {
             toleranceGrayVal = gd.getNextNumber();
             toleranceGrayGrad = gd.getNextNumber();
             if (Recorder.record) Recorder.saveCommand();
         }
         Recorder.recordInMacros = save;
     }

     void doWand(ImagePlus imp, int x0, int y0, int flags) {
         ImageProcessor ip = imp.getProcessor();
         prepare(ip);
         boolean useGradient = toleranceGrayGrad<toleranceGrayVal;
         float toleranceGrayGrad2 = (float)
(toleranceGrayGrad*toleranceGrayGrad);
         float grayRef = ip.getPixelValue(x0, y0);
         byte[] mPixels = (byte[])maskIp.getPixels();
         //simple flood fill algorithm
         int lastCoord = 0;
         int offset0 = x0 + y0*width;
         mPixels[offset0] = -1;
         coordinates[0] = offset0;
         for (int iCoord = 0; iCoord<=lastCoord; iCoord++) {
             int offset = coordinates[iCoord & coordinateMask];
             int x = offset % width;
             int y = offset / width;
             boolean isInner = (x!=0 && y!=0 && x!=(width-1) && y!=
(height-1));
             float v = ip.getPixelValue(x,y);
             boolean largeGradient = false;
             float xGradient=0, yGradient=0;
             if (useGradient) {
                 if (isInner) {
                     float vpp=ip.getPixelValue(x+1, y+1);
                     float vpm=ip.getPixelValue(x+1, y-1);
                     float vmp=ip.getPixelValue(x-1, y+1);
                     float vmm=ip.getPixelValue(x-1, y-1);

                     xGradient = 0.125f*(    //Sobel-filter like  
gradient
                             2f*(ip.getPixelValue(x+1, y)-
ip.getPixelValue(x-1, y))
                             + vpp-vmm +(vpm-vmp)); // v(x+1) - v(x-1)
                     yGradient = 0.125f*(
                             2f*(ip.getPixelValue(x, y+1)-
ip.getPixelValue(x, y-1))
                             + vpp-vmm -(vpm-vmp)); // v(y+1) - v(y-1)
                 } else {
                     int xCount=0, yCount=0;
                     for (int d=0; d<8; d++) if (isWithin(ip, x, y,  
d)) {
                         int x2 = x+dirXoffset[d];
                         int y2 = y+dirYoffset[d];
                         float v2 = ip.getPixelValue(x2, y2);
                         int weight = (2-(d&0x1));   //2 for  
straight, 1 for diag
                         xGradient += dirXoffset[d] * (v2-v) * weight;
                         xCount += weight * (dirXoffset[d]!=0 ? 1 : 0);
                         yGradient += dirYoffset[d] * (v2-v) * weight;
                         yCount += weight * (dirYoffset[d]!=0 ? 1 : 0);
                     }
                     xGradient /= xCount;
                     yGradient /= yCount;
                 }
                 largeGradient = xGradient*xGradient +  
yGradient*yGradient > toleranceGrayGrad2;
             }
             for (int d=0; d<8; d++) {           //analyze all  
neighbors (in 8 directions)
                 int offset2 = offset+dirOffset[d];
                 if ((isInner || isWithin(ip, x, y, d)) && mPixels
[offset2] == 0) {
                     int x2 = x+dirXoffset[d];
                     int y2 = y+dirYoffset[d];
                     float v2 = ip.getPixelValue(x2, y2);
                     if (v2>grayRef+toleranceGrayVal || v2<grayRef-
toleranceGrayVal) {
                         mPixels[offset2] = 1;   //out-of-bounds,  
don't analyze any more
                     } else if (!largeGradient || (v2-v)*
(xGradient*dirXoffset[d]+yGradient*dirYoffset[d])<=0) {
                         mPixels[offset2] = -1;  //add new point
                         if (lastCoord-iCoord > coordinateMask)
                             expandCoordinateArray();
                         lastCoord++;
                         coordinates[lastCoord & coordinateMask] =  
offset2;
                     }
                 }
             } //for direction d
             if ((iCoord&0xfff)==1) IJ.showProgress(iCoord/(double)
(width*height));
         } //for iCoord


         //convert mask to selection
         maskIp.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE);
         ThresholdToSelection tts = new ThresholdToSelection();
         tts.setup("", imp);
         tts.run(maskIp);
         IJ.showProgress(1.0);
         if (Recorder.record)
             Recorder.record("call","Wand_Tool.mousePressed\",\""+x0
+"\",\""+y0+"\",\""+flags);
     }

     /** Create static class variables:
      *  A mask, arrays of offsets within a pixel array for  
directions in clockwise order: 0=(x,y-1), 1=(x+1,y-1), ... 7=(x-1,y)
      */
     void prepare(ImageProcessor ip) {
         int width = ip.getWidth();
         int height = ip.getHeight();
         dirXoffset = new int[] {    0,      1,     1,     1,        
0,     -1,      -1,    -1    };
         dirYoffset = new int[] {   -1,     -1,     0,     1,        
1,      1,       0,    -1,   };
         dirOffset  = new int[] {-width, -width+1, +1, +width+1,  
+width, +width-1,   -1, -width-1 };
         maskIp = new ByteProcessor(width, height);
         coordinateMask = 0xfff;
         coordinates = new int[coordinateMask+1];
         this.height = height;
         this.width = width;
     }

     void expandCoordinateArray() {
         int newSize = 2*(coordinateMask+1);
         int newMask = newSize - 1;
         int[] newCoordinates = new int[newSize];
         System.arraycopy(coordinates, 0, newCoordinates, 0,  
coordinateMask+1);
         System.arraycopy(coordinates, 0, newCoordinates,  
coordinateMask+1, coordinateMask+1);
         coordinates = newCoordinates;
         coordinateMask = newMask;
     }

     /** returns whether the neighbor in a given direction is within  
the image
      * NOTE: it is assumed that the pixel x,y itself is within the  
image!
      * Uses class variables width, height: dimensions of the image
      * @param x         x-coordinate of the pixel that has a  
neighbor in the given direction
      * @param y         y-coordinate of the pixel that has a  
neighbor in the given direction
      * @param direction the direction from the pixel towards the  
neighbor (see makeDirectionOffsets)
      * @return          true if the neighbor is within the image  
(provided that x, y is within)
      */
     boolean isWithin(ImageProcessor ip, int x, int y, int direction) {
         int width = ip.getWidth();
         int height = ip.getHeight();
         int xmax = width - 1;
         int ymax = height -1;
         switch(direction) {
             case 0:
                 return (y>0);
             case 1:
                 return (x<xmax && y>0);
             case 2:
                 return (x<xmax);
             case 3:
                 return (x<xmax && y<ymax);
             case 4:
                 return (y<ymax);
             case 5:
                 return (x>0 && y<ymax);
             case 6:
                 return (x>0);
             case 7:
                 return (x>0 && y>0);
         }
         return false;   //to make the compiler happy :-)
     } // isWithin

     void clear (ByteProcessor maskIp) {
         byte[] pixels = (byte[])maskIp.getPixels();
         for (int i=0; i<pixels.length; i++)
             pixels[i] = 0;
     }
}
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Gabriel Landini
On Wednesday 27 May 2009  09:34:35 Michael Schmid wrote:
> below is quickly written proof-of-concept wand tool that does  
> Photoshop-like selections and also has the possibility to stop the  
> selection based on the gradient.

That is nice. It would be useful to have the option of disregarding holes
inside the detected ROI (i.e. once the ROI is found, just keep the outer
boundary.

Increasing the gradient tolerance avoids some holes inside the detected ROI,
but that is not what I am suggesting.

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Michael Schmid
Hi everyone,

an updated version of the magic wand that I posted to the list a week  
ago is now available as 'Versatile Wand' at
   http://imagejdocu.tudor.lu/doku.php?
id=plugin:segmentation:versatile_wand:start

Features:

- selectable tolerance
- gradient detection
- 4-connected or 8-connected operation
- include inner holes or not
- options menu with preview

Michael
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Gabriel Landini
On Thursday 04 June 2009  11:48:26 Michael Schmid wrote:
> an updated version of the magic wand that I posted to the list a week  
> ago is now available as 'Versatile Wand' at
>    http://imagejdocu.tudor.lu/doku.php?
> id=plugin:segmentation:versatile_wand:start

/home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333: cannot find
symbol
symbol  : class Wand
location: class Versatile_Wand
            Wand w = new Wand(maskIp);
            ^
/home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333: cannot find
symbol
symbol  : class Wand
location: class Versatile_Wand
            Wand w = new Wand(maskIp);
                         ^
2 errors
1 warning


Cheers
Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Michael Schmid
Hi Gabriel,

sorry, the statement
     import ij.gui.Wand;
was missing. Please insert it at the beginning.
I had my own Wand class in the plugins and did not notice.

I had tried to upload a corrected version, but this had failed.

Michael
________________________________________________________________

On 4 Jun 2009, at 12:52, Gabriel Landini wrote:

> On Thursday 04 June 2009  11:48:26 Michael Schmid wrote:
>> an updated version of the magic wand that I posted to the list a week
>> ago is now available as 'Versatile Wand' at
>>    http://imagejdocu.tudor.lu/doku.php?
>> id=plugin:segmentation:versatile_wand:start
>
> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:  
> cannot find
> symbol
> symbol  : class Wand
> location: class Versatile_Wand
>             Wand w = new Wand(maskIp);
>             ^
> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:  
> cannot find
> symbol
> symbol  : class Wand
> location: class Versatile_Wand
>             Wand w = new Wand(maskIp);
>                          ^
> 2 errors
> 1 warning
>
>
> Cheers
> Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Knecht, David
Insert it at the beginning of what?

On Jun 4, 2009, at 12:17 PM, Michael Schmid wrote:

> Hi Gabriel,
>
> sorry, the statement
>     import ij.gui.Wand;
> was missing. Please insert it at the beginning.
> I had my own Wand class in the plugins and did not notice.
>
> I had tried to upload a corrected version, but this had failed.
>
> Michael
> ________________________________________________________________
>
> On 4 Jun 2009, at 12:52, Gabriel Landini wrote:
>
>> On Thursday 04 June 2009  11:48:26 Michael Schmid wrote:
>>> an updated version of the magic wand that I posted to the list a  
>>> week
>>> ago is now available as 'Versatile Wand' at
>>>   http://imagejdocu.tudor.lu/doku.php?
>>> id=plugin:segmentation:versatile_wand:start
>>
>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:
>> cannot find
>> symbol
>> symbol  : class Wand
>> location: class Versatile_Wand
>>            Wand w = new Wand(maskIp);
>>            ^
>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:
>> cannot find
>> symbol
>> symbol  : class Wand
>> location: class Versatile_Wand
>>            Wand w = new Wand(maskIp);
>>                         ^
>> 2 errors
>> 1 warning
>>
>>
>> Cheers
>> Gabriel

Dr. David Knecht
Department of Molecular and Cell Biology
Co-head Flow Cytometry and Confocal Microscopy Facility
U-3125
91 N. Eagleville Rd.
University of Connecticut
Storrs, CT 06269
860-486-2200
860-486-4331 (fax)
Reply | Threaded
Open this post in threaded view
|

Re: magic wand

Gabriel Landini
On Thursday 04 June 2009 18:40:17 David Knecht wrote:
> Insert it at the beginning of what?

The source code.

G.
Reply | Threaded
Open this post in threaded view
|

Analyzer, perimeter and filling (was Re: magic wand)

BenTupper
In reply to this post by Michael Schmid
Hello,

A heartfelt thanks to Michael for Versatile Wand - very nice!  But it  
has me thinking which invariably leads to confusion!

I want to make sure that I have things straight in my head regarding  
the functionality of (a) the built-in Wand functionality, (b) the  
built-in FloodFill, and (c) "Analyze particles..." .   And then I have  
a question.  First some statements...

(1) Wand currently only performs 8-connected searches,

(2) FloodFill uses 4- or 8- connected which the user selects by double-
clicking the bucket icon,

(3) "Analyze particles..."  (as Analyzer, or is it ParticleAnalyzer?  
or PolygonFiller?) uses FloodFill and Wand but flood filling is only 8-
connected.

Playing with this test image (http://www.tidewater.net/~pemaquid/test.tif 
) I think this last statement is always true, but I would like to get  
confirmation from others.

My question is how can I make "Analyze particles..."  optionally work  
in a 4-connected manner.  Does it require a major reconfiguration or  
simple tinkering?

Thanks!
Ben



On Jun 4, 2009, at 12:17 PM, Michael Schmid wrote:

> Hi Gabriel,
>
> sorry, the statement
>    import ij.gui.Wand;
> was missing. Please insert it at the beginning.
> I had my own Wand class in the plugins and did not notice.
>
> I had tried to upload a corrected version, but this had failed.
>
> Michael
> ________________________________________________________________
>
> On 4 Jun 2009, at 12:52, Gabriel Landini wrote:
>
>> On Thursday 04 June 2009  11:48:26 Michael Schmid wrote:
>>> an updated version of the magic wand that I posted to the list a  
>>> week
>>> ago is now available as 'Versatile Wand' at
>>>   http://imagejdocu.tudor.lu/doku.php?
>>> id=plugin:segmentation:versatile_wand:start
>>
>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:  
>> cannot find
>> symbol
>> symbol  : class Wand
>> location: class Versatile_Wand
>>            Wand w = new Wand(maskIp);
>>            ^
>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:  
>> cannot find
>> symbol
>> symbol  : class Wand
>> location: class Versatile_Wand
>>            Wand w = new Wand(maskIp);
>>                         ^
>> 2 errors
>> 1 warning
>>
>>
>> Cheers
>> Gabriel

Ben Tupper
Reply | Threaded
Open this post in threaded view
|

Re: Analyzer, perimeter and filling (was Re: magic wand)

Wayne Rasband
> A heartfelt thanks to Michael for Versatile Wand - very nice!  But it
> has me thinking which invariably leads to confusion!
>
> I want to make sure that I have things straight in my head regarding
> the functionality of (a) the built-in Wand functionality, (b) the
> built-in FloodFill, and (c) "Analyze particles..." .   And then I have
> a question.  First some statements...
>
> (1) Wand currently only performs 8-connected searches,

The built in wand tool in v1.43a will be based on Versatile Wand, so it
will have an option to perform 4-connected outlining.

> (2) FloodFill uses 4- or 8- connected which the user selects by
> double-clicking the bucket icon,

That is correct.

> (3) "Analyze particles..."  (as Analyzer, or is it ParticleAnalyzer?
> or PolygonFiller?) uses FloodFill and Wand but flood filling is only
> 8-connected.

The particle analyzer is currently only 8-connected but it will be easy
to add a 4-connected option once the Wand class is updated to support
4-connected outlining.

> Playing with this test image
> (http://www.tidewater.net/~pemaquid/test.tif) I think this last
> statement is always true, but I would like to get confirmation from
> others.
>
> My question is how can I make "Analyze particles..."  optionally work
> in a 4-connected manner.  Does it require a major reconfiguration or
> simple tinkering?

It will require simple tinkering, or perhaps only checking
"4-Connected" in a dialog, in ImageJ 1.43.

-wayne

>
> Thanks!
> Ben
>
>
>
> On Jun 4, 2009, at 12:17 PM, Michael Schmid wrote:
>
>> Hi Gabriel,
>>
>> sorry, the statement
>>    import ij.gui.Wand;
>> was missing. Please insert it at the beginning.
>> I had my own Wand class in the plugins and did not notice.
>>
>> I had tried to upload a corrected version, but this had failed.
>>
>> Michael
>> ________________________________________________________________
>>
>> On 4 Jun 2009, at 12:52, Gabriel Landini wrote:
>>
>>> On Thursday 04 June 2009  11:48:26 Michael Schmid wrote:
>>>> an updated version of the magic wand that I posted to the list a
>>>> week
>>>> ago is now available as 'Versatile Wand' at
>>>>   http://imagejdocu.tudor.lu/doku.php?
>>>> id=plugin:segmentation:versatile_wand:start
>>>
>>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:
>>> cannot find
>>> symbol
>>> symbol  : class Wand
>>> location: class Versatile_Wand
>>>            Wand w = new Wand(maskIp);
>>>            ^
>>> /home/gabriel/ImageJ/plugins/Segmentation/Versatile_Wand.java:333:
>>> cannot find
>>> symbol
>>> symbol  : class Wand
>>> location: class Versatile_Wand
>>>            Wand w = new Wand(maskIp);
>>>                         ^
>>> 2 errors
>>> 1 warning
>>>
>>>
>>> Cheers
>>> Gabriel
>
> Ben Tupper
>
Reply | Threaded
Open this post in threaded view
|

Re: Analyzer, perimeter and filling (was Re: magic wand)

BenTupper
On Jun 12, 2009, at 11:16 AM, Wayne Rasband wrote:

>> A heartfelt thanks to Michael for Versatile Wand - very nice!  But  
>> it has me thinking which invariably leads to confusion!
>>
>> I want to make sure that I have things straight in my head  
>> regarding the functionality of (a) the built-in Wand functionality,  
>> (b) the built-in FloodFill, and (c) "Analyze particles..." .   And  
>> then I have a question.  First some statements...
>>
>> (1) Wand currently only performs 8-connected searches,
>
> The built in wand tool in v1.43a will be based on Versatile Wand, so  
> it will have an option to perform 4-connected outlining.
>
>> (2) FloodFill uses 4- or 8- connected which the user selects by  
>> double-clicking the bucket icon,
>
> That is correct.
>
>> (3) "Analyze particles..."  (as Analyzer, or is it  
>> ParticleAnalyzer? or PolygonFiller?) uses FloodFill and Wand but  
>> flood filling is only 8-connected.
>
> The particle analyzer is currently only 8-connected but it will be  
> easy to add a 4-connected option once the Wand class is updated to  
> support 4-connected outlining.
>
>> Playing with this test image (http://www.tidewater.net/~pemaquid/test.tif 
>> ) I think this last statement is always true, but I would like to  
>> get confirmation from others.
>>
>> My question is how can I make "Analyze particles..."  optionally  
>> work in a 4-connected manner.  Does it require a major  
>> reconfiguration or simple tinkering?
>
> It will require simple tinkering, or perhaps only checking "4-
> Connected" in a dialog, in ImageJ 1.43.
>


YeeeeeeHaaaaaa!   That is wonderful!  Thanks!


Ben Tupper
Reply | Threaded
Open this post in threaded view
|

Re: Analyzer, perimeter and filling (was Re: magic wand)

Gabriel Landini
In reply to this post by BenTupper
On Friday 12 June 2009  14:59:41 Ben Tupper wrote:

> My question is how can I make "Analyze particles..."  optionally work  
> in a 4-connected manner.  Does it require a major reconfiguration or  
> simple tinkering?

You could use the Particles4 and Particles8 plugins which do similar things
but based on 4 or 8 connectivity.

Cheers

G.