Posted by
ctrueden on
Sep 14, 2009; 10:33pm
URL: http://imagej.273.s1.nabble.com/working-with-HostComputer-tiff-tag-tp3691096p3691101.html
Hi Gabriel & Joel,
> The full error is (java.lang.NoClassDefFound Error:
> > loci/common/RandomAccessinputStream). I'm using the latest build of IJ.
>
> Similar here... but here (suse linux, sun java 1.6) the class not found is:
> java.lang.NoClassDefFoundError: /loci/formats/TiffParser
>
Both of these errors indicate out-of-date versions of loci_tools.jar. I
would suggest trying the latest trunk build from the Bio-Formats web site.
I have both the loci_tools.jar and the bio-formats.jar in the plugins
> folder.
> (I am not sure I need the latter?).
>
You only need loci_tools.jar, not bio-formats.jar or any other JAR file.
Best would be to remove any other Bio-Formats-related JAR files.
I tried to Update Loci Plugins and I get this error:
>
> java.lang.StackOverflowError
>
Sorry about that; hopefully you can update the plugin manually for now.
One other thing: Wayne based the TIFF_Dumper plugin on the initial version
of the program, before I updated it to handle IFDs with list entries in a
friendlier way. I have included an updated version of the plugin based on
the latest code.
-Curtis
----------------
//
// TIFF_Dumper.java
//
import ij.*;
import ij.plugin.*;
import ij.io.FileInfo;
import java.awt.Frame;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import loci.common.RandomAccessInputStream;
import loci.formats.tiff.*;
/** Parses and outputs all TIFF tags for the current image. */
public class TIFF_Dumper implements PlugIn {
public void run(String arg) {
if (Menus.getCommands().get("Bio-Formats Importer")==null) {
IJ.error("TIFF Dumper", "Bio-Formats plugin required");
return;
}
ImagePlus imp = IJ.getImage();
FileInfo fi = imp.getOriginalFileInfo();
if (fi.directory==null || fi.fileFormat!=FileInfo.TIFF) {
IJ.error("TIFF Dumper", "File path not available or not TIFF file");
return;
}
String path = fi.directory + fi.fileName;
IJ.log("\\Clear");
IJ.log("PATH = "+path);
try {
dumpIFDs(path);
} catch(IOException e) {
IJ.error("Tiff Dumper", ""+e);
}
Frame log = WindowManager.getFrame("Log");
if (log!=null) log.toFront();
}
public static void dumpIFDs(String path) throws IOException {
IJ.showStatus("Parsing IFDs");
RandomAccessInputStream in = new RandomAccessInputStream(path);
TiffParser parser = new TiffParser(in);
IFDList ifdList = parser.getIFDs();
IJ.showStatus("");
for (IFD ifd : ifdList) {
for (Integer key : ifd.keySet()) {
int k = key.intValue();
String name = IFD.getIFDTagName(k);
String value = prettyValue(ifd.getIFDValue(k), 0);
IJ.log(name + " = " + value);
}
}
in.close();
}
private static String prettyValue(Object value, int indent) {
if (!value.getClass().isArray()) return value.toString();
char[] spaceChars = new char[indent];
Arrays.fill(spaceChars, ' ');
String spaces = new String(spaceChars);
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for (int i=0; i<Array.getLength(value); i++) {
sb.append(spaces);
sb.append(" ");
Object component = Array.get(value, i);
sb.append(prettyValue(component, indent + 2));
sb.append("\n");
}
sb.append(spaces);
sb.append("}");
return sb.toString();
}
}
On Fri, Sep 11, 2009 at 3:58 AM, Gabriel Landini <
[hidden email]>wrote:
> On Friday 11 September 2009 09:46:55 JOEL B. SHEFFIELD wrote:
> > I just ran into a problem with the plugin. Error message that "can't
> find
> > Tiff_Dumper", even though it is listed as a plugin. Loci_tools.jar is
> also
> > present.The full error is (java.lang.NoClassDefFound Error:
> > loci/common/RandomAccessinputStream). I'm using the latest build of IJ.
>
> Similar here... but here (suse linux, sun java 1.6) the class not found is:
> java.lang.NoClassDefFoundError: /loci/formats/TiffParser
>
> I have both the loci_tools.jar and the bio-formats.jar in the plugins
> folder.
> (I am not sure I need the latter?).
>
> I tried to Update Loci Plugins and I get this error:
>
> java.lang.StackOverflowError
> at java.net.PlainSocketImpl.releaseFD(PlainSocketImpl.java:586)
> at java.net.SocketInputStream.read(SocketInputStream.java:136)
> at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> at sun.net.www.MeteredStream.read(MeteredStream.java:116)
> at java.io.FilterInputStream.read(FilterInputStream.java:116)
> at
>
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2512)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> at java.io.DataInputStream.read(DataInputStream.java:132)
> at loci.common.URLHandle.read(URLHandle.java:114)
> at loci.common.URLHandle.read(URLHandle.java:120)
> [...]
>
> Regards
> G.
>