private synchronized void performWork() { if( filter1 == null || filter2 == null ) return; GThresholdImageOps.threshold(imageInput, imageBinary, selectThresh.getThreshold(), selectThresh.isDown()); filter1.process(imageBinary,imageOutput1); filter2.process(imageOutput1,imageOutput2); List<Contour> found = BinaryImageOps.contour(imageOutput2, connectRule, imageLabeled); if( colors == null || colors.length <= found.size() ) colors = BinaryImageOps.selectRandomColors(found.size(),rand); SwingUtilities.invokeLater(new Runnable() { public void run() { if (work == null || work.getWidth() != imageInput.width || work.getHeight() != imageInput.height) { work = new BufferedImage(imageInput.width, imageInput.height, BufferedImage.TYPE_INT_BGR); } renderVisualizeImage(); gui.setImage(work); gui.setPreferredSize(new Dimension(imageInput.width, imageInput.height)); processedImage = true; gui.repaint(); } }); }
public ImageBinaryLabeledPanel(GrayS32 labelImage, int maxValues , long randSeed ) { this(); this.labelImage = labelImage; img = new BufferedImage(labelImage.getWidth(), labelImage.getHeight(),BufferedImage.TYPE_INT_RGB); setPreferredSize(new Dimension(labelImage.getWidth(), labelImage.getHeight())); setMinimumSize(getPreferredSize()); setMaximumSize(getPreferredSize()); Random rand = new Random(randSeed); colors = BinaryImageOps.selectRandomColors(maxValues,rand); VisualizeBinaryData.renderLabeled(labelImage, colors, img); }
public ImageBinaryLabeledPanel(GrayS32 labelImage, int maxValues , long randSeed ) { this(); this.labelImage = labelImage; img = new BufferedImage(labelImage.getWidth(), labelImage.getHeight(),BufferedImage.TYPE_INT_RGB); setPreferredSize(new Dimension(labelImage.getWidth(), labelImage.getHeight())); setMinimumSize(getPreferredSize()); setMaximumSize(getPreferredSize()); Random rand = new Random(randSeed); colors = BinaryImageOps.selectRandomColors(maxValues,rand); VisualizeBinaryData.renderLabeled(labelImage, colors, img); }