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

Method update

ij/src/main/java/ij/plugin/frame/RoiManager.java:689–718  ·  view source on GitHub ↗
(boolean clone)

Source from the content-addressed store, hash-verified

687 }
688
689 boolean update(boolean clone) {
690 ImagePlus imp = getImage();
691 if (imp==null)
692 return false;
693 ImageCanvas ic = imp.getCanvas();
694 boolean showingAll = ic!=null && ic.getShowAllROIs();
695 Roi roi = imp.getRoi();
696 if (roi==null) {
697 error("The active image does not have a selection.");
698 return false;
699 }
700 int index = list.getSelectedIndex();
701 if (index<0 && !showingAll)
702 return error("Exactly one item in the list must be selected.");
703 if (index>=0) {
704 if (clone) {
705 String name = (String)listModel.getElementAt(index);
706 Roi roi2 = (Roi)roi.clone();
707 if (roi2.getPosition() != PointRoi.POINTWISE_POSITION)
708 roi2.setPosition(imp);
709 roi.setName(name);
710 roi2.setName(name);
711 rois.set(index, roi2);
712 } else
713 rois.set(index, roi);
714 }
715 if (record()) Recorder.record("roiManager", "Update");
716 updateShowAll();
717 return true;
718 }
719
720 boolean rename(String name2) {
721 int index = list.getSelectedIndex();

Callers 2

actionPerformedMethod · 0.95
runCommandMethod · 0.95

Calls 14

getImageMethod · 0.95
getCanvasMethod · 0.95
getShowAllROIsMethod · 0.95
getRoiMethod · 0.95
errorMethod · 0.95
cloneMethod · 0.95
getPositionMethod · 0.95
setPositionMethod · 0.95
setNameMethod · 0.95
recordMethod · 0.95
recordMethod · 0.95
updateShowAllMethod · 0.95

Tested by

no test coverage detected