Login  Register

Wand and XStart,YStart

Posted by BenTupper on Jul 07, 2009; 11:04pm
URL: http://imagej.273.s1.nabble.com/Wand-and-XStart-YStart-tp3691871.html

Hi All,

I am still experiencing some bad magic using the new Wand -  
specifically, I wonder if the inputs to the doWand(x,y) macro command  
have changed with the version.  I am 99% sure that in the past (at  
least in version 1.42) I provided doWand(x,y) with unscaled pixel  
coordinates even if the image had a scale.  In general I used pixel  
coordinates taken from the Results Table when the XStart and YStart  
coordinates were available.  However, it doesn't seem to me that this  
behavior is the same in version 1.43b even if I am using the wand in  
legacy mode.

Below is a short macro that loads a small scaled binary image from my  
web space (yeah for run("URL..."))  The macro loads for me with the  
following scale info...


Title: calROI-3.tif
Width:  75.06 µm (88)
Height:  65.68 µm (77)
Resolution:  1.172 pixels per µm
ID: -17
Coordinate origin:  0,0
Bits per pixel: 8 (inverting grayscale LUT)
Display range: 0-255
No Threshold
Uncalibrated
Path: calROI.tif

- Running in version 1.43b, you can see that the entire image is  
selected which is not what I expected.

- Running in version 1.42q, you can see that the particle in the upper  
left is highlighted which is what I expected.

Have I missed something in the change of Wand?  My first guess is that  
Wand is getting coords that have been changed into "real" world units,  
but a quick peek at Macro.Functions.doWand() and IJ.doWand() don't  
reveal anything funny to my eyes.  My second guess is that the  
[XStart, YStart] pixel values [16,4] are converted to a pixel just  
outside the masked pixels as [13.652  3.413].  Zooming into that  
location shows it is indeed a background pixel.

If it is the latter, then it seems I can't use XStart, YStart with  
Wand.  Ouch.

Perhaps it is because XStart, YStart appear to be on the right hand  
side of the object and Wand looks at the seed location and to its  
right for an initial boundary pixel?


// START HERE
if (startsWith(getVersion(), "1.43")){
        run("Wand Tool...", "mode=Legacy tolerance=0");
}
run("URL...", "url=http://www.tidewater.net/~pemaquid/calROI.tif");
run("Set Measurements...", "area bounding shape redirect=None  
decimal=3");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00  
show=Nothing display clear record");
x = getResult("XStart", 0);
y = getResult("YStart", 0);
print("Start [x,y]=", x, ", ", y);
doWand(x,y);
// END HERE

Thanks and cheers,
Ben

Ben Tupper


P.S. I sure hope you all are getting the sun that we here in Maine are  
not getting this summer. In fact, we are huddled around the fireplace  
today as it only hit 53F.  Brrr.  The only good thing about it is that  
I don't have to paint the house!