@Override public Object getParamValue(String opName, String param) { if (opName != null && param != null) { ImageOpNode node = getNode(opName); if (node != null) { return node.getParam(param); } } return null; }
@Override public PlanarImage getFirstNodeInputImage() { ImageOpNode node = getFirstNode(); if (node != null) { return (PlanarImage) node.getParam(Param.INPUT_IMG); } return null; }
@Override public PlanarImage getLastNodeOutputImage() { ImageOpNode node = getLastNode(); if (node != null) { return (PlanarImage) node.getParam(Param.OUTPUT_IMG); } return null; }
@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(); }
if (node != null) { int imageDataType = ImageConversion.convertToDataType(image.getImage().type()); PresetWindowLevel preset = (PresetWindowLevel) node.getParam(ActionW.PRESET.cmd()); boolean defaultPreset = LangUtil.getNULLtoTrue((Boolean) node.getParam(ActionW.DEFAULT_PRESET.cmd())); Double windowValue = (Double) node.getParam(ActionW.WINDOW.cmd()); Double levelValue = (Double) node.getParam(ActionW.LEVEL.cmd()); LutShape lutShapeItem = (LutShape) node.getParam(ActionW.LUT_SHAPE.cmd()); boolean pixelPadding = LangUtil.getNULLtoTrue((Boolean) node.getParam(ActionW.IMAGE_PIX_PADDING.cmd())); PresentationStateReader prReader = (PresentationStateReader) view2d.getActionValue(PresentationStateReader.TAG_PR_READER); levelValue = levelAction.get().getRealValue(); Double levelMin = (Double) node.getParam(ActionW.LEVEL_MIN.cmd()); Double levelMax = (Double) node.getParam(ActionW.LEVEL_MAX.cmd()); if (levelMin == null || levelMax == null) { minLevel = Math.min(levelValue - windowValue / 2.0, image.getMinValue(prReader, pixelPadding));
ByteLut lut = null; if (pseudoColorOp != null) { lut = (ByteLut) pseudoColorOp.getParam(PseudoColorOp.P_LUT); lut = ByteLut.grayLUT; byte[][] table = LangUtil.getNULLtoFalse((Boolean) pseudoColorOp.getParam(PseudoColorOp.P_LUT_INVERSE)) ? lut.getInvertedLutTable() : lut.getLutTable(); float length = table[0].length;
void freezeParentParameters() { SimpleOpManager pManager = view2d.getImageLayer().getDisplayOpManager(); freezeActionsInView.clear(); view2d.copyActionWState(freezeActionsInView); freezeOperations = new SimpleOpManager(); for (ImageOpNode op : pManager.getOperations()) { if (AffineTransformOp.OP_NAME.equals(op.getParam(Param.NAME))) { break; } ImageOpNode operation = op.copy(); freezeOperations.addImageOperationAction(operation); } freezeOperations.setFirstNode(imageLayer.getSourceRenderedImage()); freezeOperations.process(); }
protected PlanarImage getSourceImage() { SyncType type = (SyncType) actionsInView.get(ZoomWin.FREEZE_CMD); if (SyncType.PARENT_PARAMETERS.equals(type) || SyncType.PARENT_IMAGE.equals(type)) { return freezeOperations.getLastNodeOutputImage(); } // return the image before the zoom operation from the parent view ImageOpNode node = view2d.getImageLayer().getDisplayOpManager().getNode(AffineTransformOp.OP_NAME); if (node != null) { return (PlanarImage) node.getParam(Param.INPUT_IMG); } return view2d.getImageLayer().getDisplayOpManager().getLastNodeOutputImage(); }
if (node != null) { List<PresetWindowLevel> presetList = img.getPresetList(LangUtil.getNULLtoTrue((Boolean) node.getParam(ActionW.IMAGE_PIX_PADDING.cmd()))); PresetWindowLevel autoPR = getAutoLevelPreset(presets); if (autoPR != null) {
Optional<SliderChangeListener> levelAction = getAction(ActionW.LEVEL, SliderChangeListener.class); if (windowAction.isPresent() && levelAction.isPresent()) { Double windowValue = (Double) node.getParam(ActionW.WINDOW.cmd()); Double levelValue = (Double) node.getParam(ActionW.LEVEL.cmd()); levelValue = levelAction.get().getRealValue(); Double levelMin = (Double) node.getParam(ActionW.LEVEL_MIN.cmd()); Double levelMax = (Double) node.getParam(ActionW.LEVEL_MAX.cmd()); if (levelMin == null || levelMax == null) { minLevel = levelValue - windowValue / 2.0;