Package io.github.hakkelt.bartwrapper
Class BartComplexFloatNDArray
- java.lang.Object
-
- io.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,T>
-
- io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
- io.github.hakkelt.bartwrapper.BartComplexFloatNDArray
-
- All Implemented Interfaces:
BartNDArray
,io.github.hakkelt.ndarrays.ComplexNDArray<Float>
,io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
,Iterable<org.apache.commons.math3.complex.Complex>
public class BartComplexFloatNDArray extends io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float> implements BartNDArray
Implementation for the NDArray of float (single-precision, 32 bit floating point) values that is compatible with arrays expected by BART. It also contains some utility functions to help dealing with the 16 dimensions used by BART.
-
-
Constructor Summary
Constructors Constructor Description BartComplexFloatNDArray(int... dims)
Simple constructor that defines only the shape of the NDArray and fills it with zeros.BartComplexFloatNDArray(io.github.hakkelt.ndarrays.NDArray<?> array)
Copy constructor.BartComplexFloatNDArray(io.github.hakkelt.ndarrays.NDArray<? extends Number> real, io.github.hakkelt.ndarrays.NDArray<? extends Number> imag)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BartNDArray
apply(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
BartNDArray
applyOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)
BartNDArray
applyWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
BartNDArray
applyWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
boolean
areBartDimsSpecified()
Checks if meaning of dimensions are specified in BART or not.BartNDArray
copy()
BartComplexFloatNDArray
copyFrom(io.github.hakkelt.ndarrays.NDArray<?> array)
boolean
equals(Object obj)
BartNDArray
fillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)
BartNDArray
fillUsingLinearIndices(IntFunction<org.apache.commons.math3.complex.Complex> func)
BartDimsEnum[]
getBartDims()
Returns an array of BartDimsEnum that tells the meaning of each dimensions in BART.static Collector<Object,List<Object>,io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>>
getCollector(int... dims)
Float
getImagUnchecked(int linearIndex)
Float
getImagUnchecked(int... indices)
String
getNamePrefix()
Float
getRealUnchecked(int linearIndex)
Float
getRealUnchecked(int... indices)
int
hashCode()
BartNDArray
mapOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)
static BartComplexFloatNDArray
of(byte... array)
Factory method that creates an NDArray from a list or 1D array of byte values.static BartComplexFloatNDArray
of(byte[] real, byte[] imag)
Factory method that creates a BartNDArray from two 1D array of byte values.static BartComplexFloatNDArray
of(double... array)
Factory method that creates an NDArray from a list or 1D array of double values.static BartComplexFloatNDArray
of(double[] real, double[] imag)
Factory method that creates a BartNDArray from two 1D array of double values.static BartComplexFloatNDArray
of(float... array)
Factory method that creates an NDArray from a list or 1D array of float values.static BartComplexFloatNDArray
of(float[] real, float[] imag)
Factory method that creates a BartNDArray from two 1D array of float values.static BartComplexFloatNDArray
of(int... array)
Factory method that creates an NDArray from a list or 1D array of int values.static BartComplexFloatNDArray
of(int[] real, int[] imag)
Factory method that creates a BartNDArray from two 1D array of int values.static BartComplexFloatNDArray
of(long... array)
Factory method that creates an NDArray from a list or 1D array of long values.static BartComplexFloatNDArray
of(long[] real, long[] imag)
Factory method that creates a BartNDArray from two 1D array of long values.static BartComplexFloatNDArray
of(short... array)
Factory method that creates an NDArray from a list or 1D array of short values.static BartComplexFloatNDArray
of(short[] real, short[] imag)
Factory method that creates a BartNDArray from a list or 1D array of short values.static BartComplexFloatNDArray
of(Object[] realOrComplex)
Factory method that creates an NDArray from a multi-dimensional array of numeric values (including Complex type).static BartComplexFloatNDArray
of(Object[] real, Object[] imag)
Factory method that creates a BartNDArray from two multi-dimensional arrays of numeric values.void
setBartDims(BartDimsEnum... bartDims)
Sets the meaning of dimensions.BartNDArray
similar()
-
Methods inherited from class io.github.hakkelt.ndarrays.AbstractComplexNDArray
abs, argument, dataTypeAsString, dtype, dtype2, imaginary, real, set, set, setImag, setImag, setReal, setReal
-
Methods inherited from class io.github.hakkelt.ndarrays.internal.AbstractNDArray
accumulate, applyOnSlices, contains, contentToString, contentToString, forEach, forEachWithCartesianIndices, forEachWithLinearIndices, get, get, getImag, getImag, getReal, getReal, iterator, length, mapOnSlices, maybeParallelStream, ndim, norm, norm, parallelStream, prod, reduceSlices, set, set, shape, shape, spliterator, stream, streamCartesianIndices, streamLinearIndices, sum, toArray, toArray, toArray, toString, writeToFile
-
Methods inherited from interface io.github.hakkelt.bartwrapper.BartNDArray
add, add, add, add, add, add, add, add, addInplace, addInplace, addInplace, addInplace, addInplace, addInplace, addInplace, addInplace, concatenate, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, divide, divide, divide, divide, divide, divide, divide, divide, divideInplace, divideInplace, divideInplace, divideInplace, divideInplace, divideInplace, divideInplace, divideInplace, dropDims, fill, fill, fill, inverseMask, map, mapWithCartesianIndices, mapWithLinearIndices, mask, mask, maskWithCartesianIndices, maskWithLinearIndices, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiply, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, multiplyInplace, permuteDims, reshape, selectAndReorderBartDims, selectDims, slice, squeeze, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtract, subtractInplace, subtractInplace, subtractInplace, subtractInplace, subtractInplace, subtractInplace, subtractInplace, subtractInplace, sum
-
Methods inherited from interface io.github.hakkelt.ndarrays.ComplexNDArray
abs, accumulate, argument, contentToString, dtype2, getImag, getImag, getReal, getReal, imaginary, prod, real, reduceComplexSlices, setImag, setImag, setReal, setReal
-
Methods inherited from interface io.github.hakkelt.ndarrays.NDArray
accumulate, applyOnSlices, contains, contentToString, dataTypeAsString, dtype, forEach, forEachWithCartesianIndices, forEachWithLinearIndices, get, get, iterator, length, mapOnSlices, ndim, norm, norm, norm, parallelStream, prod, reduceSlices, set, set, set, set, shape, shape, spliterator, stream, streamCartesianIndices, streamLinearIndices, sum, toArray, toArray, toArray, toString, writeToFile
-
-
-
-
Constructor Detail
-
BartComplexFloatNDArray
public BartComplexFloatNDArray(int... dims)
Simple constructor that defines only the shape of the NDArray and fills it with zeros.- Parameters:
dims
- dimensions / shape of the NDArray
-
BartComplexFloatNDArray
public BartComplexFloatNDArray(io.github.hakkelt.ndarrays.NDArray<?> array)
Copy constructor.- Parameters:
array
- NDArray from which entries are copied from.
-
BartComplexFloatNDArray
public BartComplexFloatNDArray(io.github.hakkelt.ndarrays.NDArray<? extends Number> real, io.github.hakkelt.ndarrays.NDArray<? extends Number> imag)
Copy constructor.- Parameters:
real
- NDArray from which real part of the new array is copied from.imag
- NDArray from which imaginary part of the new array is copied from.
-
-
Method Detail
-
of
public static BartComplexFloatNDArray of(float... array)
Factory method that creates an NDArray from a list or 1D array of float values.- Parameters:
array
- a list or 1D array of float values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of float values
-
of
public static BartComplexFloatNDArray of(double... array)
Factory method that creates an NDArray from a list or 1D array of double values.- Parameters:
array
- a list or 1D array of double values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of double values
-
of
public static BartComplexFloatNDArray of(byte... array)
Factory method that creates an NDArray from a list or 1D array of byte values.- Parameters:
array
- a list or 1D array of byte values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of byte values
-
of
public static BartComplexFloatNDArray of(short... array)
Factory method that creates an NDArray from a list or 1D array of short values.- Parameters:
array
- a list or 1D array of short values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of short values
-
of
public static BartComplexFloatNDArray of(int... array)
Factory method that creates an NDArray from a list or 1D array of int values.- Parameters:
array
- a list or 1D array of int values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of int values
-
of
public static BartComplexFloatNDArray of(long... array)
Factory method that creates an NDArray from a list or 1D array of long values.- Parameters:
array
- a list or 1D array of long values from which a SimpleITKFloat32NDArray is created.- Returns:
- an NDArray created from a list or 1D array of long values
-
of
public static BartComplexFloatNDArray of(Object[] realOrComplex)
Factory method that creates an NDArray from a multi-dimensional array of numeric values (including Complex type).- Parameters:
realOrComplex
- a multi-dimensional array of numeric values (including Complex type) from which a SimpleITKComplexFloat32NDArray is created.- Returns:
- an NDArray created from a multi-dimensional array of numeric values
-
of
public static BartComplexFloatNDArray of(float[] real, float[] imag)
Factory method that creates a BartNDArray from two 1D array of float values.- Parameters:
real
- a 1D array of float values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of float values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of float values
-
of
public static BartComplexFloatNDArray of(double[] real, double[] imag)
Factory method that creates a BartNDArray from two 1D array of double values.- Parameters:
real
- a 1D array of double values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of double values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of double values
-
of
public static BartComplexFloatNDArray of(byte[] real, byte[] imag)
Factory method that creates a BartNDArray from two 1D array of byte values.- Parameters:
real
- a 1D array of byte values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of byte values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of byte values
-
of
public static BartComplexFloatNDArray of(short[] real, short[] imag)
Factory method that creates a BartNDArray from a list or 1D array of short values.- Parameters:
real
- a 1D array of short values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of short values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of short values
-
of
public static BartComplexFloatNDArray of(int[] real, int[] imag)
Factory method that creates a BartNDArray from two 1D array of int values.- Parameters:
real
- a 1D array of int values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of int values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of int values
-
of
public static BartComplexFloatNDArray of(long[] real, long[] imag)
Factory method that creates a BartNDArray from two 1D array of long values.- Parameters:
real
- a 1D array of long values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a 1D array of long values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two 1D array of long values
-
of
public static BartComplexFloatNDArray of(Object[] real, Object[] imag)
Factory method that creates a BartNDArray from two multi-dimensional arrays of numeric values.- Parameters:
real
- a multi-dimensional array of numeric values from which the real part of the created SimpleITKComplexFloat32NDArray is read.imag
- a multi-dimensional array of numeric values from which the imaginary part of the created SimpleITKComplexFloat32NDArray is read.- Returns:
- a BartNDArray created from the two multi-dimensional arrays of numeric values
-
copyFrom
public BartComplexFloatNDArray copyFrom(io.github.hakkelt.ndarrays.NDArray<?> array)
- Specified by:
copyFrom
in interfaceBartNDArray
- Specified by:
copyFrom
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
copyFrom
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
-
similar
public BartNDArray similar()
- Specified by:
similar
in interfaceBartNDArray
- Specified by:
similar
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
similar
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
similar
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
copy
public BartNDArray copy()
- Specified by:
copy
in interfaceBartNDArray
- Specified by:
copy
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
copy
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
copy
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
getRealUnchecked
public Float getRealUnchecked(int linearIndex)
-
getRealUnchecked
public Float getRealUnchecked(int... indices)
-
getImagUnchecked
public Float getImagUnchecked(int linearIndex)
-
getImagUnchecked
public Float getImagUnchecked(int... indices)
-
getCollector
public static Collector<Object,List<Object>,io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>> getCollector(int... dims)
-
areBartDimsSpecified
public boolean areBartDimsSpecified()
Description copied from interface:BartNDArray
Checks if meaning of dimensions are specified in BART or not.- Specified by:
areBartDimsSpecified
in interfaceBartNDArray
- Returns:
- true if the meaning of dimensions in BART are specified
-
getBartDims
public BartDimsEnum[] getBartDims()
Description copied from interface:BartNDArray
Returns an array of BartDimsEnum that tells the meaning of each dimensions in BART.- Specified by:
getBartDims
in interfaceBartNDArray
- Returns:
- an array of BartDimsEnum that tells the meaning of each dimensions in BART
-
setBartDims
public void setBartDims(BartDimsEnum... bartDims)
Description copied from interface:BartNDArray
Sets the meaning of dimensions.- Specified by:
setBartDims
in interfaceBartNDArray
- Parameters:
bartDims
- meaning of dimensions in BART.
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
equals
in classio.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,Float>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
hashCode
in classio.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,Float>
-
getNamePrefix
public String getNamePrefix()
- Specified by:
getNamePrefix
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
-
apply
public BartNDArray apply(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
- Specified by:
apply
in interfaceBartNDArray
- Specified by:
apply
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
apply
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
apply
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
applyWithLinearIndices
public BartNDArray applyWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
- Specified by:
applyWithLinearIndices
in interfaceBartNDArray
- Specified by:
applyWithLinearIndices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
applyWithLinearIndices
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
applyWithLinearIndices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
applyWithCartesianIndices
public BartNDArray applyWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
- Specified by:
applyWithCartesianIndices
in interfaceBartNDArray
- Specified by:
applyWithCartesianIndices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
applyWithCartesianIndices
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
applyWithCartesianIndices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
fillUsingLinearIndices
public BartNDArray fillUsingLinearIndices(IntFunction<org.apache.commons.math3.complex.Complex> func)
- Specified by:
fillUsingLinearIndices
in interfaceBartNDArray
- Specified by:
fillUsingLinearIndices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
fillUsingLinearIndices
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
fillUsingLinearIndices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
fillUsingCartesianIndices
public BartNDArray fillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)
- Specified by:
fillUsingCartesianIndices
in interfaceBartNDArray
- Specified by:
fillUsingCartesianIndices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Specified by:
fillUsingCartesianIndices
in interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
- Overrides:
fillUsingCartesianIndices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
applyOnComplexSlices
public BartNDArray applyOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)
- Specified by:
applyOnComplexSlices
in interfaceBartNDArray
- Specified by:
applyOnComplexSlices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Overrides:
applyOnComplexSlices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
mapOnComplexSlices
public BartNDArray mapOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)
- Specified by:
mapOnComplexSlices
in interfaceBartNDArray
- Specified by:
mapOnComplexSlices
in interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>
- Overrides:
mapOnComplexSlices
in classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
-