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 BartNDArrayapply(UnaryOperator<org.apache.commons.math3.complex.Complex> func)BartNDArrayapplyOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)BartNDArrayapplyWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)BartNDArrayapplyWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)booleanareBartDimsSpecified()Checks if meaning of dimensions are specified in BART or not.BartNDArraycopy()BartComplexFloatNDArraycopyFrom(io.github.hakkelt.ndarrays.NDArray<?> array)booleanequals(Object obj)BartNDArrayfillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)BartNDArrayfillUsingLinearIndices(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)FloatgetImagUnchecked(int linearIndex)FloatgetImagUnchecked(int... indices)StringgetNamePrefix()FloatgetRealUnchecked(int linearIndex)FloatgetRealUnchecked(int... indices)inthashCode()BartNDArraymapOnComplexSlices(BiFunction<io.github.hakkelt.ndarrays.ComplexNDArray<Float>,int[],io.github.hakkelt.ndarrays.NDArray<?>> func, int... iterationDims)static BartComplexFloatNDArrayof(byte... array)Factory method that creates an NDArray from a list or 1D array of byte values.static BartComplexFloatNDArrayof(byte[] real, byte[] imag)Factory method that creates a BartNDArray from two 1D array of byte values.static BartComplexFloatNDArrayof(double... array)Factory method that creates an NDArray from a list or 1D array of double values.static BartComplexFloatNDArrayof(double[] real, double[] imag)Factory method that creates a BartNDArray from two 1D array of double values.static BartComplexFloatNDArrayof(float... array)Factory method that creates an NDArray from a list or 1D array of float values.static BartComplexFloatNDArrayof(float[] real, float[] imag)Factory method that creates a BartNDArray from two 1D array of float values.static BartComplexFloatNDArrayof(int... array)Factory method that creates an NDArray from a list or 1D array of int values.static BartComplexFloatNDArrayof(int[] real, int[] imag)Factory method that creates a BartNDArray from two 1D array of int values.static BartComplexFloatNDArrayof(long... array)Factory method that creates an NDArray from a list or 1D array of long values.static BartComplexFloatNDArrayof(long[] real, long[] imag)Factory method that creates a BartNDArray from two 1D array of long values.static BartComplexFloatNDArrayof(short... array)Factory method that creates an NDArray from a list or 1D array of short values.static BartComplexFloatNDArrayof(short[] real, short[] imag)Factory method that creates a BartNDArray from a list or 1D array of short values.static BartComplexFloatNDArrayof(Object[] realOrComplex)Factory method that creates an NDArray from a multi-dimensional array of numeric values (including Complex type).static BartComplexFloatNDArrayof(Object[] real, Object[] imag)Factory method that creates a BartNDArray from two multi-dimensional arrays of numeric values.voidsetBartDims(BartDimsEnum... bartDims)Sets the meaning of dimensions.BartNDArraysimilar()-
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:
copyFromin interfaceBartNDArray- Specified by:
copyFromin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
copyFromin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
-
similar
public BartNDArray similar()
- Specified by:
similarin interfaceBartNDArray- Specified by:
similarin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
similarin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
similarin classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
copy
public BartNDArray copy()
- Specified by:
copyin interfaceBartNDArray- Specified by:
copyin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
copyin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
copyin 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:BartNDArrayChecks if meaning of dimensions are specified in BART or not.- Specified by:
areBartDimsSpecifiedin interfaceBartNDArray- Returns:
- true if the meaning of dimensions in BART are specified
-
getBartDims
public BartDimsEnum[] getBartDims()
Description copied from interface:BartNDArrayReturns an array of BartDimsEnum that tells the meaning of each dimensions in BART.- Specified by:
getBartDimsin 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:BartNDArraySets the meaning of dimensions.- Specified by:
setBartDimsin interfaceBartNDArray- Parameters:
bartDims- meaning of dimensions in BART.
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
equalsin classio.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,Float>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
hashCodein classio.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,Float>
-
getNamePrefix
public String getNamePrefix()
- Specified by:
getNamePrefixin 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:
applyin interfaceBartNDArray- Specified by:
applyin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
applyin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
applyin 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:
applyWithLinearIndicesin interfaceBartNDArray- Specified by:
applyWithLinearIndicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
applyWithLinearIndicesin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
applyWithLinearIndicesin 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:
applyWithCartesianIndicesin interfaceBartNDArray- Specified by:
applyWithCartesianIndicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
applyWithCartesianIndicesin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
applyWithCartesianIndicesin classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
fillUsingLinearIndices
public BartNDArray fillUsingLinearIndices(IntFunction<org.apache.commons.math3.complex.Complex> func)
- Specified by:
fillUsingLinearIndicesin interfaceBartNDArray- Specified by:
fillUsingLinearIndicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
fillUsingLinearIndicesin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
fillUsingLinearIndicesin classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
fillUsingCartesianIndices
public BartNDArray fillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)
- Specified by:
fillUsingCartesianIndicesin interfaceBartNDArray- Specified by:
fillUsingCartesianIndicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Specified by:
fillUsingCartesianIndicesin interfaceio.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>- Overrides:
fillUsingCartesianIndicesin 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:
applyOnComplexSlicesin interfaceBartNDArray- Specified by:
applyOnComplexSlicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Overrides:
applyOnComplexSlicesin 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:
mapOnComplexSlicesin interfaceBartNDArray- Specified by:
mapOnComplexSlicesin interfaceio.github.hakkelt.ndarrays.ComplexNDArray<Float>- Overrides:
mapOnComplexSlicesin classio.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
-
-