//static int cycleSegmentedComponents2_outline = 4; static void cycleSegmentedComponents2(final BufferedImage img, final BufferedImage bigImg, final L components) { final new Var is; final Var iComponent = new(-1); Runnable nextImage = r { iComponent.set(mod(iComponent!+1, l(components)); ConnectedComponent c = components.get(iComponent!); print("Bounding box: " + pixelSetBounds(c) + ", rectangleness: " + pixelSetRectangleness(c)); is.set(packFrameInTopRightCorner(showZoomedImage(is!, cutOutPixelSet_scale(img, bigImg, c/*, cycleSegmentedComponents2_outline*/), "Cut out " + (iComponent!+1) + "/" + l(components))); }; callF(nextImage); packInTopRightCorner(addToWindow(is!, jcenteredbuttons( "Next", nextImage, "Save", r { final JTextField tf = jtextfield(); showTitledForm("Save image", "Name", tf, r { ConnectedComponent c = components.get(iComponent!); BufferedImage cut = cutOutPixelSet(img, c); print("Cut: " + cut.getWidth() + "*" + cut.getHeight() + " - " + l(toPNG(cut)) + " bytes"); S imageID = uploadToLocalImageDB(cut, getTextTrim(tf)); infoBoxTopLeftCorner("Image saved as " + imageID); }); }))); }