Esempio n. 1
0
 public void hide(boolean refresh) {
   container.remove(layout);
   if (showMeasurements.isSelected()) {
     container.remove(measurements);
     showMeasurements.setSelected(false);
   }
   if (refresh) core.refreshDisplay();
 }
Esempio n. 2
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();
 }
Esempio n. 3
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;
 }
Esempio n. 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());
   }
 }
Esempio n. 5
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;
 }
Esempio n. 6
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;
 }