Documentation
¶
Index ¶
- func IsValidDatatype(datatype int32) bool
- func NewNiiWriter(filePath string, options ...func(*niiWriter)) (*niiWriter, error)
- func WithCompression(withCompression bool) func(writer *niiWriter)
- func WithHeader(header *Nii1Header) func(*niiWriter)
- func WithHeaderCompression(headerCompression bool) func(*niiWriter)
- func WithHeaderFile(headerFile string) func(*niiReader) error
- func WithInMemory(inMemory bool) func(*niiReader) error
- func WithNIfTIData(data *Nii) func(writer *niiWriter)
- func WithRetainHeader(retainHeader bool) func(*niiReader) error
- func WithWriteHeaderFile(writeHeaderFile bool) func(*niiWriter)
- type NiiReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidDatatype ¶
IsValidDatatype checks whether the datatype is valid for NIFTI format
func NewNiiWriter ¶
NewNiiWriter returns a new write for export
func WithCompression ¶
func WithCompression(withCompression bool) func(writer *niiWriter)
WithCompression sets the option to write compressed NIfTI image to a single file (.nii.gz)
If true, the whole file will be compressed. Default is false.
func WithHeader ¶
func WithHeader(header *Nii1Header) func(*niiWriter)
WithHeader sets the option to allow user to provide predefined NIfTI-1 header structure.
If no header provided, the header will be converted from the NIfTI image structure
func WithHeaderCompression ¶
func WithHeaderCompression(headerCompression bool) func(*niiWriter)
WithHeaderCompression sets the option to write compressed NIfTI header structure to file (.hdr.gz)
If true, the header will be compressed. It only works when WithWriteHeaderFile is provided with option `true`. Default is false.
func WithHeaderFile ¶
WithHeaderFile allows option to specify the separate header file
func WithInMemory ¶
WithInMemory allows option to read the whole file into memory
func WithNIfTIData ¶
func WithNIfTIData(data *Nii) func(writer *niiWriter)
WithNIfTIData sets the option to allow user to provide predefined NIfTI-1 data structure.
func WithRetainHeader ¶
WithRetainHeader allows option to keep the header after parsing instead of just keeping the NIfTI data structure
func WithWriteHeaderFile ¶
func WithWriteHeaderFile(writeHeaderFile bool) func(*niiWriter)
WithWriteHeaderFile sets the option to write NIfTI image to a header/image (.hdr/.img) file pair
If true, output will be two files for the header and the image. Default is false.
Types ¶
type NiiReader ¶
type NiiReader interface { // Parse returns the input NIFTI as header and image data Parse() error // GetOrientation returns the image orientation GetOrientation() [3]string // GetSliceCode returns the slice code GetSliceCode() string // GetDatatype returns the datatype of the NIFTI image GetDatatype() string // GetSFormCode returns the SForm code string GetSFormCode() string // GetQFormCode returns the QForm code string GetQFormCode() string // GetImgShape returns the image shape [x, y, z, t] GetImgShape() [4]int64 // GetAt returns the value at [x, y, z, t] as float64 GetAt(x, y, z, t int64) float64 // GetBinaryOrder returns the binary order of the NIFTI image GetBinaryOrder() binary.ByteOrder // GetUnitsOfMeasurements returns the spatial and temporal units of the NIFTI image GetUnitsOfMeasurements() ([2]string, error) // GetTimeSeries returns the time series of value at [x, y, z] GetTimeSeries(x, y, z int64) ([]float64, error) // GetSlice returns the X-Y slice at [z, t] GetSlice(z, t int64) ([][]float64, error) // GetVolume returns the image data as 3-D matrix GetVolume(t int64) ([][][]float64, error) // GetAffine returns the affine matrix of the NIFTI image GetAffine() matrix.DMat44 // QuaternToMatrix converts the quarternions parameters to matrix QuaternToMatrix() matrix.DMat44 // GetNiiData returns the raw NIFTI header and image data GetNiiData() *Nii }