ij.gui.Line.getWidth()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中ij.gui.Line.getWidth()方法的一些代码示例,展示了Line.getWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Line.getWidth()方法的具体详情如下:
包路径:ij.gui.Line
类名称:Line
方法名:getWidth

Line.getWidth介绍

暂无

代码示例

代码示例来源:origin: sc.fiji/Time_Lapse

protected ImagePlus doRegistration(ImagePlus image, boolean showSpreadsheet) {
  Roi[] rois = getRois(image);
  if (rois == null)
    return null;
  PolygonRoi[] polygons = new PolygonRoi[rois.length];
  System.arraycopy(rois, 0, polygons, 0, rois.length);
  return showKymograph(image, polygons, Line.getWidth(), showSpreadsheet, false);
}

代码示例来源:origin: net.imagej/imagej-legacy

@Override
public Line convert(final ij.gui.Line src) {
  if (log != null && ij.gui.Line.getWidth() > 1) {
    log.warn("Ignoring line width >1.");
  }
  return new IJLineWrapper(src);
}

代码示例来源:origin: sc.fiji/Time_Lapse

protected ImagePlus getStraightenedStack(ImagePlus image) {
  if (image == null)
    return null;
  return getStraightenedStack(image, Line.getWidth(), getRois(image));
}

代码示例来源:origin: imagej/ImageJA

public  synchronized void textValueChanged(TextEvent e) {
  int width = (int)Tools.parseDouble(tf.getText(), -1);
  //IJ.log(""+width);
  if (width==-1) return;
  if (width<0) width=1;
  if (width!=Line.getWidth()) {
    slider.setValue(width);
    value = width;
    notify();
  }
}
void setup() {

代码示例来源:origin: net.imagej/ij

public  synchronized void textValueChanged(TextEvent e) {
  int width = (int)Tools.parseDouble(tf.getText(), -1);
  //IJ.log(""+width);
  if (width==-1) return;
  if (width<0) width=1;
  if (width!=Line.getWidth()) {
    slider.setValue(width);
    value = width;
    notify();
  }
}
void setup() {

代码示例来源:origin: sc.fiji/Time_Lapse

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
  if ((e.getModifiersEx() & (e.CTRL_DOWN_MASK | e.ALT_DOWN_MASK)) == e.CTRL_DOWN_MASK) {
    int newWidth = Line.getWidth() - e.getWheelRotation();
    Line.setWidth(newWidth);
    if (roi != null) {
      roi.updateWideLine(newWidth);
      getImagePlus(e).setRoi(roi);
    }
    e.consume();
  }
}

代码示例来源:origin: net.imagej/ij

public static void update() {
  if (instance==null) return;
  instance.checkbox.setState(instance.isSplineFit());
  int sliderWidth = instance.slider.getValue();
  int lineWidth = Line.getWidth();
  if (lineWidth!=sliderWidth && lineWidth<=200) {
    instance.slider.setValue(lineWidth);
    instance.tf.setText(""+lineWidth);
  }
}

代码示例来源:origin: imagej/ImageJA

public static void update() {
  if (instance==null) return;
  instance.checkbox.setState(instance.isSplineFit());
  int sliderWidth = instance.slider.getValue();
  int lineWidth = Line.getWidth();
  if (lineWidth!=sliderWidth && lineWidth<=200) {
    instance.slider.setValue(lineWidth);
    instance.tf.setText(""+lineWidth);
  }
}

代码示例来源:origin: net.imagej/ij

void lineWidth() {
  int width = (int)IJ.getNumber("Line Width:", Line.getWidth());
  if (width==IJ.CANCELED) return;
  Line.setWidth(width);
  LineWidthAdjuster.update();
  ImagePlus imp = WindowManager.getCurrentImage();
  if (imp!=null && imp.isProcessor()) {
    ImageProcessor ip = imp.getProcessor();
    ip.setLineWidth(Line.getWidth());
    Roi roi = imp.getRoi();
    if (roi!=null && roi.isLine()) imp.draw();
  }
}

代码示例来源:origin: imagej/ImageJA

void lineWidth() {
  int width = (int)IJ.getNumber("Line Width:", Line.getWidth());
  if (width==IJ.CANCELED) return;
  Line.setWidth(width);
  LineWidthAdjuster.update();
  ImagePlus imp = WindowManager.getCurrentImage();
  if (imp!=null && imp.isProcessor()) {
    ImageProcessor ip = imp.getProcessor();
    ip.setLineWidth(Line.getWidth());
    Roi roi = imp.getRoi();
    if (roi!=null && roi.isLine()) imp.draw();
  }
}

代码示例来源:origin: net.imagej/ij

/** Draws an outline of this OvalRoi on the image. */
public void drawPixels(ImageProcessor ip) {
  Polygon p = getPolygon();
  if (p.npoints>0) {
    int saveWidth = ip.getLineWidth();
    if (getStrokeWidth()>1f)
      ip.setLineWidth((int)Math.round(getStrokeWidth()));
    ip.drawPolygon(p);
    ip.setLineWidth(saveWidth);
  }
  if (Line.getWidth()>1 || getStrokeWidth()>1)
    updateFullWindow = true;
}

代码示例来源:origin: imagej/ImageJA

/** Draws an outline of this OvalRoi on the image. */
public void drawPixels(ImageProcessor ip) {
  Polygon p = getPolygon();
  if (p.npoints>0) {
    int saveWidth = ip.getLineWidth();
    if (getStrokeWidth()>1f)
      ip.setLineWidth((int)Math.round(getStrokeWidth()));
    ip.drawPolygon(p);
    ip.setLineWidth(saveWidth);
  }
  if (Line.getWidth()>1 || getStrokeWidth()>1)
    updateFullWindow = true;
}

代码示例来源:origin: net.imagej/ij

private static void updateRoi() {
  ImagePlus imp = WindowManager.getCurrentImage();
  if (imp!=null) {
    Roi roi = imp.getRoi();
    if (roi!=null && roi.isLine()) {
      roi.updateWideLine(Line.getWidth());
      imp.draw();
      return;
    }
  }
  if (Roi.previousRoi==null) return;
  int id = Roi.previousRoi.getImageID();
  if (id>=0) return;
  imp = WindowManager.getImage(id);
  if (imp==null) return;
  Roi roi = imp.getRoi();
  if (roi!=null && roi.isLine()) {
    roi.updateWideLine(Line.getWidth());
    imp.draw();
  }
}

代码示例来源:origin: imagej/ImageJA

private static void updateRoi() {
  ImagePlus imp = WindowManager.getCurrentImage();
  if (imp!=null) {
    Roi roi = imp.getRoi();
    if (roi!=null && roi.isLine()) {
      roi.updateWideLine(Line.getWidth());
      imp.draw();
      return;
    }
  }
  if (Roi.previousRoi==null) return;
  int id = Roi.previousRoi.getImageID();
  if (id>=0) return;
  imp = WindowManager.getImage(id);
  if (imp==null) return;
  Roi roi = imp.getRoi();
  if (roi!=null && roi.isLine()) {
    roi.updateWideLine(Line.getWidth());
    imp.draw();
  }
}

代码示例来源:origin: net.imagej/ij

/** Draws the selection outline on the specified ImageProcessor.
  @see ij.process.ImageProcessor#setColor
  @see ij.process.ImageProcessor#setLineWidth
*/
public void drawPixels(ImageProcessor ip) {
  endPaste();
  int saveWidth = ip.getLineWidth();
  if (getStrokeWidth()>1f)
    ip.setLineWidth((int)Math.round(getStrokeWidth()));
  if (cornerDiameter>0)
    drawRoundedRect(ip);
  else {
    if (ip.getLineWidth()==1)
      ip.drawRect(x, y, width+1, height+1);
    else
      ip.drawRect(x, y, width, height);
  }
  ip.setLineWidth(saveWidth);
  if (Line.getWidth()>1 || getStrokeWidth()>1)
    updateFullWindow = true;
}

代码示例来源:origin: imagej/ImageJA

/** Draws the selection outline on the specified ImageProcessor.
  @see ij.process.ImageProcessor#setColor
  @see ij.process.ImageProcessor#setLineWidth
*/
public void drawPixels(ImageProcessor ip) {
  endPaste();
  int saveWidth = ip.getLineWidth();
  if (getStrokeWidth()>1f)
    ip.setLineWidth((int)Math.round(getStrokeWidth()));
  if (cornerDiameter>0)
    drawRoundedRect(ip);
  else {
    if (ip.getLineWidth()==1)
      ip.drawRect(x, y, width+1, height+1);
    else
      ip.drawRect(x, y, width, height);
  }
  ip.setLineWidth(saveWidth);
  if (Line.getWidth()>1 || getStrokeWidth()>1)
    updateFullWindow = true;
}

代码示例来源:origin: net.imagej/ij

/** Process a stack or part of it. The slice given by class variable
 *    processedAsPreview remains unchanged.
 * @param firstSlice Slice number of the first slice to be processed
 * @param endSlice     Slice number of the last slice to be processed
 */
private void processStack(int firstSlice, int endSlice) {
  ImageStack stack = imp.getStack();
  ImageProcessor ip = stack.getProcessor(firstSlice);
  prepareProcessor(ip, imp);
  ip.setLineWidth(Line.getWidth());		//in contrast to imp.getProcessor, stack.getProcessor does not do this
  FloatProcessor fp = null;
  int slices = imp.getNSlices();
  for (int i=firstSlice; i<=endSlice; i++) {
    if (i != processedAsPreview) {
      announceSliceNumber(i);
      ip.setPixels(stack.getPixels(i));
      ip.setSliceNumber(i);
      processOneImage(ip, fp, false);
      if (IJ.escapePressed()) {IJ.beep(); break;}
    }
  }
}

代码示例来源:origin: imagej/ImageJA

/** Process a stack or part of it. The slice given by class variable
 *    processedAsPreview remains unchanged.
 * @param firstSlice Slice number of the first slice to be processed
 * @param endSlice     Slice number of the last slice to be processed
 */
private void processStack(int firstSlice, int endSlice) {
  ImageStack stack = imp.getStack();
  ImageProcessor ip = stack.getProcessor(firstSlice);
  prepareProcessor(ip, imp);
  ip.setLineWidth(Line.getWidth());		//in contrast to imp.getProcessor, stack.getProcessor does not do this
  FloatProcessor fp = null;
  int slices = imp.getNSlices();
  for (int i=firstSlice; i<=endSlice; i++) {
    if (i != processedAsPreview) {
      announceSliceNumber(i);
      ip.setPixels(stack.getPixels(i));
      ip.setSliceNumber(i);
      processOneImage(ip, fp, false);
      if (IJ.escapePressed()) {IJ.beep(); break;}
    }
  }
}

代码示例来源:origin: net.imagej/ij

/** Returns a reference to the current ImageProcessor. If there
  is no ImageProcessor, it creates one. Returns null if this
  ImagePlus contains no ImageProcessor and no AWT Image.
  Sets the line width to the current line width and sets the
  calibration table if the image is density calibrated. */
public ImageProcessor getProcessor() {
  if (ip==null)
    return null;
  if (roi!=null && roi.isArea())
    ip.setRoi(roi.getBounds());
  else
    ip.resetRoi();
  if (!compositeImage)
    ip.setLineWidth(Line.getWidth());
  if (ij!=null)
    ip.setProgressBar(ij.getProgressBar());
  Calibration cal = getCalibration();
  if (cal.calibrated())
    ip.setCalibrationTable(cal.getCTable());
  else
    ip.setCalibrationTable(null);
  if (Recorder.record) {
    Recorder recorder = Recorder.getInstance();
    if (recorder!=null) recorder.imageUpdated(this);
  }
  return ip;
}

代码示例来源:origin: imagej/ImageJA

/** Returns a reference to the current ImageProcessor. If there
  is no ImageProcessor, it creates one. Returns null if this
  ImagePlus contains no ImageProcessor and no AWT Image.
  Sets the line width to the current line width and sets the
  calibration table if the image is density calibrated. */
public ImageProcessor getProcessor() {
  if (ip==null)
    return null;
  if (roi!=null && roi.isArea())
    ip.setRoi(roi.getBounds());
  else
    ip.resetRoi();
  if (!compositeImage)
    ip.setLineWidth(Line.getWidth());
  if (ij!=null)
    ip.setProgressBar(ij.getProgressBar());
  Calibration cal = getCalibration();
  if (cal.calibrated())
    ip.setCalibrationTable(cal.getCTable());
  else
    ip.setCalibrationTable(null);
  if (Recorder.record) {
    Recorder recorder = Recorder.getInstance();
    if (recorder!=null) recorder.imageUpdated(this);
  }
  return ip;
}

相关文章