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

Method getImageFromPath

ij/src/main/java/ij/io/Opener.java:861–872  ·  view source on GitHub ↗

Get image from the path. If it is in a zip file, it will open the zip

(String path)

Source from the content-addressed store, hash-verified

859 * Get image from the path. If it is in a zip file, it will open the zip
860 */
861 @AstroImageJ(reason = "Open zip of pngs as folder")
862 private static BufferedImage getImageFromPath(String path) throws IOException {
863 if (path.contains(".zip")) {
864 var s = path.split("\\.zip");
865 var zip = new ZipFile(s[0] + ".zip");
866
867 var img = ImageIO.read(zip.getInputStream(zip.getEntry(s[1].substring(1))));
868 zip.close();
869 return img;
870 }
871 return ImageIO.read(new File(path));
872 }
873
874 /** Converts the specified RGB image to 8-bits if the 3 channels are identical. */
875 public static void convertGrayJpegTo8Bits(ImagePlus imp) {

Callers 1

openUsingImageIOMethod · 0.95

Calls 6

substringMethod · 0.80
readMethod · 0.65
closeMethod · 0.65
containsMethod · 0.45
splitMethod · 0.45
getInputStreamMethod · 0.45

Tested by

no test coverage detected