MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / isLine

Method isLine

ij/src/main/java/ij/gui/Wand.java:321–341  ·  view source on GitHub ↗
(int xs, int ys)

Source from the content-addressed store, hash-verified

319
320 /* Are we tracing a one pixel wide line? Makes Legacy mode 8-connected instead of 4-connected */
321 private boolean isLine(int xs, int ys) {
322 int r = 5;
323 int xmin=xs;
324 int xmax=xs+2*r;
325 if (xmax>=width) xmax=width-1;
326 int ymin=ys-r;
327 if (ymin<0) ymin=0;
328 int ymax=ys+r;
329 if (ymax>=height) ymax=height-1;
330 int area = 0;
331 int insideCount = 0;
332 for (int x=xmin; (x<=xmax); x++)
333 for (int y=ymin; y<=ymax; y++) {
334 area++;
335 if (inside(x,y))
336 insideCount++;
337 }
338 if (IJ.debugMode)
339 IJ.log((((double)insideCount)/area<0.25?"line ":"blob ")+insideCount+" "+area+" "+IJ.d2s(((double)insideCount)/area));
340 return ((double)insideCount)/area<0.25;
341 }
342
343 /** Set 'true' and output will contain intermediate points for straight lines longer than one pixel. */
344 public static void setAllPoints(boolean b) {

Callers 1

autoOutlineMethod · 0.95

Calls 3

insideMethod · 0.95
logMethod · 0.95
d2sMethod · 0.95

Tested by

no test coverage detected