/** * Allow to remove the preprocessing cache * * @param imgSource */ public void resetLastNodeOutputImage() { ImageOpNode node = getLastNode(); if (node != null) { node.setParam(Param.OUTPUT_IMG, null); } }
@Override public boolean setParamValue(String opName, String param, Object value) { if (opName != null && param != null) { ImageOpNode node = getNode(opName); if (node != null) { node.setParam(param, value); return true; } } return false; }
@Override public void setFirstNode(PlanarImage imgSource) { ImageOpNode node = getFirstNode(); if (node != null) { node.setParam(Param.INPUT_IMG, imgSource); } }
public void updateCropDisplay(AcquireImageInfo imageInfo) { ImageOpNode node = imageInfo.getPreProcessOpManager().getNode(MaskOp.OP_NAME); if (node == null) { node = new MaskOp(); imageInfo.addPreProcessImageOperationAction(node); } else { node.clearIOCache(); } node.setParam(MaskOp.P_SHOW, true); node.setParam(MaskOp.P_SHAPE, imageInfo.getNextValues().getCropZone()); node.setParam(MaskOp.P_ALPHA, 0.7); }
@Override public PlanarImage process() { PlanarImage source = getFirstNodeInputImage(); if (source != null && source.width() > 0) { for (int i = 0; i < operations.size(); i++) { ImageOpNode op = operations.get(i); try { if (i > 0) { op.setParam(Param.INPUT_IMG, operations.get(i - 1).getParam(Param.OUTPUT_IMG)); } if (op.isEnabled()) { op.process(); } else { // Skip this operation op.setParam(Param.OUTPUT_IMG, op.getParam(Param.INPUT_IMG)); } } catch (Exception e) { LOGGER.error("Image {} failed: {}", op.getParam(Param.NAME), e); //$NON-NLS-1$ op.setParam(Param.OUTPUT_IMG, op.getParam(Param.INPUT_IMG)); } } } else { clearNodeIOCache(); } return getLastNodeOutputImage(); }
@Override public void zoom(Double viewScale) { E img = imageLayer.getSourceImage(); ImageOpNode node = imageLayer.getDisplayOpManager().getNode(AffineTransformOp.OP_NAME); if (img != null && node != null) { node.setParam(Param.INPUT_IMG, getSourceImage()); actionsInView.put(ActionW.ZOOM.cmd(), viewScale); super.zoom(Math.abs(viewScale)); updateAffineTransform(); } }
@Override public void applyNextValues() { AcquireImageInfo imageInfo = AcquireObject.getImageInfo(); ImageOpNode node = imageInfo.getPreProcessOpManager().getNode(BrightnessOp.OP_NAME); if (node == null) { node = new BrightnessOp(); imageInfo.addPreProcessImageOperationAction(node); } else { node.clearIOCache(); } node.setParam(BrightnessOp.P_BRIGTNESS_VALUE, (double) imageInfo.getNextValues().getBrightness()); node.setParam(BrightnessOp.P_CONTRAST_VALUE, (double) imageInfo.getNextValues().getContrast()); } }
private void operationRotate(JMenu operationsMenu, final List<E> medias, String label, final int angle) { operationsMenu.add(new JMenuItem(new DefaultAction(label, event -> medias.stream().filter(ImageElement.class::isInstance).map(ImageElement.class::cast).forEach(i -> { AcquireImageInfo info = AcquireManager.findByImage(i); int change = (info.getNextValues().getFullRotation() + angle >= 0) ? info.getNextValues().getRotation() + angle : info.getNextValues().getRotation() + 360 + angle; info.getNextValues().setRotation(change); ImageOpNode node = info.getPreProcessOpManager().getNode(RotationOp.OP_NAME); if (node == null) { node = new RotationOp(); info.addPreProcessImageOperationAction(node); } else { node.clearIOCache(); } node.setParam(RotationOp.P_ROTATE, info.getNextValues().getFullRotation()); })))); }
@Override public void applyNextValues() { AcquireImageInfo imageInfo = getImageInfo(); ImageOpNode node = imageInfo.getPreProcessOpManager().getNode(AutoLevelsOp.OP_NAME); if (node == null) { node = new AutoLevelsOp(); imageInfo.addPreProcessImageOperationAction(node); } else { node.clearIOCache(); } node.setParam(AutoLevelsOp.P_AUTO_LEVEL, imageInfo.getNextValues().isAutoLevel()); }
node.setParam(ActionW.PRESET.cmd(), newPreset); node.setParam(ActionW.DEFAULT_PRESET.cmd(), isDefaultPresetSelected); node.setParam(ActionW.WINDOW.cmd(), windowValue); node.setParam(ActionW.LEVEL.cmd(), levelValue); node.setParam(ActionW.LEVEL_MIN.cmd(), levelMin); node.setParam(ActionW.LEVEL_MAX.cmd(), levelMax); node.setParam(ActionW.LUT_SHAPE.cmd(), lutShapeItem);
node.setParam(ActionW.WINDOW.cmd(), preset.getWindow()); node.setParam(ActionW.LEVEL.cmd(), preset.getLevel()); node.setParam(ActionW.LUT_SHAPE.cmd(), preset.getLutShape()); node.setParam(ActionW.PRESET.cmd(), preset); ImageOpNode node = disOp.getNode(WindowOp.OP_NAME); if (node != null) { node.setParam(ActionW.LUT_SHAPE.cmd(), val);