001/* 002 * Copyright 2010-2015 Institut Pasteur. 003 * 004 * This file is part of Icy. 005 * 006 * Icy is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Icy is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Icy. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package icy.file; 020 021import java.io.IOException; 022import java.util.List; 023 024import javax.swing.filechooser.FileFilter; 025 026import icy.common.exception.UnsupportedFormatException; 027import icy.image.AbstractImageProvider; 028import icy.image.ImageProvider; 029import icy.sequence.SequenceIdImporter; 030 031/** 032 * Sequence file importer interface.<br> 033 * The importer is directly integrated in the classic <i>Open</i> command menu and in the 034 * {@link Loader} class to open Sequence.<br> 035 * Can take any resource type identified by a file and should be able to give multiple level access 036 * to the image data.<br> 037 * See details about the image data access implementation with the {@link ImageProvider} interface 038 * and {@link AbstractImageProvider} abstract class helper. 039 * 040 * @see SequenceIdImporter 041 * @author Stephane 042 */ 043public interface SequenceFileImporter extends SequenceIdImporter 044{ 045 /** 046 * Return <code>true</code> if the specified file can be opened by the importer 047 */ 048 public boolean acceptFile(String path); 049 050 /** 051 * @return The path of the image file of the image currently opened or <code>null</code> otherwise.<br> 052 * Note that path is always returned in generic java path style (see {@link FileUtil#getGenericPath(String)} method). 053 * @see #open(String, int) 054 * @see #close() 055 */ 056 @Override 057 public String getOpened(); 058 059 /** 060 * Open the image designed by the specified file <code>path</code> to allow image data / metadata access.<br> 061 * Calling this method will automatically close the previous opened image.<br> 062 * Don't forget to call {@link #close()} to close the image when you're done.<br> 063 * 064 * @param path 065 * Path of the image file to open. 066 * @param flags 067 * operation flag:<br> 068 * <li>{@link #FLAG_METADATA_MINIMUM} = load minimum metadata informations</li> 069 * <li>{@link #FLAG_METADATA_ALL} = load all metadata informations</li> 070 * @return <code>true</code> if the operation has succeeded and <code>false</code> otherwise. 071 */ 072 @Override 073 public boolean open(String path, int flags) throws UnsupportedFormatException, IOException; 074 075 /** 076 * Return the supported FileFilter for this importer. 077 */ 078 public List<FileFilter> getFileFilters(); 079}