MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getExifData

Method getExifData

ij/src/main/java/ij/plugin/ImageInfo.java:114–146  ·  view source on GitHub ↗
(ImagePlus imp)

Source from the content-addressed store, hash-verified

112 }
113
114 public String getExifData(ImagePlus imp) {
115 FileInfo fi = imp.getOriginalFileInfo();
116 if (fi==null)
117 return null;
118 String directory = fi.directory;
119 String name = fi.fileName;
120 if (directory==null)
121 return null;
122 if ((name==null||name.equals("")) && imp.getStack().isVirtual())
123 name = imp.getStack().getSliceLabel(imp.getCurrentSlice());
124 if (name==null || !(name.endsWith("jpg")||name.endsWith("JPG")))
125 return null;
126 String path = directory + name;
127 String metadata = null;
128 try {
129 Class c = IJ.getClassLoader().loadClass("Exif_Reader");
130 if (c==null) return null;
131 String methodName = "getMetadata";
132 Class[] argClasses = new Class[1];
133 argClasses[0] = methodName.getClass();
134 Method m = c.getMethod("getMetadata", argClasses);
135 Object[] args = new Object[1];
136 args[0] = path;
137 Object obj = m.invoke(null, args);
138 metadata = obj!=null?obj.toString():null;
139 } catch(Exception e) {
140 return null;
141 }
142 if (metadata!=null && !metadata.startsWith("Error:"))
143 return metadata;
144 else
145 return null;
146 }
147
148 private String getInfo(ImagePlus imp, ImageProcessor ip) {
149 String s = new String("");

Callers 2

getImageInfoMethod · 0.95
openJpegOrGifMethod · 0.80

Calls 11

getClassLoaderMethod · 0.95
getOriginalFileInfoMethod · 0.80
getCurrentSliceMethod · 0.80
getMethodMethod · 0.80
invokeMethod · 0.80
startsWithMethod · 0.80
equalsMethod · 0.45
isVirtualMethod · 0.45
getStackMethod · 0.45
getSliceLabelMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected