public class AxisGuesser extends Object
Modifier and Type | Field and Description |
---|---|
protected int[] |
axisTypes
Guessed axis types.
|
static int |
C_AXIS
Axis type for channels.
|
static Set<String> |
C_PREFIXES
Prefixes indicating channel dimension.
|
protected boolean |
certain
Whether the guesser is confident that all axis types are correct.
|
protected String |
dimOrder
Original ordering of internal dimensional axes.
|
protected FilePattern |
fp
File pattern identifying dimensional axis blocks.
|
private static org.slf4j.Logger |
LOGGER
Logger for this class.
|
protected String |
newOrder
Adjusted ordering of internal dimensional axes.
|
protected static String |
ONE |
static int |
S_AXIS
Axis type for series.
|
static Set<String> |
S_PREFIXES
Prefixes indicating series dimension.
|
static int |
T_AXIS
Axis type for time points.
|
static Set<String> |
T_PREFIXES
Prefixes indicating time dimension.
|
protected static String |
THREE |
protected static String |
TWO |
static int |
UNKNOWN_AXIS
Axis type for unclassified axes.
|
static int |
Z_AXIS
Axis type for focal planes.
|
static Set<String> |
Z_PREFIXES
Prefixes indicating space dimension.
|
Constructor and Description |
---|
AxisGuesser(FilePattern fp,
String dimOrder,
int sizeZ,
int sizeT,
int sizeC,
boolean isCertain)
Guesses dimensional axis assignments corresponding to the given
file pattern, using the specified dimensional information from
within each file as a guide.
|
Modifier and Type | Method and Description |
---|---|
String |
getAdjustedOrder()
Gets the adjusted dimension order.
|
int |
getAxisCount(int axisType)
Gets the number of axes in the pattern of the given type.
|
int |
getAxisCountC()
Gets the number of C axes in the pattern.
|
int |
getAxisCountS()
Gets the number of S axes in the pattern.
|
int |
getAxisCountT()
Gets the number of T axes in the pattern.
|
int |
getAxisCountZ()
Gets the number of Z axes in the pattern.
|
static int |
getAxisType(String label)
Convert the given label to an axis type.
|
int[] |
getAxisTypes()
Gets the guessed axis type for each dimensional block.
|
FilePattern |
getFilePattern()
Gets the file pattern.
|
String |
getOriginalOrder()
Gets the original dimension order.
|
boolean |
isCertain()
Gets whether the guesser is confident that all axes are correct.
|
void |
setAxisTypes(int[] axes)
Sets the axis type for each dimensional block.
|
private static final org.slf4j.Logger LOGGER
public static final int UNKNOWN_AXIS
public static final int Z_AXIS
public static final int T_AXIS
public static final int C_AXIS
public static final int S_AXIS
protected static final String ONE
protected static final String TWO
protected static final String THREE
protected FilePattern fp
protected String dimOrder
protected String newOrder
protected int[] axisTypes
protected boolean certain
public AxisGuesser(FilePattern fp, String dimOrder, int sizeZ, int sizeT, int sizeC, boolean isCertain)
The algorithm first assigns pattern blocks based on known prefixes. For instance, a block preceded by "time" is assigned to the time points (T) axis. Blocks that don't have a known prefix are checked for special cases (Bio-Rad .pic, RGB). Remaining blocks are assigned according to the given dimensional sizes: dimensions with size greater than 1 are assumed to be already contained within each file, while those with size equal to 1 can be scattered across multiple files and thus are assigned to pattern blocks.
If isCertain
is false
, the algorithm
checks for cases where the reader might have mixed up the Z and T
dimensions. For instance, if the pattern string is
z<*>_<*>
and size{Z,T,C}
= 2,1,1
, then the reader is assumed to be wrong about the
relative positions of Z and T in the given dimOrder
.
The new suggested order (see getAdjustedOrder()
) will have
Z and T swapped and the second block will be assigned to C (the
actual dimensional sizes are assumed to be 1,2,1
).
If after trying all of the above there are still unassigned blocks, they will be assigned to the last dimension in the (possibly adjusted) order.
fp
- The file pattern of the filesdimOrder
- The dimension order (e.g., XYZTC) within each filesizeZ
- The number of Z positions within each filesizeT
- The number of T positions within each filesizeC
- The number of C positions within each fileisCertain
- Whether the dimension order given is known to be good,
or merely a guessFilePattern
public FilePattern getFilePattern()
public String getOriginalOrder()
public String getAdjustedOrder()
public boolean isCertain()
public int[] getAxisTypes()
public void setAxisTypes(int[] axes)
axes
- An array containing values from the enumeration:
public int getAxisCountZ()
public int getAxisCountT()
public int getAxisCountC()
public int getAxisCountS()
public int getAxisCount(int axisType)
axisType
- One of:
public static int getAxisType(String label)
Z_PREFIXES, C_PREFIXES, T_PREFIXES, S_PREFIXES
),
return the corresponding axis type; otherwise, return
UNKNOWN_AXIS
. Note that the match is
case-insensitive.Copyright © 2017 Open Microscopy Environment