Example #1
0
 protected boolean split(Object3DGui og) {
   if (!(this instanceof NucleusManager) && og.getChannel() instanceof Nucleus) {
     if (Core.GUIMode) ij.IJ.log("Cannont split nucleus!");
     return false;
   }
   Object3DGui[] newObjects = og.split(splitRad.getFloatValue(2), splitDist.getFloatValue(5));
   if (newObjects.length == 0) {
     if (Core.GUIMode) ij.IJ.log("Object couldn't be split");
     return false;
   }
   Object3D[] objs = og.getChannel().getObjects();
   int nextLabel = objs[objs.length - 1].getValue() + 1;
   for (Object3DGui o : newObjects) {
     o.changeLabel(nextLabel);
     this.listModel.addElement(o); // TODO le mettre a la fin des objets du channel..
     nextLabel++;
   }
   og.getChannel().getSegmented().updateDisplay();
   return true;
 }
Example #2
0
  public void manualSegmentation() {
    msChannel = null;
    if (currentChannels != null) {
      if (!(currentChannels[0] instanceof Nucleus)) {
        msChannel = (Structure) currentChannels[0];
      } else if (currentChannels.length > 1) {
        msChannel = (Structure) currentChannels[1];
      }
    }
    if (msChannel instanceof VirtualStructure) {
      return;
    }
    if (msChannel != null) {
      ImageInt seg = msChannel.getSegmented();
      ImageHandler raw = msChannel.getFiltered();
      if (raw == null) {
        if (Core.GUIMode) ij.IJ.log("ERROR: no raw images!");
        return;
      }
      if (seg == null) {
        seg =
            new ImageShort(
                msChannel.getChannelName() + "::Segmented", raw.sizeX, raw.sizeY, raw.sizeZ);
        msChannel.setSegmented(seg);
      }
      seg.show();
      raw.show();
      manualSpot =
          new ManualSpot(raw.getImagePlus(), seg.getImagePlus(), (int) seg.getMax(null) + 1);
      manualSpot.setVisible(true);

      JButton msClose = manualSpot.jButtonClose;
      msClose.addActionListener(
          new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              if (msChannel != null) {
                msChannel.saveOutput();
                msChannel.createObjects();
                populateObjects();
              }
            }
          });
    }
  }
Example #3
0
 private void sort(String key, Object3DGui[] objectsGui, int structureIdx) {
   Object3DGui.setAscendingOrger(((ObjectManagerLayout) layout).getAscendingOrder());
   HashMap<Integer, BasicDBObject> objects =
       Core.getExperiment().getConnector().getObjects(currentNucId, structureIdx);
   boolean notFound = false;
   for (Object3DGui o : objectsGui) {
     BasicDBObject dbo = objects.get(o.getLabel());
     if (dbo != null) {
       if (dbo.containsField(key)) o.setValue(dbo.getDouble(key));
       else {
         o.setValue(-1);
         notFound = true;
       }
     }
   }
   if (notFound)
     ij.IJ.log("Warning measurement: " + key + " not found for one or several objects");
   Arrays.sort(objectsGui);
 }