Login  Register

File size

Posted by Dimitri Vanhecke-2 on Mar 16, 2009; 3:22pm
URL: http://imagej.273.s1.nabble.com/File-size-tp3693305.html

Hello,

I want to use the physical size (file size) of an image for a PlugIn in ImageJ/Java.
I used "FileInfo" to retrieve the path and I have been playing around with  

long length = file.length();

but had no success actually getting the size of this image.


public class Tool_ implements PlugInFilter {

            private ImagePlus imp;
        public int setup(String arg, ImagePlus imp) {
                this.imp=imp;
                return DOES_ALL;
        }
  public void run(ImageProcessor ip) {
             String geg = getImageInfo(imp, ip);
        }

        public String getImageInfo(ImagePlus imp, ImageProcessor ip) {
        String geg = "";
        FileInfo fi = imp.getOriginalFileInfo();

        ****
               GenericDialog fs = new GenericDialog("File Size");
            fs.addNumericField("Filesize: ", filesize,0);
            fs.addStringField("Filename: ", fi.directory + fi.fileName,0);
                    fs.showDialog();
        return geg;
        }
}


Any input welcome!

Dimitri Vanhecke
Institute of Anatomy
University of Bern