(ImagePlus imp)
| 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(""); |
no test coverage detected