Login  Register

eval("script", "roi.contains(x, y);");

Posted by Douglas Benn-2 on Apr 05, 2010; 6:36pm
URL: http://imagej.273.s1.nabble.com/eval-script-roi-contains-x-y-tp3688675.html

Another query please.

I wrote the following code to test the use of roi.contains(x,y) from within a macro. I have code before it which loads an image, thresholds, masks, outlines and opens roimanager. I also checked to see that the roi list is populated and the image displays the rois and a selection.

When I run the code

 index          =getNumber("Enter number of ROI", 0);
   index        = index--;
   roiManager("select", index);
   x            =getNumber("Cursor X", 0);
   y            =getNumber("Cursor Y", 0);
   roi_flag     =eval("script", "roi.contains(x, y);");
   if (roi_flag==true) print("roi flag=Inside\n");
   else print("roi flag=Outside\n");

I get this output in my Log.

ReferenceError: "roi" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1

Although it references line number 1 it is not line number 1 of my program.What am I doing wrong?

Thanks.

Douglas
Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal College of Radiologists, England).
Professor
Dept of General Dentistry
Creighton University Dental School
2500 California Plaza
Omaha
Nebraska 68178

Tel: (402)280 5025
Fax: (402)280 5094