dki_measures.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:MDT 作者: cbclab 项目源码 文件源码
def calculate(self, parameters_dict):
        """Calculate DKI statistics like the mean, axial and radial kurtosis.

        The Mean Kurtosis (MK) is calculated by averaging the Kurtosis over orientations on the unit sphere.
        The Axial Kurtosis (AK) is obtained using the principal direction of diffusion (fe; first eigenvec)
        from the Tensor as its direction and then averaging the Kurtosis over +fe and -fe.
        Finally, the Radial Kurtosis (RK) is calculated by averaging the Kurtosis over a circle of directions around
        the first eigenvec.

        Args:
            parameters_dict (dict): the fitted Kurtosis parameters, this requires a dictionary with at least
                the elements:
                'd', 'dperp0', 'dperp1', 'theta', 'phi', 'psi', 'W_0000', 'W_1000', 'W_1100', 'W_1110',
                'W_1111', 'W_2000', 'W_2100', 'W_2110', 'W_2111', 'W_2200', 'W_2210', 'W_2211',
                'W_2220', 'W_2221', 'W_2222'.

        Returns:
            dict: maps for the Mean Kurtosis (MK), Axial Kurtosis (AK) and Radial Kurtosis (RK).
        """
        if parameters_dict['d'].dtype == np.float32:
            np_dtype = np.float32
            mot_float_type = SimpleCLDataType.from_string('float')
            double_precision = False
        else:
            np_dtype = np.float64
            mot_float_type = SimpleCLDataType.from_string('double')
            double_precision = True

        param_names = ['d', 'dperp0', 'dperp1', 'theta', 'phi', 'psi', 'W_0000', 'W_1000', 'W_1100', 'W_1110',
                       'W_1111', 'W_2000', 'W_2100', 'W_2110', 'W_2111', 'W_2200', 'W_2210', 'W_2211',
                       'W_2220', 'W_2221', 'W_2222']
        parameters = np.require(np.column_stack([parameters_dict[n] for n in param_names]),
                                np_dtype, requirements=['C', 'A', 'O'])
        directions = convert_data_to_dtype(self._get_spherical_samples(), 'mot_float_type4', mot_float_type)
        return self._calculate(parameters, param_names, directions, double_precision)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号