示例#1
0
 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();
 }
示例#2
0
 public void invertSelection() {
   int[] sel = this.list.getSelectedIndices();
   int[] newSel = new int[listModel.getSize() - sel.length];
   int idx = 0;
   int lastIdx = -1;
   for (int i : sel) {
     for (int i2 = lastIdx + 1; i2 < i; i2++) newSel[idx++] = i2;
     lastIdx = i;
   }
   for (int i2 = lastIdx + 1; i2 < listModel.getSize(); i2++) newSel[idx++] = i2;
   list.setSelectedIndices(newSel);
 }
示例#3
0
 protected HashMap<Integer, ArrayList<Object3DGui>> getSplitSelection() {
   System.out.println(
       "get split selection: currenChannels==null?" + (this.currentChannels == null));
   if (this.currentChannels == null) return new HashMap<Integer, ArrayList<Object3DGui>>(0);
   HashMap<Integer, ArrayList<Object3DGui>> res =
       new HashMap<Integer, ArrayList<Object3DGui>>(this.currentChannels.length);
   for (ObjectStructure ass : currentChannels) res.put(ass.getIdx(), new ArrayList<Object3DGui>());
   for (Object o : list.getSelectedValues()) {
     Object3DGui o3D = (Object3DGui) (o);
     int idx = o3D.getChannel().getIdx();
     res.get(idx).add(o3D);
   }
   return res;
 }
示例#4
0
 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());
   }
 }
示例#5
0
 @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;
 }
示例#6
0
 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;
 }
示例#7
0
 protected void initPanels() {
   BasicDBObject usr = Core.mongoConnector.getUser();
   splitDist = new DoubleParameter("Dist", "splitMinDistObj", 5d, DoubleParameter.nfDEC1);
   splitDist.dbGet(usr);
   splitRad = new DoubleParameter("Rad", "splitRadObj", 2d, DoubleParameter.nfDEC1);
   splitRad.dbGet(usr);
   ObjectManagerLayout lay = new ObjectManagerLayout(this);
   showObjects = lay.showROIs;
   showObjects.setSelected(true);
   splitDist.addToContainer(lay.splitDistPanel);
   showMeasurements = lay.viewMeasurements;
   measurements = new MeasurementDisplayer();
   this.listModel = new DefaultListModel();
   this.list = lay.list;
   this.list.setModel(listModel);
   this.list.setCellRenderer(new LCRenderer());
   this.list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
   this.list.setLayoutOrientation(JList.VERTICAL);
   listSelectionModel = list.getSelectionModel();
   listSelectionModel.addListSelectionListener(this);
   this.layout = lay;
 }
示例#8
0
 public void selectAll() {
   list.setSelectionInterval(0, list.getModel().getSize() - 1);
 }