Package ij.process

Examples of ij.process.ImageProcessor


  private void showLut(ImagePlus imp, FileInfo fi, boolean showImage) {
    if (imp != null) {
      if (imp.getType() == ImagePlus.COLOR_RGB)
        IJ.error("Color tables cannot be assiged to RGB Images.");
      else {
        ImageProcessor ip = imp.getProcessor();
        ColorModel cm = new IndexColorModel(8, 256, fi.reds, fi.greens,
            fi.blues);
        ip.setColorModel(cm);
        if (imp.getStackSize() > 1)
          imp.getStack().setColorModel(cm);
        imp.updateAndDraw();
      }
    }
View Full Code Here


        if (ip == null ) {
            return false;
        }
        int type = op.getFileType(tmp.getPath());
        tmp.delete();
        ImageProcessor processor = ip.getProcessor();
        if (ip.getWidth() > ip.getHeight()) {
            processor = processor.resize(size, ip.getHeight()*size/ip.getWidth());
        } else {
            processor = processor.resize(ip.getWidth()*size/ip.getHeight(), size);
        }
        ip.setProcessor(null,processor);

        return save(type,ip,outputFile);
    }
View Full Code Here

        // Load the input image.
        if (ip == null) {
            return false;
        }
        ip = new ImagePlus(ip.getTitle(), ip.getImageStack());
        ImageProcessor processor = ip.getProcessor();
        if(square) {
            processor = processor.resize(size, size);
        } else if (ip.getWidth() > ip.getHeight()) {
            processor = processor.resize(size, ip.getHeight()*size/ip.getWidth());
        } else {
            processor = processor.resize(ip.getWidth()*size/ip.getHeight(), size);
        }
        ip.setProcessor(null,processor);
        int type = ((ImageJImage) iw).getImageType();

        return ImageProcess.save(type, ip, outputFile);
View Full Code Here

        return -1;
    }

    public boolean cropImage(Image i, File outputFile, int top, int left, int width, int height) {
        ImagePlus ip = ((ImageJImage)i).getImagePlus();
        ImageProcessor processor = ip.getProcessor();

        processor.setRoi(left, top, width, height);
        processor = processor.crop();
        ip.setProcessor(null, processor);

        return ImageProcess.save(((ImageJImage) i).getImageType(), ip, outputFile);
    }
View Full Code Here

        return ImageProcess.save(((ImageJImage) i).getImageType(), ip, outputFile);
    }

    public boolean resizeImage(Image i, File outputFile, int width, int height) {
        ImagePlus ip = ((ImageJImage)i).getImagePlus();
        ImageProcessor processor = ip.getProcessor();
        processor = processor.resize(width, height);
        ip.setProcessor(null, processor);

        return ImageProcess.save(((ImageJImage) i).getImageType(), ip, outputFile);
    }
View Full Code Here

        return ImageProcess.save(((ImageJImage) i).getImageType(), ip, outputFile);
    }

    public boolean rotateImage(Image i, File outputFile, boolean clockwise) {
        ImagePlus ip = ((ImageJImage)i).getImagePlus();
        ImageProcessor processor = ip.getProcessor();
        if (clockwise) {
            processor = processor.rotateRight();
        } else {
            processor = processor.rotateLeft();
        }
        ip.setProcessor(null, processor);

        return ImageProcess.save(((ImageJImage) i).getImageType(), ip, outputFile);
    }
View Full Code Here

  void write8BitVirtualStack(OutputStream out, VirtualStack virtualStackthrows IOException {
    showProgressBar = false;
    boolean flip = "FlipTheseImages".equals(fi.fileName);
    for (int i=1; i<=fi.nImages; i++) {
      IJ.showStatus("Writing: " + i + "/" + fi.nImages);
      ImageProcessor ip = virtualStack.getProcessor(i);
      if (flip) ip.flipVertical();
      byte[] pixels = (byte[])ip.getPixels();
      write8BitImage(out, pixels);
      IJ.showProgress((double)i/fi.nImages);
    }
  }
View Full Code Here

  void write16BitVirtualStack(OutputStream out, VirtualStack virtualStackthrows IOException {
    showProgressBar = false;
    boolean flip = "FlipTheseImages".equals(fi.fileName);
    for (int i=1; i<=fi.nImages; i++) {
      IJ.showStatus("Writing: " + i + "/" + fi.nImages);
      ImageProcessor ip = virtualStack.getProcessor(i);
      if (flip) ip.flipVertical();
      short[] pixels = (short[])ip.getPixels();
      write16BitImage(out, pixels);
      IJ.showProgress((double)i/fi.nImages);
    }
  }
View Full Code Here

  void writeFloatVirtualStack(OutputStream out, VirtualStack virtualStackthrows IOException {
    showProgressBar = false;
    boolean flip = "FlipTheseImages".equals(fi.fileName);
    for (int i=1; i<=fi.nImages; i++) {
      IJ.showStatus("Writing: " + i + "/" + fi.nImages);
      ImageProcessor ip = virtualStack.getProcessor(i);
      if (flip) ip.flipVertical();
      float[] pixels = (float[])ip.getPixels();
      writeFloatImage(out, pixels);
      IJ.showProgress((double)i/fi.nImages);
    }
  }
View Full Code Here

  void writeRGBVirtualStack(OutputStream out, VirtualStack virtualStackthrows IOException {
    showProgressBar = false;
    boolean flip = "FlipTheseImages".equals(fi.fileName);
    for (int i=1; i<=fi.nImages; i++) {
      IJ.showStatus("Writing: " + i + "/" + fi.nImages);
      ImageProcessor ip = virtualStack.getProcessor(i);
      if (flip) ip.flipVertical();
      int[] pixels = (int[])ip.getPixels();
      writeRGBImage(out, pixels);
      IJ.showProgress((double)i/fi.nImages);
    }
  }
View Full Code Here

TOP

Related Classes of ij.process.ImageProcessor

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.