Package adams.data.io.input
Class AbstractImageReader<T extends AbstractImageContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractImageReader<T>
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,ImageReader<T>,Serializable
- Direct Known Subclasses:
ApacheCommonsImageReader,BoofCVImageReader,JAIImageReader,OpenCVImageReader,PNGImageReader
public abstract class AbstractImageReader<T extends AbstractImageContainer> extends AbstractOptionHandler implements ImageReader<T>
Ancestor for image readers.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractImageReader()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheck(PlaceholderFile file)Performs checks.protected abstract TdoRead(PlaceholderFile file)Performs the actual reading of the image file.abstract ImageWritergetCorrespondingWriter()Returns, if available, the corresponding writer.StringgetDefaultFormatExtension()Returns the default extension of the format.abstract StringgetFormatDescription()Returns a string describing the format (used in the file chooser).abstract String[]getFormatExtensions()Returns the extension(s) of the format.static String[]getReaders()Returns a list with classnames of readers.booleanisAvailable()Returns whether the reader is actually available.protected TpostProcess(T cont, PlaceholderFile file)Performs some post-processing on the container.Tread(PlaceholderFile file)Reads the image file.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
getFormatDescription
public abstract String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public abstract String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Returns:
- the extension (without the dot!)
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default extension of the format.- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension (without the dot!)
-
getCorrespondingWriter
public abstract ImageWriter getCorrespondingWriter()
Returns, if available, the corresponding writer.- Specified by:
getCorrespondingWriterin interfaceImageReader<T extends AbstractImageContainer>- Returns:
- the writer, null if none available
-
isAvailable
public boolean isAvailable()
Returns whether the reader is actually available.- Specified by:
isAvailablein interfaceImageReader<T extends AbstractImageContainer>- Returns:
- true if available and ready to use
-
check
protected void check(PlaceholderFile file)
Performs checks.- Parameters:
file- the image file to check
-
doRead
protected abstract T doRead(PlaceholderFile file)
Performs the actual reading of the image file.- Parameters:
file- the file to read- Returns:
- the image container, null if failed to read
-
postProcess
protected T postProcess(T cont, PlaceholderFile file)
Performs some post-processing on the container.- Parameters:
cont- the container to post-processfile- the file that was read- Returns:
- the (potentially) updated container
-
read
public T read(PlaceholderFile file)
Reads the image file.- Specified by:
readin interfaceImageReader<T extends AbstractImageContainer>- Parameters:
file- the file to read- Returns:
- the image container, null if failed to read
-
getReaders
public static String[] getReaders()
Returns a list with classnames of readers.- Returns:
- the reader classnames
-
-