jpl.mipl.mars.viewer.util
Interface MarsImageFileFinder

All Superinterfaces:
EventListener, PropertyChangeListener
All Known Implementing Classes:
AbstractMarsImageFileFinder

public interface MarsImageFileFinder
extends PropertyChangeListener

Purpose: Interface file for classes which find RDR's related to a particular EDR. See AbstractMarsImageFileFinder for abstract implementation of this interface.

   Copyright 2003, California Institute of Technology.
   ALL RIGHTS RESERVED.
   U.S. Government Sponsorship acknowledge. 2003.
   
 ============================================================================
 Modification History :
 ----------------------

 Date              Who                        What
 ----------------------------------------------------------------------------
 08/23/2003        Nick                       Initial Release
 12/01/2003        Nick                       Method getType() added.
 ============================================================================
 

Version:
2003.12.01
Author:
Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)

Field Summary
static short EDR_TYPE
          Static variable for EDR type images
static short RDR_TYPE
          Static variable for RDR type images
 
Method Summary
 boolean equals(MarsImageFileFinder other)
          Returns true if this object and other is of same class type and have the same root.
 String extractEyeType(String imgPath, short type)
          Returns the camera eye type as denoted by the file organization and the imgPath parameter.
 String extractFilename(String path)
          Returns the basename of a filepath, ie returns filename from filepath
 String extractImageType(String imgPath, short type)
          Returns the image type as denoted by the file organization and the imgPath parameter.
 Vector extractImageTypes(Vector imgPaths, short type)
          Returns the image types as denoted by the file organization and the imgPath parameters.
 String extractInstrument(String imgPath, short type)
          Returns the instrument type as denoted by the file organization and the imgPath parameter.
 Vector filterProducts(Vector edrs, String instrument, String fileType, String eyeType, boolean allowThumbs)
          Returns a subset of entries from edrs vector which are of the same instrument as specified by instrumentName, and permitted by the allowThumbs flag.
 String formatSol(int sol)
          Formats the SOL as a string based on the directory structure
 String[] getCameraEyeTypes()
          Returns a String array of camera eye types.
 Vector getEdrs()
          Returns a vector of EDR paths found according to file heirarchy.
 String getInitialSol()
          Returns a list of the SOL range of a given file finder.
 String[] getInstrumentTypes()
          Returns a String array of instrument names.
 Vector getRdrs(String edrFile)
          Returns a vector of RDR paths found according to file heirarchy generated by the EDR parameter name.
 String[] getRdrTypes()
          Returns a String array of RDR types.
 String getRoot()
          Returns string of the root of the file organization.
 File getRootFile()
          Returns File of the root of the file organization.
 List getSolRange()
          Returns a list of the SOL range of a given file finder.
 String getSourceProductPath(String rdrPath)
          Returns the path of the source EDR for nominal RDR products, or the path of the linearized version of that EDR for linearized RDR products.
 String getType()
          Returns string identifier of the image file finder type.
 boolean isThumbnail(String imgFile)
          Determines if image represented by imgFile is a thumbnail.
 boolean isThumbnailType(String type)
          Determines if product type represented by type is a thumbnail.
 boolean isTypeNominal(String type)
          Returns true if the type parameter is raw, false otherwise (e.g.
 boolean isTypeSource(String type)
          Returns true if the type parameter is a source, false otherwise.
 Vector removeThumbnails(Vector inImages)
          Given a vector of image file names, uses isThumbnail method to determine if file should be included in the returned Vector.
 void setRoot(String newRoot)
          Sets the root of the file organization.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

EDR_TYPE

public static final short EDR_TYPE
Static variable for EDR type images

See Also:
Constant Field Values

RDR_TYPE

public static final short RDR_TYPE
Static variable for RDR type images

See Also:
Constant Field Values
Method Detail

setRoot

public void setRoot(String newRoot)
             throws IOException
Sets the root of the file organization.

Parameters:
newRoot - Path of the root.
Throws:
IOException - If directory specified by newRoot parameter does not exist or cannot be read.

getRoot

public String getRoot()
Returns string of the root of the file organization.

Returns:
Root of file organinzation.

getRootFile

public File getRootFile()
Returns File of the root of the file organization.

Returns:
Root of file organinzation.

getType

public String getType()
Returns string identifier of the image file finder type.

Returns:
Root of file organinzation.

getEdrs

public Vector getEdrs()
               throws IOException
Returns a vector of EDR paths found according to file heirarchy.

Returns:
List of EDR found given directory base.
Throws:
IOException - if I/O error occurs

getRdrs

public Vector getRdrs(String edrFile)
               throws IOException
Returns a vector of RDR paths found according to file heirarchy generated by the EDR parameter name.

Parameters:
edrFile - Original image file from which matching RDR's are generated.
Returns:
List of RDR's generated from EDR parameter.
Throws:
IOException - if I/O error occurs

filterProducts

public Vector filterProducts(Vector edrs,
                             String instrument,
                             String fileType,
                             String eyeType,
                             boolean allowThumbs)
Returns a subset of entries from edrs vector which are of the same instrument as specified by instrumentName, and permitted by the allowThumbs flag.

Parameters:
edrs - Sets of EDR pathnames, specific to organization type.
instrument - Name of instrument, "" and null for all instruments.
fileType - EDR file type , "" and null for all file types.
eyeType - Camera eye type , "" and null for all camera eye types.
allowThumbs - Flag for thumbnails, if true thumbnails are allowed, else they will be filtered out.
Returns:
Subset of entries matching instrument type. If instrument is null or the empty string, a cloned Vector is returned.

extractFilename

public String extractFilename(String path)
Returns the basename of a filepath, ie returns filename from filepath

Parameters:
path - Filepath of the file whose name is to be extracted.
Returns:
Base name of the file represented by path

extractInstrument

public String extractInstrument(String imgPath,
                                short type)
Returns the instrument type as denoted by the file organization and the imgPath parameter.

Parameters:
imgPath - Complete path of the edr file.
type - Type of file (choose from MarsImageFileFinder.EDR_TYPE, MarsImageFileFinder.RDR_TYPE)
Returns:
Instrument as determined by organization. Null if cannot be determined.

extractImageType

public String extractImageType(String imgPath,
                               short type)
Returns the image type as denoted by the file organization and the imgPath parameter.

Parameters:
imgPath - Complete path of the edr file.
type - Type of file (choose from MarsImageFileFinder.EDR_TYPE, MarsImageFileFinder.RDR_TYPE)
Returns:
Image type as determined by filename and org. Null if cannot be determined.

extractImageTypes

public Vector extractImageTypes(Vector imgPaths,
                                short type)
Returns the image types as denoted by the file organization and the imgPath parameters.

Parameters:
type - Type of file (choose from MarsImageFileFinder.EDR_TYPE, MarsImageFileFinder.RDR_TYPE)
Returns:
Vector of image types as determined by filename and org.

extractEyeType

public String extractEyeType(String imgPath,
                             short type)
Returns the camera eye type as denoted by the file organization and the imgPath parameter.

Parameters:
imgPath - Complete path of the edr file.
type - Type of file (choose from MarsImageFileFinder.EDR_TYPE, MarsImageFileFinder.RDR_TYPE)
Returns:
Camera eye type as determined by organization.

isThumbnail

public boolean isThumbnail(String imgFile)
Determines if image represented by imgFile is a thumbnail.

Parameters:
imgFile - Filename of the image.
Returns:
True if file is a thumbnail, false otherwise.

isThumbnailType

public boolean isThumbnailType(String type)
Determines if product type represented by type is a thumbnail.

Parameters:
type - Product type.
Returns:
True if file is a thumbnail, false otherwise.

getInstrumentTypes

public String[] getInstrumentTypes()
Returns a String array of instrument names.

Returns:
String array of instrument types, first element an empty string.

getRdrTypes

public String[] getRdrTypes()
Returns a String array of RDR types.

Returns:
String array of RDR types.

getCameraEyeTypes

public String[] getCameraEyeTypes()
Returns a String array of camera eye types.

Returns:
String array of camera eye types.

removeThumbnails

public Vector removeThumbnails(Vector inImages)
Given a vector of image file names, uses isThumbnail method to determine if file should be included in the returned Vector. This method is non-destructive to the input Vector.

Parameters:
inImages - Vector of image pathnames

equals

public boolean equals(MarsImageFileFinder other)
Returns true if this object and other is of same class type and have the same root.

Parameters:
other - MartImageFileFinder object to be compared to
Returns:
True if class and state are same, false otherwise

formatSol

public String formatSol(int sol)
Formats the SOL as a string based on the directory structure

Returns:
string representation of the sol parameter

getSourceProductPath

public String getSourceProductPath(String rdrPath)
                            throws IOException
Returns the path of the source EDR for nominal RDR products, or the path of the linearized version of that EDR for linearized RDR products. NOTE: Behavior of this method must be constrained such that a 'source image' will return the path of itself. For example, is the parameter is the linearized thumbnail source, this method will return that same path, and not the path of the nominal thumbnail nor the nomial fullsized.

Parameters:
rdrPath - Path of the RDR product.
Returns:
Path of the corresponding source EDR (nominal or linearized).
Throws:
IOException

isTypeNominal

public boolean isTypeNominal(String type)
Returns true if the type parameter is raw, false otherwise (e.g. type is linearized).

Returns:
True is type is raw, false otherwise.

isTypeSource

public boolean isTypeSource(String type)
Returns true if the type parameter is a source, false otherwise.

Returns:
True is type is source, false otherwise.

getSolRange

public List getSolRange()
Returns a list of the SOL range of a given file finder.

Returns:
Solar day range

getInitialSol

public String getInitialSol()
Returns a list of the SOL range of a given file finder.

Returns:
Solar day range