public void removeImageOperationAction(ImageOpNode action) { if (action != null) { boolean remove = operations.remove(action); if (nodes.remove(action.getName()) == null && remove) { for (Entry<String, ImageOpNode> entry : nodes.entrySet()) { if (entry.getValue() == action) { nodes.remove(entry.getKey()); break; } } } } }
public void addImageOperationAction(ImageOpNode action, Position pos, ImageOpNode positionRef) { if (action != null) { String title = action.getName(); int k = 2; while (nodes.get(title) != null) { title += " " + k; //$NON-NLS-1$ k++; } if (k > 2) { action.setName(title); LOGGER.warn("This name already exists, rename to {}.", title); //$NON-NLS-1$ } nodes.put(title, action); if (positionRef != null) { int index = operations.indexOf(positionRef); if (Position.AFTER.equals(pos)) { index++; } if (index >= 0) { operations.add(index, action); } else { operations.add(action); } } else { operations.add(action); } } }
private static void changePixelSize(DicomImageElement img, Map<String, Object> actionsInView, double[] prPixSize) { img.setPixelSize(prPixSize[1], prPixSize[0]); actionsInView.put(PRManager.TAG_CHANGE_PIX_CONFIG, true); ZoomOp node = img.getRectifyAspectRatioZoomOp(); if (node != null) { SimpleOpManager process = new SimpleOpManager(); process.addImageOperationAction(node); OpManager preprocessing = (OpManager) actionsInView.get(ActionW.PREPROCESSING.cmd()); if (preprocessing != null) { for (ImageOpNode op : preprocessing.getOperations()) { if (!node.getName().equals(op.getName())) { process.addImageOperationAction(op); } } } actionsInView.put(ActionW.PREPROCESSING.cmd(), process); } }
public void applyPreProcess(ViewCanvas<ImageElement> view) { for (ImageOpNode action : postProcessOpManager.getOperations()) { if (preProcessOpManager.getNode(action.getName()) == null) { preProcessOpManager.addImageOperationAction(action.copy()); } } if (view != null) { view.getImageLayer().setImage(view.getImage(), preProcessOpManager); } }
@Override public void setImage(E image, OpManager preprocessing) { boolean init = (image != null && !image.equals(this.sourceImage)) || (image == null && sourceImage != null); this.sourceImage = image; this.preprocessing = preprocessing; // Rectify non square pixel image in the first operation if (sourceImage != null) { ZoomOp node = sourceImage.getRectifyAspectRatioZoomOp(); if (node != null) { SimpleOpManager process = new SimpleOpManager(); process.addImageOperationAction(node); if (preprocessing != null) { for (ImageOpNode op : preprocessing.getOperations()) { if (!node.getName().equals(op.getName())) { process.addImageOperationAction(op); } } } this.preprocessing = process; } } if (preprocessing != null || init) { disOpManager.setFirstNode(getSourceRenderedImage()); updateDisplayOperations(); } }