Package ij

Examples of ij.ImagePlus


            case Opener.ZIP:
                return new FileSaver(ip).saveAsZip(outputFile.getPath());
            case Opener.BMP:
                return new FileSaver(ip).saveAsBmp(outputFile.getPath());
            case Opener.PNG:
                ImagePlus tempImage = WindowManager.getTempCurrentImage();
                WindowManager.setTempCurrentImage(ip);
                PlugIn p =null;
                try {
                    p = (PlugIn) Class.forName("ij.plugin.PNG_Writer").newInstance();
                } catch (InstantiationException e) {
View Full Code Here


      sceneImage  = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB);
      pixels    = ((DataBufferInt)sceneImage.getRaster().getDataBuffer()).getData();
      gc      = sceneImage.createGraphics();
     
      bwImage    = new ImagePlus(null, bwProcessor = new ByteProcessor(width,height));
      //bwImage.trimProcessor();
     
      firstTime = false;
    }
   
View Full Code Here

                    return newImage;
                } case 1:{
                    BufferedImage newImage = ImageIO.read(new File(filename));
                    return newImage;
                } case 2:{
                    ImagePlus imp = IJ.openImage(filename);
                    BufferedImage newImage = BufferedImageCreator.create(imp, 0);
//                    ColorProcessor cp = (ColorProcessor) imp.getProcessor();
//                    int[] pixels = (int[]) cp.getPixels();
//                    BufferedImage bimg = new BufferedImage(cp.getWidth(), cp.getHeight(), BufferedImage.TYPE_INT_RGB);
//                    bimg.setRGB(0, 0, cp.getWidth(), cp.getHeight(), pixels, 0, cp.getWidth());
View Full Code Here

   */
  public BufferedImage open(InputStream input) throws FormatIOException {
    Opener o = new Opener();
    BufferedImage bi = null;
    // Most of the time we're dealing with TIF so try direct
    ImagePlus imp = o.openTiff(input, "tif");
    // Otherwise, we'll just stay in ImageJ but just provide a file path
    if (imp == null) {
      logger.info("Creating temp image");
      File path = IOUtils.createTempImage(input);
      bi = open(path.getAbsolutePath());
View Full Code Here

   * @param input absolute file path for image file
   * @return a BufferedImage instance for source image file
   * @throws FormatIOException
   */
  public BufferedImage open(String input) throws FormatIOException {
    ImagePlus ip;
    try {
      ip = JAIReader.read(new File(input))[0];
    } catch (Exception e) {
      logger.error(e,e);
      throw new FormatIOException(e);
View Full Code Here

   */
  public void write(BufferedImage bi, OutputStream os) throws FormatIOException {
    if (bi != null) {
      BufferedOutputStream bos = null;
        bos = new BufferedOutputStream(os);
      ImagePlus ip = new ImagePlus();
      ip.setImage(bi);
      GifEncoder ge = new GifEncoder();
      ge.start(bos);
      ge.addFrame(ip);
      ge.finish();
    }
View Full Code Here

  }
 
  private static ImageRecord setUsingImageJ(String file) {
    ImageRecord dim = new ImageRecord(file);
    Opener o = new Opener();
    ImagePlus imp = o.openImage(file);
    if (imp == null)
      return null;
    ImageProcessor ip = imp.getProcessor();
    dim.setWidth(ip.getWidth());
    dim.setHeight(ip.getHeight());
    ip = null;
    return dim;
  }
View Full Code Here

    // start ImageJ
    new ImageJ();

    // open the Clown sample
    ImagePlus image = IJ.openImage("http://imagej.net/images/clown.jpg");
    image.show();

    // run the plugin
    IJ.runPlugIn(clazz.getName(), "");
  }
View Full Code Here

    //writeUsingImageJ(bi, os);
    //writeUsingMMCComputingImageIO(bi, os);
  }
 
  private void writeUsingImageJ(BufferedImage bi, OutputStream os) throws FormatIOException {
    ImagePlus imp = new ImagePlus("tempTif", bi);
    TiffEncoder encoder = new TiffEncoder(imp.getFileInfo());
    DataOutputStream out = new DataOutputStream(new BufferedOutputStream(os));
    try {
      encoder.write(out);
    } catch (IOException e) {
      logger.error(e);
View Full Code Here

                g.setColor(new Color(100, 100, 100));
                g.drawString(wmText, x + 2, y + 2);
                g.setColor(new Color(240, 240, 240));
                g.drawString(wmText, x, y);
            }
            ImageProcessor ip = new ImagePlus("temp", img).getProcessor();
            // if the inputMimeType is image/gif, need to convert to RGB in any case
            if (inputMimeType.equals("image/gif")) {
                ip = ip.convertToRGB();
                alreadyConvertedToRGB = true;
            }
View Full Code Here

TOP

Related Classes of ij.ImagePlus

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.