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

Method updateScalebar

ij/src/main/java/ij/plugin/ScaleBar.java:578–612  ·  view source on GitHub ↗

Draw the scale bar, based on the current configuration. If {previewOnly} is true, only the active slice will be labeled with a scalebar. If it is false, all slices of the stack will be labeled. This method chooses whether to use an overlay or the drawing tool to create the scalebar.

(boolean previewOnly)

Source from the content-addressed store, hash-verified

576 * drawing tool to create the scalebar.
577 */
578 void updateScalebar(boolean previewOnly) {
579 removeScalebar();
580
581 Overlay scaleBarOverlay;
582 try {
583 scaleBarOverlay = createScaleBarOverlay();
584 } catch (MissingRoiException e) {
585 return; // Simply don't draw the scalebar.
586 }
587
588 Overlay impOverlay = imp.getOverlay();
589 if (impOverlay==null) {
590 impOverlay = new Overlay();
591 }
592
593 if (config.useOverlay) {
594 for (Roi roi : scaleBarOverlay)
595 impOverlay.add(roi);
596 imp.setOverlay(impOverlay);
597 } else {
598 if (previewOnly) {
599 ImageProcessor ip = imp.getProcessor();
600 drawOverlayOnProcessor(scaleBarOverlay, ip);
601 imp.updateAndDraw();
602 } else {
603 ImageStack stack = imp.getStack();
604 for (int i=1; i<=stack.size(); i++) {
605 ImageProcessor ip = stack.getProcessor(i);
606 drawOverlayOnProcessor(scaleBarOverlay, ip);
607 imp.updateAndDraw();
608 }
609 imp.setStack(stack);
610 }
611 }
612 }
613
614 void drawOverlayOnProcessor(Overlay overlay, ImageProcessor processor) {
615 if (processor.getBitDepth() == 8 || processor.getBitDepth() == 24) {

Callers 3

runMethod · 0.95
askUserConfigurationMethod · 0.95
dialogItemChangedMethod · 0.80

Calls 12

removeScalebarMethod · 0.95
createScaleBarOverlayMethod · 0.95
addMethod · 0.95
sizeMethod · 0.95
getProcessorMethod · 0.95
setStackMethod · 0.80
getOverlayMethod · 0.45
setOverlayMethod · 0.45
getProcessorMethod · 0.45
updateAndDrawMethod · 0.45
getStackMethod · 0.45

Tested by

no test coverage detected