public abstract class AbstractReaderFilter extends AbstractFilter<Reader> implements Reader
Filter that delegate to
Reader instances.
NB: All concrete implementations of this interface should be annotated as
Plugin for automatic discovery.
NB: This class attempts to locate a type-matching MetadataWrapper to
protectively wrap the wrapped Reader's Metadata. If none is found, a
reference to the Reader's Metadata itself is used.
Reader,
Filter,
AbstractMetadataWrapper| Constructor and Description |
|---|
AbstractReaderFilter() |
AbstractReaderFilter(Class<? extends MetadataWrapper> metaClass) |
| Modifier and Type | Method and Description |
|---|---|
<P extends Plane> |
castToTypedPlane(Plane plane)
Convenience method for casting
Plane implementations to the type
associated with this Reader. |
protected void |
cleanUp()
Helper method that is always called by the
close(boolean) method, if the
fileOnly flag is false. |
void |
close()
Closes the image source(s) associated with this component and resets the
component to its default state.
|
void |
close(boolean fileOnly)
Closes the image source(s) associated with this component, with a toggle to
determine if the component itself is reset.
|
Plane |
createPlane(ImageMetadata meta,
net.imglib2.Interval bounds)
Creates a blank plane compatible with this reader.
|
Plane |
createPlane(net.imglib2.Interval bounds)
Creates a blank plane compatible with this reader.
|
int |
fileGroupOption(org.scijava.io.location.Location id)
Returns an int indicating that we cannot, must, or might group the files in
a given dataset.
|
org.scijava.Context |
getContext() |
org.scijava.io.location.Location |
getCurrentLocation()
Returns the current file.
|
String[] |
getDomains()
Returns the list of domains represented by the current file.
|
Format |
getFormat()
Provides a link back to the format associated with this component.
|
String |
getFormatName()
Helper method for accessing
Format.getFormatName(). |
org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> |
getHandle()
Retrieves the current input stream for this reader.
|
int |
getImageCount()
Determines the number of images in the current file.
|
Metadata |
getMetadata()
Gets the type-specific Metadata for this Reader
|
long |
getOptimalTileHeight(int imageIndex)
Returns the optimal sub-image height for use with
Reader.openPlane(int, long). |
long |
getOptimalTileWidth(int imageIndex)
Returns the optimal sub-image width for use with
Reader.openPlane(int, long). |
protected Metadata |
getParentMeta()
Convenience accessor for the parent's Metadata
|
long |
getPlaneCount(int imageIndex)
Determines the number of planes in the current file.
|
boolean |
hasCompanionFiles()
Returns true if this format supports multi-file datasets.
|
boolean |
isCompatible(Class<?> c)
Returns true if this filter is capable of wrapping instances of the
provided class.
|
boolean |
isNormalized()
Returns true if we should normalize float data.
|
boolean |
isSingleFile(org.scijava.io.location.Location id)
Returns true if this is a single-file format.
|
protected boolean |
metaCheck() |
Plane |
openPlane(int imageIndex,
long planeIndex)
Creates a
Plane representation of the pixels at the
specified indices. |
Plane |
openPlane(int imageIndex,
long planeIndex,
net.imglib2.Interval bounds)
Creates a
Plane representation of a desired sub-region from
the pixels at the specified indices. |
Plane |
openPlane(int imageIndex,
long planeIndex,
net.imglib2.Interval bounds,
SCIFIOConfig config)
As
Reader.openPlane(int, long, Interval) with configuration options. |
Plane |
openPlane(int imageIndex,
long planeIndex,
Plane plane)
Allows a single
Plane object to be reused by reference when opening
complete planes. |
Plane |
openPlane(int imageIndex,
long planeIndex,
Plane plane,
net.imglib2.Interval bounds)
Allows a single
Plane object to be reused by reference when opening
sub-regions of planes. |
Plane |
openPlane(int imageIndex,
long planeIndex,
Plane plane,
net.imglib2.Interval bounds,
SCIFIOConfig config)
Allows a single
Plane object to be reused by reference when opening
sub-regions of planes. |
Plane |
openPlane(int imageIndex,
long planeIndex,
Plane plane,
SCIFIOConfig config)
Allows a single
Plane object to be reused by reference when opening
complete planes. |
Plane |
openPlane(int imageIndex,
long planeIndex,
SCIFIOConfig config)
As
Reader.openPlane(int, long) with configuration options. |
protected void |
openPlaneHelper()
Allows code to be executed regardless of which
openPlane(int, long) signature
is called. |
protected net.imglib2.Interval |
planarBounds(int imageIndex) |
Plane |
readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> s,
int imageIndex,
net.imglib2.Interval bounds,
int scanlinePad,
Plane plane)
Reads a raw plane from disk.
|
Plane |
readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> s,
int imageIndex,
net.imglib2.Interval bounds,
Plane plane)
Reads a raw plane from disk.
|
protected void |
readPlaneHelper()
Allows code to be executed regardless of which
readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location>, int, net.imglib2.Interval, io.scif.Plane) signature
is called. |
void |
setContext(org.scijava.Context ctx) |
void |
setMetadata(Metadata meta)
Sets the Metadata for this Reader.
|
void |
setNormalized(boolean normalize)
Specifies whether or not to normalize float data.
|
void |
setParent(Object parent)
Sets the object which this filter augments.
|
void |
setSource(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> handle)
Sets the source for this reader to read from.
|
void |
setSource(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> handle,
SCIFIOConfig config)
As
Reader.setSource(DataHandle) with configuration options. |
void |
setSource(org.scijava.io.location.Location loc)
Sets the source for this reader to read from.
|
void |
setSource(org.scijava.io.location.Location loc,
SCIFIOConfig config)
As
Reader.setSource(Location) with configuration options. |
protected void |
setSourceHelper(org.scijava.io.location.Location source,
SCIFIOConfig config)
Allows code to be executed regardless of which
setSource(org.scijava.io.location.Location) signature
is called. |
Class<?> |
target() |
enabledDefault, getParent, resetgetVersion, loggetInfo, getPriority, setInfo, setPriority, toStringcontextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetVersion, loggetIdentifiercontextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationpublic AbstractReaderFilter()
public AbstractReaderFilter(Class<? extends MetadataWrapper> metaClass)
protected void setSourceHelper(org.scijava.io.location.Location source, SCIFIOConfig config) throws IOException
setSource(org.scijava.io.location.Location) signature
is called.source - - Lowest common denominator of arguments in the
setSource series.IOExceptionprotected void openPlaneHelper()
openPlane(int, long) signature
is called.protected void readPlaneHelper()
readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location>, int, net.imglib2.Interval, io.scif.Plane) signature
is called.protected Metadata getParentMeta()
public Class<?> target()
public void setParent(Object parent)
FiltersetParent in interface FiltersetParent in class AbstractFilter<Reader>parent - - The object wrapped by this filterpublic boolean isCompatible(Class<?> c)
FilterisCompatible in interface FilterisCompatible in class AbstractFilter<Reader>c - - Class to check compatibilitypublic Plane openPlane(int imageIndex, long planeIndex) throws FormatException, IOException
ReaderPlane representation of the pixels at the
specified indices.openPlane in interface ReaderimageIndex - the image index within the dataset.planeIndex - the plane index within the image.Plane at the specified indices.FormatExceptionIOExceptionpublic Plane openPlane(int imageIndex, long planeIndex, net.imglib2.Interval bounds) throws FormatException, IOException
ReaderPlane representation of a desired sub-region from
the pixels at the specified indices.openPlane in interface ReaderimageIndex - the image index within the dataset.planeIndex - the plane index within the image.bounds - bounds of the planar axes.FormatExceptionIOExceptionpublic Plane openPlane(int imageIndex, long planeIndex, Plane plane) throws FormatException, IOException
ReaderPlane object to be reused by reference when opening
complete planes.openPlane in interface ReaderFormatExceptionIOExceptionReader.openPlane(int, long)public Plane openPlane(int imageIndex, long planeIndex, Plane plane, net.imglib2.Interval bounds) throws FormatException, IOException
ReaderPlane object to be reused by reference when opening
sub-regions of planes.openPlane in interface ReaderFormatExceptionIOExceptionReader.openPlane(int, long, Interval)public Plane openPlane(int imageIndex, long planeIndex, SCIFIOConfig config) throws FormatException, IOException
ReaderReader.openPlane(int, long) with configuration options.openPlane in interface ReaderimageIndex - the image index within the dataset.planeIndex - the plane index within the image.config - Configuration information to use for this read.Plane at the specified indices.FormatExceptionIOExceptionpublic Plane openPlane(int imageIndex, long planeIndex, net.imglib2.Interval bounds, SCIFIOConfig config) throws FormatException, IOException
ReaderReader.openPlane(int, long, Interval) with configuration options.openPlane in interface ReaderimageIndex - the image index within the dataset.planeIndex - the plane index within the image.bounds - bounds of the planar axes.config - Configuration information to use for this read.FormatExceptionIOExceptionpublic Plane openPlane(int imageIndex, long planeIndex, Plane plane, SCIFIOConfig config) throws FormatException, IOException
ReaderPlane object to be reused by reference when opening
complete planes.openPlane in interface ReaderFormatExceptionIOExceptionReader.openPlane(int, long, SCIFIOConfig)public Plane openPlane(int imageIndex, long planeIndex, Plane plane, net.imglib2.Interval bounds, SCIFIOConfig config) throws FormatException, IOException
ReaderPlane object to be reused by reference when opening
sub-regions of planes.openPlane in interface ReaderFormatExceptionIOExceptionReader.openPlane(int, long, Interval, SCIFIOConfig)public int fileGroupOption(org.scijava.io.location.Location id) throws FormatException, IOException
GroupablefileGroupOption in interface GroupableFormatExceptionIOExceptionpublic org.scijava.io.location.Location getCurrentLocation()
ReadergetCurrentLocation in interface Readerpublic String[] getDomains()
ReadergetDomains in interface Readerpublic org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> getHandle()
Readerpublic long getOptimalTileWidth(int imageIndex)
ReaderReader.openPlane(int, long).getOptimalTileWidth in interface Readerpublic long getOptimalTileHeight(int imageIndex)
ReaderReader.openPlane(int, long).getOptimalTileHeight in interface Readerpublic void setMetadata(Metadata meta) throws IOException
Reader
NB: This method has accepts a general Metadata so that this
signature can appear in the base interface for all Readers, but
behavior if provided with a Metadata instance not associated with
this Reader is undefined and should throw an exception.
setMetadata in interface ReaderIOExceptionpublic Metadata getMetadata()
ReadergetMetadata in interface Readerpublic void setNormalized(boolean normalize)
ReadersetNormalized in interface Readerpublic boolean isNormalized()
ReaderisNormalized in interface Readerpublic boolean hasCompanionFiles()
ReaderhasCompanionFiles in interface GroupablehasCompanionFiles in interface Readerpublic void setSource(org.scijava.io.location.Location loc) throws IOException
ReadersetSource in interface Readerloc - the locationIOExceptionpublic void setSource(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> handle) throws IOException
ReadersetSource in interface Readerhandle - - The stream to read fromIOExceptionpublic void setSource(org.scijava.io.location.Location loc, SCIFIOConfig config) throws IOException
ReaderReader.setSource(Location) with configuration options.setSource in interface Readerloc - the Locationconfig - Configuration information to use for this read.IOExceptionpublic void setSource(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> handle, SCIFIOConfig config) throws IOException
ReaderReader.setSource(DataHandle) with configuration options.setSource in interface Readerhandle - - The handle to read fromconfig - Configuration information to use for this read.IOExceptionpublic void close(boolean fileOnly)
throws IOException
HasSourceclose in interface HasSourcefileOnly - - If true, only the associated source(s) are closed.IOExceptionpublic void close()
throws IOException
HasSource
Equivalent to calling close(false).
close in interface HasSourceIOExceptionpublic Plane readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> s, int imageIndex, net.imglib2.Interval bounds, Plane plane) throws IOException
Reader
NB Presumes that the source stream s is set to the correct offset,
i.e. start of the plane
readPlane in interface ReaderIOExceptionpublic Plane readPlane(org.scijava.io.handle.DataHandle<org.scijava.io.location.Location> s, int imageIndex, net.imglib2.Interval bounds, int scanlinePad, Plane plane) throws IOException
Reader
NB Presumes that the source stream s is set to the correct offset,
i.e. start of the plane
readPlane in interface ReaderIOExceptionpublic long getPlaneCount(int imageIndex)
ReadergetPlaneCount in interface Readerpublic int getImageCount()
ReadergetImageCount in interface Readerpublic Plane createPlane(net.imglib2.Interval bounds)
ReadercreatePlane in interface Readerbounds - bounds of the planar axes.public Plane createPlane(ImageMetadata meta, net.imglib2.Interval bounds)
ReadercreatePlane in interface Readermeta - - ImageMetadata to use to populate the new plane.bounds - bounds of the planar axes.public <P extends Plane> P castToTypedPlane(Plane plane)
ReaderPlane implementations to the type
associated with this Reader.
NB: this method will fail if the provided Plane is not compatible
with this Reader.
castToTypedPlane in interface Readerplane - - The base Plane to cast.Plane argument cast to P.public boolean isSingleFile(org.scijava.io.location.Location id) throws FormatException, IOException
GroupableisSingleFile in interface GroupableFormatExceptionIOExceptionpublic Format getFormat()
HasFormatpublic String getFormatName()
HasFormatFormat.getFormatName(). Some
Formats may be polymorphic and wish to provide additional name
information based on the specific dataset open - this method allows
overriding of that behavior.getFormatName in interface HasFormatpublic org.scijava.Context getContext()
getContext in interface org.scijava.ContextualgetContext in class org.scijava.AbstractContextualpublic void setContext(org.scijava.Context ctx)
setContext in interface org.scijava.Contextualprotected boolean metaCheck()
protected void cleanUp()
throws IOException
close(boolean) method, if the
fileOnly flag is false.IOExceptionprotected net.imglib2.Interval planarBounds(int imageIndex)
Copyright © 2011–2026 SCIFIO. All rights reserved.