Class 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 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 interface BartNDArray
        Specified by:
        copyFrom in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        copyFrom in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
      • similar

        public BartNDArray similar()
        Specified by:
        similar in interface BartNDArray
        Specified by:
        similar in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        similar in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        similar in class io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
      • copy

        public BartNDArray copy()
        Specified by:
        copy in interface BartNDArray
        Specified by:
        copy in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        copy in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        copy in class io.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 interface BartNDArray
        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 interface BartNDArray
        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 interface BartNDArray
        Parameters:
        bartDims - meaning of dimensions in BART.
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        equals in class io.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,​Float>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        hashCode in class io.github.hakkelt.ndarrays.internal.AbstractNDArray<org.apache.commons.math3.complex.Complex,​Float>
      • getNamePrefix

        public String getNamePrefix()
        Specified by:
        getNamePrefix in interface io.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 interface BartNDArray
        Specified by:
        apply in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        apply in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        apply in class io.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 interface BartNDArray
        Specified by:
        applyWithLinearIndices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        applyWithLinearIndices in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        applyWithLinearIndices in class io.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 interface BartNDArray
        Specified by:
        applyWithCartesianIndices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        applyWithCartesianIndices in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        applyWithCartesianIndices in class io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
      • fillUsingLinearIndices

        public BartNDArray fillUsingLinearIndices​(IntFunction<org.apache.commons.math3.complex.Complex> func)
        Specified by:
        fillUsingLinearIndices in interface BartNDArray
        Specified by:
        fillUsingLinearIndices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        fillUsingLinearIndices in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        fillUsingLinearIndices in class io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>
      • fillUsingCartesianIndices

        public BartNDArray fillUsingCartesianIndices​(Function<int[],​org.apache.commons.math3.complex.Complex> func)
        Specified by:
        fillUsingCartesianIndices in interface BartNDArray
        Specified by:
        fillUsingCartesianIndices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Specified by:
        fillUsingCartesianIndices in interface io.github.hakkelt.ndarrays.NDArray<org.apache.commons.math3.complex.Complex>
        Overrides:
        fillUsingCartesianIndices in class io.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 interface BartNDArray
        Specified by:
        applyOnComplexSlices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Overrides:
        applyOnComplexSlices in class io.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 interface BartNDArray
        Specified by:
        mapOnComplexSlices in interface io.github.hakkelt.ndarrays.ComplexNDArray<Float>
        Overrides:
        mapOnComplexSlices in class io.github.hakkelt.ndarrays.AbstractComplexNDArray<Float>