Class ViewImageFileFilter

java.lang.Object
javax.swing.filechooser.FileFilter
gov.nih.mipav.view.ViewImageFileFilter
All Implemented Interfaces:
FileFilter

public class ViewImageFileFilter extends FileFilter implements FileFilter
A simple file filter to display only files with the appropriate extension in the file dialog.
Author:
Harman Singh
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Display all files.
    static final int
    Filter avi files (*.avi).
    static final int
    Class Files (*.class).
    static final int
    mipav data provenance (*.xmp) files
    private static String[]
    description strings for each filterType.
    static final int
    Dicom Matrix info Files (*.dicomMatrix).
    static final int
    Filter made up on-the-fly.
    protected String
    Description of dynamic filter.
    protected String[]
    Extensions to look at for the dynamic filter.
    static final int
    Fiber track files
    protected final int
    Filter type of this filter.
    static final int
    FreeSurfer ascii files (*.asc).
    static final int
    Transfer Function Files (*.fun).
    static final int
    General( *.gif; *.jpeg; *.jpg; *.pict; *.psd; *.tif; *.tiff).
    static final int
     
    static final int
    Look-Up-Table Files (*.lut).
    static final int
    .tps contains int N and float C[][] for thin plate spline
    static final int
    Microscopy files (*.avi; *.ics; *.liff; *.lsm; *.pic; *.stk; *.tif; *.tiff; *.xml).
    static final int
    Misc.(*.bmp; *.pcx; *.png; *.tga; *.xbm; *.xpm).
    static final int
    B-Spline Nonlinear Transformation Files (*.nlt).
    static final int
    Optical Files (for ophthalmology) (*.avi; *.bmp; *.jpg; *.pict; *.tif; *.tiff; *.img; *.psd).
    static final int
    Graphs (*.plt).
    static final int
    All plugin related files (.class, .jar, .zip, .tar, .tar.gz).
    static final int
    R-table (*.rtb)
    static final int
    Script Files (*.sct).
    private static String[]
    short description strings for each filterType.
    static final int
    Surface Files (*.sur).
    static final int
    Medical Formats(*.dcm; *.ima; *.img; *.mnc; *.sig; *.xml; *.head; *.nii, *.rec, *.frec, *.nrrd, *.gz, *.bz2, *.zip).
    static final int
     
    static final int
    User defined
    protected static String
    This is the user defined file extensions String
    protected static String[]
    array of user defined extensions
    static final int
    VOI Files (*.voi).
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViewImageFileFilter(int filterType)
    Constructs new filter of given type.
    Constructs a dynamic filter, with the given extensions.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    One of the overrides to FileFilter.
    boolean
    accept(String extension)
    Checks if extension matches what is accepted for the filter type.
    boolean
    Determines if this file filter is equal (in value) to another.
    One of the overrides to FileFilter.
    static String
    getDescription(int filter)
    Returns the description of the given file filter.
    static String[]
    Returns the list of descriptions.
    static int
    DOCUMENT ME!
    static String
    getShortDescription(int filter)
    Returns the dshort escription of the given file filter.
    Returns a list of the files in the directory that satisfy the file filter.
    static boolean
    matches(FileFilter filter, int filterType)
    Determines if the given file filter's description matches the description associated with the given filterType.
    static void
    This sets the udef description becasue as the user edits the file extensions, the description changes
    static void
    This sets the user defined Exts String as well as the Arraay of exts from the Preferences

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALL

      public static final int ALL
      Display all files.
      See Also:
    • AVI

      public static final int AVI
      Filter avi files (*.avi).
      See Also:
    • CLASS

      public static final int CLASS
      Class Files (*.class).
      See Also:
    • FREESURFER

      public static final int FREESURFER
      FreeSurfer ascii files (*.asc).
      See Also:
    • GEN

      public static final int GEN
      General( *.gif; *.jpeg; *.jpg; *.pict; *.psd; *.tif; *.tiff).
      See Also:
    • PLOT

      public static final int PLOT
      Graphs (*.plt).
      See Also:
    • LUT

      public static final int LUT
      Look-Up-Table Files (*.lut).
      See Also:
    • MATRIX

      public static final int MATRIX
      .tps contains int N and float C[][] for thin plate spline
      See Also:
    • TECH

      public static final int TECH
      Medical Formats(*.dcm; *.ima; *.img; *.mnc; *.sig; *.xml; *.head; *.nii, *.rec, *.frec, *.nrrd, *.gz, *.bz2, *.zip).
      See Also:
    • MICROSCOPY

      public static final int MICROSCOPY
      Microscopy files (*.avi; *.ics; *.liff; *.lsm; *.pic; *.stk; *.tif; *.tiff; *.xml).
      See Also:
    • MISC

      public static final int MISC
      Misc.(*.bmp; *.pcx; *.png; *.tga; *.xbm; *.xpm).
      See Also:
    • OPTICAL

      public static final int OPTICAL
      Optical Files (for ophthalmology) (*.avi; *.bmp; *.jpg; *.pict; *.tif; *.tiff; *.img; *.psd).
      See Also:
    • SCRIPT

      public static final int SCRIPT
      Script Files (*.sct).
      See Also:
    • SURFACE

      public static final int SURFACE
      Surface Files (*.sur).
      See Also:
    • FUNCT

      public static final int FUNCT
      Transfer Function Files (*.fun).
      See Also:
    • VOI

      public static final int VOI
      VOI Files (*.voi).
      See Also:
    • NLT

      public static final int NLT
      B-Spline Nonlinear Transformation Files (*.nlt).
      See Also:
    • DYNAMIC

      public static final int DYNAMIC
      Filter made up on-the-fly.
      See Also:
    • PLUGIN

      public static final int PLUGIN
      All plugin related files (.class, .jar, .zip, .tar, .tar.gz).
      See Also:
    • UDEF

      public static final int UDEF
      User defined
      See Also:
    • RTABLE

      public static final int RTABLE
      R-table (*.rtb)
      See Also:
    • DATA_PROVENANCE

      public static final int DATA_PROVENANCE
      mipav data provenance (*.xmp) files
      See Also:
    • TIFF

      public static final int TIFF
      See Also:
    • DICOMMATRIX

      public static final int DICOMMATRIX
      Dicom Matrix info Files (*.dicomMatrix).
      See Also:
    • FIBER

      public static final int FIBER
      Fiber track files
      See Also:
    • JSON

      public static final int JSON
      See Also:
    • descriptions

      private static String[] descriptions
      description strings for each filterType.
    • shortDescriptions

      private static String[] shortDescriptions
      short description strings for each filterType.
    • userDefinedExtensions

      protected static String[] userDefinedExtensions
      array of user defined extensions
    • udefExtsString

      protected static String udefExtsString
      This is the user defined file extensions String
    • dynamicDescription

      protected String dynamicDescription
      Description of dynamic filter.
    • dynamicExts

      protected String[] dynamicExts
      Extensions to look at for the dynamic filter.
    • filterType

      protected final int filterType
      Filter type of this filter.
  • Constructor Details

    • ViewImageFileFilter

      public ViewImageFileFilter(int filterType)
      Constructs new filter of given type.
      Parameters:
      filterType - Type of filter (GEN, TECH, etc.)
    • ViewImageFileFilter

      public ViewImageFileFilter(String[] exts)
      Constructs a dynamic filter, with the given extensions.
      Parameters:
      exts - Extensions to accept for dynamic filter.
  • Method Details

    • getDescription

      public static String getDescription(int filter)
      Returns the description of the given file filter.
      Parameters:
      filter - Filter to check.
      Returns:
      Description of filter.
    • getDescriptions

      public static String[] getDescriptions()
      Returns the list of descriptions.
      Returns:
      The list of descriptions.
    • getFilterIndex

      public static int getFilterIndex(String filter)
      DOCUMENT ME!
      Parameters:
      filter - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • getShortDescription

      public static String getShortDescription(int filter)
      Returns the dshort escription of the given file filter.
      Parameters:
      filter - Filter to check.
      Returns:
      Short description of filter.
    • matches

      public static boolean matches(FileFilter filter, int filterType)
      Determines if the given file filter's description matches the description associated with the given filterType.
      Parameters:
      filter - The filter to be tested
      filterType - The filter type to test for a match
      Returns:
      true if and only if the filter's description matches the filterType description.
    • accept

      public boolean accept(File f)
      One of the overrides to FileFilter. This function is called for each file in the current directory of the file dialog to test if it is a file with the appropriate extension. If so, it is accepted for display in the file dialog.
      Specified by:
      accept in interface FileFilter
      Specified by:
      accept in class FileFilter
      Parameters:
      f - The file whose name is to be tested for extension.
      Returns:
      true if and only if the file has an appropriate extension.
    • accept

      public boolean accept(String extension)
      Checks if extension matches what is accepted for the filter type. If so, returns true; if not, returns false.
      Parameters:
      extension - Extension of file to check.
      Returns:
      true if extension is in file filter.
    • equals

      public boolean equals(FileFilter filter)
      Determines if this file filter is equal (in value) to another.
      Parameters:
      filter - The filter to be tested for equality
      Returns:
      true if and only if the filter is the same type as this filter.
    • getDescription

      public String getDescription()
      One of the overrides to FileFilter. This function is called just to access the description of the filter.
      Specified by:
      getDescription in class FileFilter
      Returns:
      The description for the filter.
    • listFiles

      public String[] listFiles(File file)
      Returns a list of the files in the directory that satisfy the file filter.
      Parameters:
      file - Directory
      Returns:
      List of files in directory that satisfy file filter.
    • setUdefDescription

      public static void setUdefDescription(String desc)
      This sets the udef description becasue as the user edits the file extensions, the description changes
      Parameters:
      desc - Description String
    • setUserDefinedExtensions

      public static void setUserDefinedExtensions()
      This sets the user defined Exts String as well as the Arraay of exts from the Preferences