Package ij.measure

Examples of ij.measure.Calibration


    imp.setStack(null, stack2);
    if (virtual) {
      IJ.showProgress(1.0);
      imp.setTitle(imp.getTitle());
    }
    Calibration cal = imp.getCalibration();
    if (cal.scaled()) cal.pixelDepth *= factor;
  }
View Full Code Here


          stack2.addSlice(stack.getSliceLabel(i), ip);
        }
      }
    }
    imp.setStack(stack2, channels, slices2, frames2);
    Calibration cal = imp.getCalibration();
    if (cal.scaled()) cal.pixelDepth *= zfactor;
    if (virtual) imp.setTitle(imp.getTitle());
    IJ.showProgress(1.0);
  }
View Full Code Here

  public void run(String arg) {
    imp = IJ.getImage();
    stackSize = imp!=null?imp.getStackSize():0;
    Roi roi = imp.getRoi();
    Calibration cal = imp.getCalibration();
    if (roi!=null && roi.getBounds().equals(prevRoi) && cal.pixelWidth==prevPixelWidth)
      roi = null;
    if (roi!=null) {
        boolean rectOrOval = roi!=null && (roi.getType()==Roi.RECTANGLE||roi.getType()==Roi.OVAL);
        oval = rectOrOval && (roi.getType()==Roi.OVAL)// Handle existing oval ROI
      Rectangle r = roi.getBounds();
      width = r.width;
      height = r.height;
      xRoi = r.x;
      yRoi = r.y;
      if (scaledUnits && cal.scaled()) {
        xRoi = xRoi*cal.pixelWidth;
        yRoi = yRoi*cal.pixelHeight;
        width = width*cal.pixelWidth;
        height = height*cal.pixelHeight;
      }
 
View Full Code Here

    iSlice = imp.getCurrentSlice();
    showDialog();
  }
 
  boolean validDialogValues() {
    Calibration cal = imp.getCalibration();
    double pw=cal.pixelWidth, ph=cal.pixelHeight;
    if (width/pw<1.5 || height/ph<1.5)
      return false;
    if (xRoi/pw>=imp.getWidth() || yRoi/ph>=imp.getHeight())
      return false;
View Full Code Here

     *  Creates a dialog box, allowing the user to enter the requested
     *  width, height, x & y coordinates, slice number for a Region Of Interest,
     *  option for oval, and option for whether x & y coordinates to be centered.
     */
    void showDialog() {
      Calibration cal = imp.getCalibration();
      int digits = 0;
      if (scaledUnits && cal.scaled())
        digits = 2;
      Roi roi = imp.getRoi();
      if (roi==null)
        drawRoi();
        GenericDialog gd = new GenericDialog("Specify");
        gd.addNumericField("Width:", width, digits);
        gd.addNumericField("Height:", height, digits);
        gd.addNumericField("X Coordinate:", xRoi, digits);
        gd.addNumericField("Y Coordinate:", yRoi, digits);
        if (stackSize>1)
          gd.addNumericField("Slice:", iSlice, 0);
        gd.addCheckbox("Oval", oval);
        gd.addCheckbox("Centered",centered);
        if (cal.scaled())
            gd.addCheckbox("Scaled Units ("+cal.getUnits()+")", scaledUnits);
        fields = gd.getNumericFields();
        gd.addDialogListener(this);
        gd.showDialog();
        if (gd.wasCanceled()) {
           if (roi==null)
View Full Code Here

      iX = (int)(xRoi - (width/2));
      iY = (int)(yRoi - (height/2));
    }
    int iWidth = (int)width;
    int iHeight = (int)height;
    Calibration cal = imp.getCalibration();
    if (scaledUnits && cal.scaled()) {
      iX = (int)Math.round(iX/cal.pixelWidth);
      iY = (int)Math.round(iY/cal.pixelHeight);
      iWidth = (int)Math.round(width/cal.pixelWidth);
      iHeight = (int)Math.round(height/cal.pixelHeight);
      prevPixelWidth = cal.pixelWidth;
View Full Code Here

 
  /** Returns the plot as an ImagePlus. */
  public ImagePlus getImagePlus() {
    draw();
    ImagePlus img = new ImagePlus(title, ip);
    Calibration cal = img.getCalibration();
    cal.xOrigin = LEFT_MARGIN;
    cal.yOrigin = TOP_MARGIN+frameHeight+yMin*yScale;
    cal.pixelWidth = 1.0/xScale;
    cal.pixelHeight = 1.0/yScale;
    cal.setInvertY(true);
    return img;
  }
View Full Code Here

    double lower = ip.getMinThreshold();
    if (lower!=ImageProcessor.NO_THRESHOLD) {
      transparencyLower = (int)lower;
      transparencyUpper = (int)ip.getMaxThreshold();
    }
    Calibration cal = imp.getCalibration();
    boolean hyperstack = imp.isHyperStack() && imp.getNFrames()>1;
    GenericDialog gd = new GenericDialog("3D Projection");
    gd.addChoice("Projection Method:", methodList, methodList[projectionMethod]);
    gd.addChoice("Axis of Rotation:", axisList, axisList[axisOfRotation]);
    //gd.addMessage("");
    gd.addNumericField("Slice Spacing ("+cal.getUnits()+"):",cal.pixelDepth,2);

    gd.addNumericField("Initial Angle (0-359 degrees):", initAngle, 0);
    gd.addNumericField("Total Rotation (0-359 degrees):", totalAngle, 0);
    gd.addNumericField("Rotation Angle Increment:", angleInc, 0);
    gd.addNumericField("Lower Transparency Bound:", transparencyLower, 0);
View Full Code Here

        RGBStackSplitter splitter = new RGBStackSplitter();
        splitter.split(imp.getStack(), true);
        ImagePlus red = new ImagePlus("Red", splitter.red);
        ImagePlus green = new ImagePlus("Green", splitter.green);
        ImagePlus blue = new ImagePlus("Blue", splitter.blue);
        Calibration cal = imp.getCalibration();
        Roi roi = imp.getRoi();
        if (roi!=null)
          {red.setRoi(roi); green.setRoi(roi); blue.setRoi(roi);}
        red.setCalibration(cal); green.setCalibration(cal); blue.setCalibration(cal);
        label = "Red: ";
View Full Code Here

      imp2 = run(imp, first, last);
    else if (duplicateStack || imp.getStackSize()==1)
      imp2 = run(imp);
    else
      imp2 = duplicateImage(imp);
    Calibration cal = imp2.getCalibration();
    if (roi!=null && (cal.xOrigin!=0.0||cal.yOrigin!=0.0)) {
      cal.xOrigin -= roi.getBounds().x;
      cal.yOrigin -= roi.getBounds().y;
    }
    imp2.setTitle(newTitle);
View Full Code Here

TOP

Related Classes of ij.measure.Calibration

Copyright © 2018 www.massapicom. 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.