Class AxisGuesser
- Author:
- Curtis Rueden ctrueden at wisc.edu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]Guessed axis types.static final intAxis type for channels.Prefixes indicating channel dimension.protected booleanWhether the guesser is confident that all axis types are correct.protected StringOriginal ordering of internal dimensional axes.protected FilePatternFile pattern identifying dimensional axis blocks.protected StringAdjusted ordering of internal dimensional axes.protected static final Stringstatic final intAxis type for series.Prefixes indicating series dimension.static final intAxis type for time points.Prefixes indicating time dimension.protected static final Stringprotected static final Stringstatic final intAxis type for unclassified axes.static final intAxis type for focal planes.Prefixes indicating space dimension. -
Constructor Summary
ConstructorsConstructorDescriptionAxisGuesser(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. -
Method Summary
Modifier and TypeMethodDescriptionGets the adjusted dimension order.intgetAxisCount(int axisType) Gets the number of axes in the pattern of the given type.intGets the number of C axes in the pattern.intGets the number of S axes in the pattern.intGets the number of T axes in the pattern.intGets the number of Z axes in the pattern.static intgetAxisType(String label) Convert the given label to an axis type.int[]Gets the guessed axis type for each dimensional block.Gets the file pattern.Gets the original dimension order.booleanGets whether the guesser is confident that all axes are correct.voidsetAxisTypes(int[] axes) Sets the axis type for each dimensional block.
-
Field Details
-
UNKNOWN_AXIS
public static final int UNKNOWN_AXISAxis type for unclassified axes.- See Also:
-
Z_AXIS
public static final int Z_AXISAxis type for focal planes.- See Also:
-
T_AXIS
public static final int T_AXISAxis type for time points.- See Also:
-
C_AXIS
public static final int C_AXISAxis type for channels.- See Also:
-
S_AXIS
public static final int S_AXISAxis type for series.- See Also:
-
Z_PREFIXES
Prefixes indicating space dimension. -
T_PREFIXES
Prefixes indicating time dimension. -
C_PREFIXES
Prefixes indicating channel dimension. -
S_PREFIXES
Prefixes indicating series dimension. -
ONE
- See Also:
-
TWO
- See Also:
-
THREE
- See Also:
-
fp
File pattern identifying dimensional axis blocks. -
dimOrder
Original ordering of internal dimensional axes. -
newOrder
Adjusted ordering of internal dimensional axes. -
axisTypes
protected int[] axisTypesGuessed axis types. -
certain
protected boolean certainWhether the guesser is confident that all axis types are correct.
-
-
Constructor Details
-
AxisGuesser
public 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.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
isCertainisfalse, the algorithm checks for cases where the reader might have mixed up the Z and T dimensions. For instance, if the pattern string isz<*>_<*>andsize{Z,T,C} = 2,1,1, then the reader is assumed to be wrong about the relative positions of Z and T in the givendimOrder. The new suggested order (seegetAdjustedOrder()) will have Z and T swapped and the second block will be assigned to C (the actual dimensional sizes are assumed to be1,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.
- Parameters:
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 guess- See Also:
-
-
Method Details
-
getFilePattern
Gets the file pattern. -
getOriginalOrder
Gets the original dimension order. -
getAdjustedOrder
Gets the adjusted dimension order. -
isCertain
public boolean isCertain()Gets whether the guesser is confident that all axes are correct. -
getAxisTypes
public int[] getAxisTypes()Gets the guessed axis type for each dimensional block.- Returns:
- An array containing values from the enumeration:
- Z_AXIS: focal planes
- T_AXIS: time points
- C_AXIS: channels
- S_AXIS: series
-
setAxisTypes
public void setAxisTypes(int[] axes) Sets the axis type for each dimensional block.- Parameters:
axes- An array containing values from the enumeration:- Z_AXIS: focal planes
- T_AXIS: time points
- C_AXIS: channels
- S_AXIS: series
-
getAxisCountZ
public int getAxisCountZ()Gets the number of Z axes in the pattern. -
getAxisCountT
public int getAxisCountT()Gets the number of T axes in the pattern. -
getAxisCountC
public int getAxisCountC()Gets the number of C axes in the pattern. -
getAxisCountS
public int getAxisCountS()Gets the number of S axes in the pattern. -
getAxisCount
public int getAxisCount(int axisType) Gets the number of axes in the pattern of the given type.- Parameters:
axisType- One of:- Z_AXIS: focal planes
- T_AXIS: time points
- C_AXIS: channels
- S_AXIS: series
-
getAxisType
Convert the given label to an axis type. If the label ends with one of the known prefixes for the Z, C, T or S axis (as defined inZ_PREFIXES, C_PREFIXES, T_PREFIXES, S_PREFIXES), return the corresponding axis type; otherwise, returnUNKNOWN_AXIS. Note that the match is case-insensitive.
-