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

Method incrementCounter

ij/src/main/java/ij/gui/PointRoi.java:419–443  ·  view source on GitHub ↗
(ImagePlus imp)

Source from the content-addressed store, hash-verified

417 }
418
419 private synchronized void incrementCounter(ImagePlus imp) {
420 counts[counter]++;
421 boolean isStack = imp!=null && imp.getStackSize()>1;
422 if (counter!=0 || isStack || counters!=null) {
423 if (counters==null) {
424 int size = nPoints*2;
425 if (size<100) size=100;
426 counters = new short[size];
427 positions = new int[size];
428 }
429 if (nPoints>=counters.length) {
430 short[] temp = new short[counters.length*2];
431 System.arraycopy(counters, 0, temp, 0, counters.length);
432 counters = temp;
433 int[] temp1 = new int[counters.length*2];
434 System.arraycopy(positions, 0, temp1, 0, positions.length);
435 positions = temp1;
436 }
437 counters[nPoints-1] = (short)counter;
438 if (imp!=null)
439 positions[nPoints-1] = imp.getStackSize()>1 ? imp.getCurrentSlice() : 0;
440 }
441 if (rt!=null && WindowManager.getFrame(getCountsTitle())!=null)
442 displayCounts();
443 }
444
445 /** Returns the index of the current counter. */
446 public int getCounter() {

Callers 2

PointRoiMethod · 0.95
addPoint2Method · 0.95

Calls 6

getFrameMethod · 0.95
getCountsTitleMethod · 0.95
displayCountsMethod · 0.95
getCurrentSliceMethod · 0.80
getStackSizeMethod · 0.45
arraycopyMethod · 0.45

Tested by

no test coverage detected