Class ANZHeader
java.lang.Object
com.xinapse.multisliceimage.Analyze.ANZHeader
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Analyze75Header
,NIFTIHeader
An abstract Analyze header representation.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
The length in bytes of the auxiliary file field.static final String
The file extension for Analyze header files in lower case form.static final String
The file extension for Analyze header files in upper case form.protected static final int
The length in bytes of the description field.static final String
The file extension for Analyze header files in lower case form.static final int
The maximum dimensionality of an Analyze image.static final String
The file extension for Analyze header files in upper case form.protected Long
The offset from the start of the file to start of the image data. -
Constructor Summary
ModifierConstructorDescriptionprotected
ANZHeader
(boolean compressed) Creates an uninitialised ANZHeader.protected
ANZHeader
(ANZPixFormat dataType, boolean compressed, Long... dims) Constructor for a generic Analyze image header. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a deep copy of this Analyze header.Returns the data base name for this Analyze image header.Returns the description for this Analyze image header.int[]
Gets the glMin and glMax fields for this Analyze image header.void
Sets the data base name for this Analyze image header.void
Sets the number of samples in each dimension of this Analyze image header.void
Sets the number of samples in each dimension of this Analyze image header.void
setMinMax
(int min, int max) Sets the glMin and glMax fields for this Analyze image header.void
setNCols
(short nc) Sets the number of columns in this Analyze image header.void
setNFrames
(short nF) Sets the number of frames in this Analyze image header.void
setNRows
(short nr) Sets the number of rows in this Analyze image header.void
setNSlices
(short ns) Sets the number of slices in this Analyze image header.toString()
Returns the string representation of this Analyze image header.toString
(boolean html) Returns the string representation of this Analyze image header, with optional presentation in HTML format.
-
Field Details
-
EXTENSION
The file extension for Analyze header files in lower case form.- See Also:
-
UPPERCASE_EXTENSION
The file extension for Analyze header files in upper case form. -
COMPRESSED_EXTENSION
The file extension for Analyze header files in lower case form.- See Also:
-
COMPRESSED_UPPERCASE_EXTENSION
The file extension for Analyze header files in upper case form. -
MAXDIM
public static final int MAXDIMThe maximum dimensionality of an Analyze image.- See Also:
-
voxOffset
The offset from the start of the file to start of the image data. Anull
value means that the voxOffset has not been read/calculated yet. For a disk-based image, once voxOffset has been set, it may not be modified, since the pixel data may have been written to disk starting at voxOffset. -
DESCRIPTION_LEN
protected static final int DESCRIPTION_LENThe length in bytes of the description field.- See Also:
-
AUXFILE_LEN
protected static final int AUXFILE_LENThe length in bytes of the auxiliary file field.- See Also:
-
-
Constructor Details
-
ANZHeader
protected ANZHeader(boolean compressed) Creates an uninitialised ANZHeader.- Parameters:
compressed
- true if the image should be compressed when written to disk.
-
ANZHeader
Constructor for a generic Analyze image header. This header exists in memory, and will only be written with an explicit write() method call.- Parameters:
dataType
- an ANZPixFormat.compressed
- true if the image should be compressed when written to disk.dims
- the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.- Throws:
ANZException
- if the header cannot be created.
-
-
Method Details
-
clone
Creates a deep copy of this Analyze header. -
setNCols
public void setNCols(short nc) Sets the number of columns in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of columns in this way will cause errors.- Parameters:
nc
- the number of columns.
-
setNRows
public void setNRows(short nr) Sets the number of rows in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of rows in this way will cause errors.- Parameters:
nr
- the number of rows.
-
setNSlices
public void setNSlices(short ns) Sets the number of slices in this Analyze image header. Warning! If this image header is associated with a set of pixel values into an ANZImage object, then manipulating the number of slices in this way will cause errors.- Parameters:
ns
- the number of slices.
-
setNFrames
public void setNFrames(short nF) Sets the number of frames in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of frames in this way will cause errors.- Parameters:
nF
- the number of frames.
-
setDims
Sets the number of samples in each dimension of this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of samples in this way will cause errors.- Parameters:
dims
- the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.- Throws:
ANZException
- if the dimensionality or numbers of samples are illegal.
-
setDims
Sets the number of samples in each dimension of this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of samples in this way will cause errors.- Parameters:
dims
- the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.- Throws:
ANZException
- if the dimensionality or numbers of samples are illegal.
-
getDBName
Returns the data base name for this Analyze image header.- Returns:
- a String representing the data base name.
-
setDBName
Sets the data base name for this Analyze image header. A suppiled name that is too long will be truncated.- Parameters:
name
- a String representing the name data base name.
-
getDescription
Returns the description for this Analyze image header.- Returns:
- a String representing the description.
-
getMinMax
public int[] getMinMax()Gets the glMin and glMax fields for this Analyze image header. If the min / max fields have not been set, then the min / max values will both be zero.- Returns:
- an int array of length 2, where the first element is the minimum pixel value in the image, and second element is the maximum pixel value in the image.
-
setMinMax
Sets the glMin and glMax fields for this Analyze image header.- Parameters:
min
- the minimum pixel value in the image.max
- the maximum pixel value in the image.- Throws:
InvalidImageException
- if the values supplied are unsuitable, or the values cannot be set.
-
toString
Returns the string representation of this Analyze image header. -
toString
Returns the string representation of this Analyze image header, with optional presentation in HTML format.- Parameters:
html
- iftrue
, then the string will contain HTML tags.- Returns:
- a
String
describing the header, optionally in HTML format.
-