def get_factors(self, unique_R, inds, centers, widths):
        """Calculate factors based on centers and widths

        Parameters
        ----------

        unique_R : a list of array,
            Each element contains unique value in one dimension of
            scanner coordinate matrix R.

        inds : a list of array,
            Each element contains the indices to reconstruct one
            dimension of original cooridnate matrix from the unique
            array.

        centers : 2D array, with shape [K, n_dim]
            The centers of  factors.

        widths : 1D array, with shape [K, 1]
            The widths of factors.


        Returns
        -------

        F : 2D array, with shape [n_voxel,self.K]
            The latent factors from fMRI data.

        """

        F = np.zeros((len(inds[0]), self.K))
        tfa_extension.factor(
            F,
            centers,
            widths,
            unique_R[0],
            unique_R[1],
            unique_R[2],
            inds[0],
            inds[1],
            inds[2])

        return F