Examples of Calibration


Examples of ij.measure.Calibration

    IJ.error("FileSaver", "An error occured writing the file.\n \n" + msg);
  }

  /** Returns a string containing information about the specified  image. */
  public String getDescriptionString() {
    Calibration cal = imp.getCalibration();
    StringBuffer sb = new StringBuffer(100);
    sb.append("ImageJ="+ImageJ.VERSION+"\n");
    if (fi.nImages>1 && fi.fileType!=FileInfo.RGB48)
      sb.append("images="+fi.nImages+"\n");
    int channels = imp.getNChannels();
    if (channels>1)
      sb.append("channels="+channels+"\n");
    int slices = imp.getNSlices();
    if (slices>1)
      sb.append("slices="+slices+"\n");
    int frames = imp.getNFrames();
    if (frames>1)
      sb.append("frames="+frames+"\n");
    if (fi.unit!=null)
      sb.append("unit="+fi.unit+"\n");
    if (fi.valueUnit!=null && fi.calibrationFunction!=Calibration.CUSTOM) {
      sb.append("cf="+fi.calibrationFunction+"\n");
      if (fi.coefficients!=null) {
        for (int i=0; i<fi.coefficients.length; i++)
          sb.append("c"+i+"="+fi.coefficients[i]+"\n");
      }
      sb.append("vunit="+fi.valueUnit+"\n");
      if (cal.zeroClip()) sb.append("zeroclip=true\n");
    }
   
    // get stack z-spacing and fps
    if (fi.nImages>1) {
      if (fi.pixelDepth!=0.0 && fi.pixelDepth!=1.0)
        sb.append("spacing="+fi.pixelDepth+"\n");
      if (cal.fps!=0.0) {
        if ((int)cal.fps==cal.fps)
          sb.append("fps="+(int)cal.fps+"\n");
        else
          sb.append("fps="+cal.fps+"\n");
      }
      sb.append("loop="+(cal.loop?"true":"false")+"\n");
      if (cal.frameInterval!=0.0) {
        if ((int)cal.frameInterval==cal.frameInterval)
          sb.append("finterval="+(int)cal.frameInterval+"\n");
        else
          sb.append("finterval="+cal.frameInterval+"\n");
      }
      if (!cal.getTimeUnit().equals("sec"))
        sb.append("tunit="+cal.getTimeUnit()+"\n");
    }
   
    // get min and max display values
    ImageProcessor ip = imp.getProcessor();
    double min = ip.getMin();
View Full Code Here

Examples of ij.measure.Calibration

    }
    if (stack!=null) {
      imp = new ImagePlus("Imported Stack", stack);
      if (imp.getBitDepth()==16 || imp.getBitDepth()==32)
        imp.getProcessor().setMinAndMax(min, max);
                Calibration cal = imp.getCalibration();
                if (fi.fileType==FileInfo.GRAY16_SIGNED) {
                    double[] coeff = new double[2];
                    coeff[0] = -32768.0;
                    coeff[1] = 1.0;
                    cal.setFunction(Calibration.STRAIGHT_LINE, coeff, "gray value");
                }
      imp.show();
    }
  }
View Full Code Here

Examples of ij.measure.Calibration

  /** Sets the minimum and maximum displayed pixel values. */
  public static void setMinAndMax(double min, double max) {
    ImagePlus img = getImage();
    if (img.getBitDepth()==16) {
      Calibration cal = img.getCalibration();
      min = cal.getRawValue(min);
      max = cal.getRawValue(max);
    }
    img.getProcessor().setMinAndMax(min, max);
    img.updateAndDraw();
  }
View Full Code Here

Examples of ij.measure.Calibration

      else if (displayMode.indexOf("no")!=-1)
        mode = ImageProcessor.NO_LUT_UPDATE;
    }
    ImagePlus img = getImage();
    if (img.getBitDepth()==16) {
      Calibration cal = img.getCalibration();
      lowerThreshold = cal.getRawValue(lowerThreshold);
      upperThreshold = cal.getRawValue(upperThreshold);
    }
    img.getProcessor().setThreshold(lowerThreshold, upperThreshold, mode);
    if (mode != ImageProcessor.NO_LUT_UPDATE) {
      img.getProcessor().setLutAnimation(true);
      img.updateAndDraw();
View Full Code Here

Examples of ij.measure.Calibration

    if (count<2) {
      IJ.error("There must be at least two open images.");
      return;
    }

    Calibration cal2 = image[0].getCalibration();
    for (int i=0; i<(count-1); i++) {
      if (image[i].getType()!=image[i+1].getType()) {
        IJ.error("All open images must be the same type.");
        return;
      }
      if (image[i].getWidth()!=image[i+1].getWidth()
      || image[i].getHeight()!=image[i+1].getHeight()) {
        IJ.error("All open images must be the same size.");
        return;
      }
      Calibration cal = image[i].getCalibration();
      if (!image[i].getCalibration().equals(cal2))
        cal2 = null;
    }
   
    int width = image[0].getWidth();
View Full Code Here

Examples of ij.measure.Calibration

      "Are you sure you want to convert this\nstack to "
      +size+" separate windows?");
      if (!ok)
        {imp.unlock(); return;}
    }
    Calibration cal = imp.getCalibration();
    CompositeImage cimg = imp instanceof CompositeImage?(CompositeImage)imp:null;
    for (int i=1; i<=size; i++) {
      String label = stack.getShortSliceLabel(i);
      String title = label!=null&&!label.equals("")?label:getTitle(imp, i);
      ImageProcessor ip = stack.getProcessor(i);
View Full Code Here

Examples of ij.measure.Calibration

    if (win!=null)
      WindowManager.setCurrentWindow(win);
    Undo.reset();
    ImageStack stack1 = img1.getStack();
    StackProcessor sp = new StackProcessor(stack1, img1.getProcessor());
    Calibration cal2 = img2.getCalibration();
    img2.getProcessor().setCalibrationTable(cal2.getCTable());
    try {
      if (size2==1)
        sp.copyBits(img2.getProcessor(), 0, 0, mode);
      else
        sp.copyBits(img2.getStack(), 0, 0, mode);
View Full Code Here

Examples of ij.measure.Calibration

  void doOperation(ImagePlus img1, ImagePlus img2) {
    int mode = getBlitterMode();
    ImageProcessor ip1 = img1.getProcessor();
    ImageProcessor ip2 = img2.getProcessor();
    Calibration cal1 = img1.getCalibration();
    Calibration cal2 = img2.getCalibration();
    if (createWindow)
      ip1 = createNewImage(ip1, ip2, cal1);
    else {
      ImageWindow win = img1.getWindow();
      if (win!=null)
        WindowManager.setCurrentWindow(win);
      ip1.snapshot();
      Undo.setup(Undo.FILTER, img1);
    }
    if (floatResult) {
      ip2.setCalibrationTable(cal2.getCTable());
      ip2 = ip2.convertToFloat();
    }
    try {
      ip1.copyBits(ip2, 0, 0, mode);
    }
View Full Code Here

Examples of ij.measure.Calibration

    }
    return mode;
  }
 
  ImagePlus duplicateStack(ImagePlus img1) {
    Calibration cal = img1.getCalibration();
    ImageStack stack1 = img1.getStack();
    int width = stack1.getWidth();
    int height = stack1.getHeight();
    int n = stack1.getSize();
    ImageStack stack2 = img1.createEmptyStack();
    try {
      for (int i=1; i<=n; i++) {
        ImageProcessor ip1 = stack1.getProcessor(i);
        ip1.resetRoi();
        ImageProcessor ip2 = ip1.crop();
        if (floatResult) {
          ip2.setCalibrationTable(cal.getCTable());
          ip2 = ip2.convertToFloat();
        }
        stack2.addSlice(stack1.getSliceLabel(i), ip2);
      }
    }
View Full Code Here

Examples of ij.measure.Calibration

    imp.unlock(); // so users can adjust brightness/contrast/threshold
    swin.running2 = true;
    long time, nextTime=System.currentTimeMillis();
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    int sliceIncrement = 1;
    Calibration cal = imp.getCalibration();
    if (cal.fps!=0.0)
      animationRate = cal.fps;
    while (swin.running2) {
      time = System.currentTimeMillis();
      if (time<nextTime)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.