示例#1
0
  /** Constructs a new pattern reader. */
  public FilePatternReader() {
    super("File pattern", new String[] {"pattern"});

    ClassList<IFormatReader> classes = ImageReader.getDefaultReaderClasses();
    Class<? extends IFormatReader>[] classArray = classes.getClasses();
    ClassList<IFormatReader> newClasses = new ClassList<IFormatReader>(IFormatReader.class);
    for (Class<? extends IFormatReader> c : classArray) {
      if (!c.equals(FilePatternReader.class)) {
        newClasses.addClass(c);
      }
    }
    helper = new FileStitcher(new ImageReader(newClasses));

    suffixSufficient = true;
  }
示例#2
0
  /**
   * Wrapper for bio-formats
   *
   * @param config - ImportConfit
   */
  public OMEROWrapper(ImportConfig config) {
    if (config == null) {
      throw new IllegalArgumentException(
          "An ImportConfig must be instantitated \n "
              + "in order to properly configure all readers.");
    }

    this.config = config;
    try {
      String readersPath = config.readersPath.get();
      // Since we now use all readers apart from the ZipReader, just
      // initialize in this manner which helps us by not requiring
      // us to keep up with all changes in readers.txt and removes
      // the requirement for importer_readers.txt (See #2859).
      // Chris Allan <*****@*****.**> -- Fri 10 Sep 2010 17:24:49 BST
      ClassList<IFormatReader> readers = ImageReader.getDefaultReaderClasses();
      readers.removeClass(ZipReader.class);
      if (readersPath != null) {
        Class<?> k = getClass();
        if (new File(readersPath).exists()) {
          k = null;
        }
        readers = new ClassList<IFormatReader>(readersPath, IFormatReader.class, k);
      }
      iReader = new ImageReader(readers);
      filler = new ChannelFiller(iReader);
    } catch (IOException e) {
      throw new RuntimeException("Unable to load readers.txt.");
    }
    reader = separator = new ChannelSeparator(filler);

    // Force unreadable characters to be removed from metadata key/value pairs
    iReader.setMetadataFiltered(true);
    filler.setMetadataFiltered(true);
    separator.setMetadataFiltered(true);
  };