public static void main(final String... args) throws FileNotFoundException {
    AAP_wStimulus aap = new AAP_wStimulus();
    String path;
    try {
      path = "D:\\# Projects (Noam)\\# SLITE\\# DATA\\AAP 1.1.0\\"; // LAB
      ImagePlus imp_test = IJ.openImage(path + "TEXT_20msON_10Hz_SLITE_2.tif");
      if (imp_test == null) {
        throw new FileNotFoundException("Your not in Lab....");
      }
    } catch (FileNotFoundException error) {
      path =
          "C:\\Users\\noambox\\Dropbox\\# Graduate studies M.Sc\\# SLITE\\ij - plugin data\\"; // HOME
    }

    aap.imp_r = IJ.openImage(path + "TEXT_20msON_10Hz_SLITE_2.tif"); // DEBUG
    aap.imp_s = AVI_Reader.open(path + "OLEDstim_ON0.02_OFF9.98_FlashingText 21.avi", true);
    aap.imp_r.show();
    aap.imp_s.show();
    String argv = "";
    aap.run(argv);
  }
Exemple #2
0
 /**
  * Attempts to open the specified file as a tiff, bmp, dicom, fits, pgm, gif or jpeg image.
  * Returns an ImagePlus object if successful. Modified by Gregory Jefferis to call
  * HandleExtraFileTypes plugin if the file type is unrecognised.
  *
  * @see ij.IJ#openImage(String)
  */
 public ImagePlus openImage(String directory, String name) {
   ImagePlus imp;
   FileOpener.setSilentMode(silentMode);
   if (directory.length() > 0 && !(directory.endsWith("/") || directory.endsWith("\\")))
     directory += Prefs.separator;
   String path = directory + name;
   fileType = getFileType(path);
   if (IJ.debugMode) IJ.log("openImage: \"" + types[fileType] + "\", " + path);
   switch (fileType) {
     case TIFF:
       imp = openTiff(directory, name);
       return imp;
     case DICOM:
       imp = (ImagePlus) IJ.runPlugIn("ij.plugin.DICOM", path);
       if (imp.getWidth() != 0) return imp;
       else return null;
     case TIFF_AND_DICOM:
       // "hybrid" files created by GE-Senographe 2000 D */
       imp = openTiff(directory, name);
       ImagePlus imp2 = (ImagePlus) IJ.runPlugIn("ij.plugin.DICOM", path);
       if (imp != null && imp2 != null) {
         imp.setProperty("Info", imp2.getProperty("Info"));
         imp.setCalibration(imp2.getCalibration());
       }
       if (imp == null) imp = imp2;
       return imp;
     case FITS:
       imp = (ImagePlus) IJ.runPlugIn("ij.plugin.FITS_Reader", path);
       if (imp.getWidth() != 0) return imp;
       else return null;
     case PGM:
       imp = (ImagePlus) IJ.runPlugIn("ij.plugin.PGM_Reader", path);
       if (imp.getWidth() != 0) {
         if (imp.getStackSize() == 3 && imp.getBitDepth() == 16)
           imp = new CompositeImage(imp, IJ.COMPOSITE);
         return imp;
       } else return null;
     case JPEG:
       imp = openJpegOrGif(directory, name);
       if (imp != null && imp.getWidth() != 0) return imp;
       else return null;
     case GIF:
       imp = (ImagePlus) IJ.runPlugIn("ij.plugin.GIF_Reader", path);
       if (imp != null && imp.getWidth() != 0) return imp;
       else return null;
     case PNG:
       imp = openUsingImageIO(directory + name);
       if (imp != null && imp.getWidth() != 0) return imp;
       else return null;
     case BMP:
       imp = (ImagePlus) IJ.runPlugIn("ij.plugin.BMP_Reader", path);
       if (imp.getWidth() != 0) return imp;
       else return null;
     case ZIP:
       return openZip(path);
     case AVI:
       AVI_Reader reader = new AVI_Reader();
       reader.displayDialog(!IJ.macroRunning());
       reader.run(path);
       return reader.getImagePlus();
     case UNKNOWN:
     case TEXT:
       // Call HandleExtraFileTypes plugin to see if it can handle unknown format
       int[] wrap = new int[] {fileType};
       imp = openWithHandleExtraFileTypes(path, wrap);
       if (imp != null && imp.getNChannels() > 1) imp = new CompositeImage(imp, IJ.COLOR);
       fileType = wrap[0];
       if (imp == null && fileType == UNKNOWN && IJ.getInstance() == null)
         IJ.error("Opener", "Unsupported format or not found");
       return imp;
     default:
       return null;
   }
 }