Exemple #1
0
 protected void updateRoi() {
   // System.out.println("image:"+currentImage.getTitle()+ " slice:"+currentImage.getSlice());
   Roi r = currentROIs.get(currentImage.getSlice());
   if (r != null) {
     currentImage.setRoi(r);
   } else {
     currentImage.killRoi();
   }
   currentImage.updateAndDraw();
 }
Exemple #2
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);
 }
Exemple #3
0
  public void showRois3D() {
    registerActiveImage();
    if (currentImage == null) return;
    // verifier que l'image active a les memes dimentions
    Object[] os = this.list.getSelectedValues();

    if (os.length == 1) {
      mcib3d.geom.Object3D o = ((Object3DGui) os[0]).getObject3D();
      currentImage.setSlice((o.getZmax() + o.getZmin()) / 2 + 1);
    }
    int nSlices = currentImage.getNSlices();

    currentROIs = new HashMap<Integer, Roi>(nSlices);
    // stores the roi mask to save memory..
    if (roiMask == null || !roiMask.sameDimentions(currentImage)) {
      roiMask = new ImageByte("mask", currentImage.getWidth(), currentImage.getHeight(), nSlices);
    } else {
      roiMask.erase();
    }
    ImageStack maskStack = roiMask.getImageStack();
    Object3DGui obj;
    for (Object o : os) {
      obj = (Object3DGui) o;
      obj.getObject3D().draw(maskStack, 255);
    }
    // roiMask.show();

    for (int i = 1; i <= nSlices; i++) {
      ImagePlus im = new ImagePlus("mask", maskStack.getProcessor(i));
      im.getProcessor().setThreshold(1, 255, ImageProcessor.NO_LUT_UPDATE);
      ThresholdToSelection tts = new ThresholdToSelection();
      tts.setup("", im);
      tts.run(im.getProcessor());
      Roi r = im.getRoi();
      if (r != null) currentROIs.put(i, r);
    }
    updateRoi();
  }