Skip to content

Commit 9dad497

Browse files
committed
add ImageJ opener support for FITS, PGM, BMP, AVI, and TEXT files that can be loaded from filesystems (but not remote URLs)
1 parent 42129ba commit 9dad497

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

render-app/src/main/java/org/janelia/alignment/loader/ImageJDefaultLoader.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,16 @@ public ImageProcessor load(final String urlString) {
8888
// If the URL opener did not work, try to open the file directly.
8989
if (imagePlus == null) {
9090
File file = null;
91-
if (urlString.startsWith("file:")) {
92-
file = new File(urlString.substring(5));
93-
} else if (urlString.charAt(0) == '/' || urlString.charAt(0) == '\\') {
91+
if (urlString.charAt(0) == '/' || urlString.charAt(0) == '\\') {
9492
file = new File(urlString);
93+
} else if (urlString.startsWith("file:")) {
94+
int beginIndex = 5;
95+
if (urlString.charAt(beginIndex) == '/') {
96+
while ((urlString.length() > (beginIndex + 1)) && (urlString.charAt(beginIndex + 1) == '/')) {
97+
beginIndex++;
98+
}
99+
}
100+
file = new File(urlString.substring(beginIndex));
95101
}
96102
if (file != null && file.exists()) {
97103
// Try to open file directly since URL opener failed.

0 commit comments

Comments
 (0)