public void toggleShowMeasurements() { if (showMeasurements.isSelected()) { measurements.setStructures(currentNucId, currentStructureIdx); measurements.setObjects(list.getSelectedValues()); this.container.add(measurements); } else this.container.remove(measurements); core.refreshDisplay(); }
public void hide(boolean refresh) { container.remove(layout); if (showMeasurements.isSelected()) { container.remove(measurements); showMeasurements.setSelected(false); } if (refresh) core.refreshDisplay(); }
@Override public void valueChanged(ListSelectionEvent lse) { if (lse.getValueIsAdjusting()) { return; } if (populatingObjects || selectingObject || !showObjects.isSelected()) { return; } selectingObject = true; if (measurements != null && showMeasurements.isSelected()) measurements.setObjects(list.getSelectedValues()); try { showRois3D(); } catch (Exception e) { exceptionPrinter.print(e, "", Core.GUIMode); } selectingObject = false; }
public void setStructures(ObjectId id, Object[] selectedChannels) { // System.out.println("Set Structures: cell"+id+ " sel channels // length"+selectedChannels.length); this.currentNucId = id; this.currentChannels = new ObjectStructure[selectedChannels.length]; currentStructureIdx = new int[selectedChannels.length]; for (int i = 0; i < selectedChannels.length; i++) { currentChannels[i] = (ObjectStructure) selectedChannels[i]; currentStructureIdx[i] = currentChannels[i].getIdx(); } setSortKeys(); populateObjects(); if (showMeasurements.isSelected()) { measurements.setStructures(id, currentStructureIdx); measurements.setObjects(list.getSelectedValues()); } }
public void populateObjects() { try { this.listModel.removeAllElements(); if (currentChannels == null) { return; } this.populatingObjects = true; ArrayList<Integer> selection = null; if (showSelection != null && showSelection.isSelected()) selection = new ArrayList<Integer>(); int currentIdx = 0; for (ObjectStructure ass : currentChannels) { Object3D[] os = ass.getObjects(); if (os != null) { Object3DGui[] osg = new Object3DGui[os.length]; for (int i = 0; i < os.length; i++) osg[i] = new Object3DGui(os[i], ass); if (layout instanceof ObjectManagerLayout && currentChannels.length == 1 && !((ObjectManagerLayout) layout).getSortKey().equals("idx")) this.sort(((ObjectManagerLayout) layout).getSortKey(), osg, ass.getIdx()); // System.out.println("populating objects.. nb objects:"+os.length); for (Object3DGui o3D : osg) { this.listModel.addElement(o3D); if (selection != null && o3D.isInSelection()) selection.add(currentIdx); currentIdx++; } // if (selection!=null) System.out.println("populating objects.. selection // size:"+selection.size()); } // else System.out.println("no objects int channel:"+ass.getChannelName()); } if (selection != null && !selection.isEmpty()) { int[] sel = new int[selection.size()]; int i = 0; for (int idx : selection) sel[i++] = idx; list.setSelectedIndices(sel); } } catch (Exception e) { exceptionPrinter.print(e, "", Core.GUIMode); } this.populatingObjects = false; }