From 97ce448ab2dc789c59865bbb15ebacaed370e423 Mon Sep 17 00:00:00 2001 From: Marcel Stefko Date: Thu, 6 Jul 2017 16:23:24 +0200 Subject: [PATCH] Second attempt at file separator fix - now using InputStream --- src/ch/epfl/leb/injector/TiffParser.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ch/epfl/leb/injector/TiffParser.java b/src/ch/epfl/leb/injector/TiffParser.java index d9457ce..531080c 100644 --- a/src/ch/epfl/leb/injector/TiffParser.java +++ b/src/ch/epfl/leb/injector/TiffParser.java @@ -23,7 +23,10 @@ import ij.ImageStack; import ij.io.Opener; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.SwingUtilities; @@ -56,7 +59,7 @@ public TiffParser(Studio studio, long frameLengthMs, InjectorSetupWindow setup_w this.setup_window = setup_window; } - public final void loadGeneralTiff(File file) { + public final void loadGeneralTiff(File file) throws FileNotFoundException, IOException { // Set up progressbar window.setProgress(0); SwingUtilities.invokeLater( new Runnable() { @@ -67,8 +70,15 @@ public void run() { }); // Open the tiff via ImageJ app.logs().logMessage("Trying to open general tiff."); - Opener o = new Opener(); - ImagePlus win = o.openTiff(file.getParent(),file.getName()); + InputStream input_stream = new FileInputStream(file); + ImagePlus win; + try { + Opener o = new Opener(); + win = o.openTiff(input_stream,"InjectorStack"); + } finally { + input_stream.close(); + } + ImageStack stack = win.getImageStack(); // Build up metadata from scratch m_builder = app.data().getMetadataBuilder();