public void run(String arg) { boolean display = false; File test = new File(arg); display = !test.exists(); OpenDialog od = new OpenDialog("Open mkt file...", arg); if (od != null) { String file = od.getFileName(); if (file == null) return; String directory = od.getDirectory(); directory = directory.replace('\\', '/'); // Windows safe if (!directory.endsWith("/")) directory += "/"; arg = directory + file; } try { FileProjectionSource fileSource = new MKTProjectionSource(); fileSource.initStream(arg); ImagePlusDataSink sink = new ImagePlusDataSink(); Grid2D imp = fileSource.getNextProjection(); int i = 0; while (imp != null) { sink.process(imp, i); i++; imp = fileSource.getNextProjection(); } sink.close(); setStack(ImageUtil.wrapGrid3D(sink.getResult(), "").getStack()); setTitle(new File(arg).getName()); fileSource.close(); if (display) show(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }