Пример #1
0
  public void run(String arg) {
    ImagePlus image = WindowManager.getCurrentImage();
    try {
      Image3DUniverse univ = new Image3DUniverse();
      univ.show();
      GUI.center(univ.getWindow());
      // only when there is an image and we are not called
      // from a macro
      if (image != null && !IJ.isMacro()) univ.getExecuter().addContent(image, null);

    } catch (Exception e) {
      StringBuffer buf = new StringBuffer();
      StackTraceElement[] st = e.getStackTrace();
      buf.append(
          "An unexpected exception occurred. \n"
              + "Please mail me the following lines if you \n"
              + "need help.\n"
              + "[email protected]\n   \n");
      buf.append(e.getClass().getName() + ":" + e.getMessage() + "\n");
      for (int i = 0; i < st.length; i++) {
        buf.append(
            "    at "
                + st[i].getClassName()
                + "."
                + st[i].getMethodName()
                + "("
                + st[i].getFileName()
                + ":"
                + st[i].getLineNumber()
                + ")\n");
      }
      new ij.text.TextWindow("Error", buf.toString(), 500, 400);
    }
  }
Пример #2
0
 public static void setTransparency(String t) {
   Image3DUniverse univ = getUniv();
   float tr = Float.parseFloat(t);
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().setTransparency(tr);
   }
 }
Пример #3
0
 public static void setChannels(String red, String green, String blue) {
   Image3DUniverse univ = getUniv();
   boolean r = Boolean.valueOf(red).booleanValue();
   boolean g = Boolean.valueOf(green).booleanValue();
   boolean b = Boolean.valueOf(blue).booleanValue();
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().setChannels(new boolean[] {r, g, b});
   }
 }
Пример #4
0
 public static void setTransform(String transform) {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     String[] s = ij.util.Tools.split(transform);
     float[] m = new float[s.length];
     for (int i = 0; i < s.length; i++) {
       m[i] = Float.parseFloat(s[i]);
     }
     univ.getSelected().setTransform(new Transform3D(m));
   }
 }
Пример #5
0
  public static void fillSelection() {
    Image3DUniverse univ = getUniv();
    if (univ != null
        && univ.getSelected() != null
        && univ.getSelected().getType() == Content.VOLUME) {

      VoltexGroup vg = (VoltexGroup) univ.getSelected().getContent();
      ImageCanvas3D canvas = (ImageCanvas3D) univ.getCanvas();
      vg.fillRoi(canvas, canvas.getRoi(), (byte) 0);
    }
  }
Пример #6
0
  public static void addOrthoslice(
      String image, String c, String name, String r, String g, String b, String resamplingF) {

    Image3DUniverse univ = getUniv();
    ImagePlus grey = WindowManager.getImage(image);
    Color3f color = ColorTable.getColor(c);

    int factor = getInt(resamplingF);
    boolean[] channels = new boolean[] {getBoolean(r), getBoolean(g), getBoolean(b)};
    univ.addOrthoslice(grey, color, name, 0, channels, factor);
  }
Пример #7
0
  // Individual content's menu
  public static void setSlices(String x, String y, String z) {
    Image3DUniverse univ = getUniv();
    if (univ != null
        && univ.getSelected() != null
        && univ.getSelected().getType() == Content.ORTHO) {

      OrthoGroup vg = (OrthoGroup) univ.getSelected().getContent();
      vg.setSlice(VolumeRenderer.X_AXIS, getInt(x));
      vg.setSlice(VolumeRenderer.Y_AXIS, getInt(y));
      vg.setSlice(VolumeRenderer.Z_AXIS, getInt(z));
    }
  }
Пример #8
0
 public static void setColor(String red, String green, String blue) {
   Image3DUniverse univ = getUniv();
   if (univ == null || univ.getSelected() == null) return;
   Content sel = univ.getSelected();
   try {
     float r = getInt(red) / 256f;
     float g = getInt(green) / 256f;
     float b = getInt(blue) / 256f;
     if (univ != null && univ.getSelected() != null) {
       sel.setColor(new Color3f(r, g, b));
     }
   } catch (NumberFormatException e) {
     sel.setColor(null);
   }
 }
Пример #9
0
  // Contents menu
  public static void add(
      String image,
      String c,
      String name,
      String th,
      String r,
      String g,
      String b,
      String resamplingF,
      String type) {

    Image3DUniverse univ = getUniv();
    ImagePlus grey = WindowManager.getImage(image);
    Color3f color = ColorTable.getColor(c);

    int factor = getInt(resamplingF);
    int thresh = getInt(th);
    boolean[] channels = new boolean[] {getBoolean(r), getBoolean(g), getBoolean(b)};
    int ty = getInt(type);
    univ.addContent(grey, color, name, thresh, channels, factor, ty);
  }
Пример #10
0
 public static void startFreehandRecording() {
   Image3DUniverse univ = getUniv();
   if (univ != null) univ.startFreehandRecording();
 }
Пример #11
0
 public static void stopAnimate() {
   Image3DUniverse univ = getUniv();
   if (univ != null) univ.pauseAnimation();
 }
Пример #12
0
 public static void record360() {
   Image3DUniverse univ = getUniv();
   if (univ == null) return;
   ImagePlus movie = univ.record360();
   if (movie != null) movie.show();
 }
Пример #13
0
 public static void unlock() {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().setLocked(false);
   }
 }
Пример #14
0
 // View menu
 public static void resetView() {
   Image3DUniverse univ = getUniv();
   if (univ != null) univ.resetView();
 }
Пример #15
0
 public static void resetTransform() {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().setTransform(new Transform3D());
   }
 }
Пример #16
0
 public static void setThreshold(String s) {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().setThreshold(getInt(s));
   }
 }
Пример #17
0
 public static void setCoordinateSystem(String s) {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     univ.getSelected().showCoordinateSystem(getBoolean(s));
   }
 }
Пример #18
0
 public static void delete() {
   Image3DUniverse univ = getUniv();
   if (univ != null && univ.getSelected() != null) {
     univ.removeContent(univ.getSelected().getName());
   }
 }
Пример #19
0
 public static void stopFreehandRecording() {
   Image3DUniverse univ = getUniv();
   if (univ == null) return;
   ImagePlus movie = univ.stopFreehandRecording();
   if (movie != null) movie.show();
 }
Пример #20
0
 public static void close() {
   Image3DUniverse univ = getUniv();
   if (univ != null) {
     univ.close();
   }
 }
Пример #21
0
 public static void select(String name) {
   Image3DUniverse univ = getUniv();
   if (univ != null) univ.select((Content) univ.getContent(name));
 }