示例#1
0
    def signal(self, S0=1):
        """
        The signal generated by the ODF in each bvec direction
        """
        # Initialize to zero:
        signal = np.zeros(self.bvecs.shape[-1])

        # Decompose the response function to its eigen-decomposition:
        evals, evecs = self.response_function.decompose
        # We generate the signal for each one of the fibers in the ODF: 
        for odf_idx, odf_vec in enumerate(self.odf.bvecs):
            this_response = ozt.rotate_to_vector(odf_vec,
                                                 evals,
                                                 evecs,
                                                 self.bvecs,
                                                 self.bvals)

            this_signal = (self.odf.weights[odf_idx] *
                          this_response.predicted_signal(S0))
            signal += this_signal
            
        if self.iso:
            # The iso component has the diffusivity of the tensor:
            md = np.mean(np.diag(self.Q))
            iso_signal = self.iso * ozt.stejskal_tanner(S0, self.bvals, md) 
            signal += iso_signal
            signal /=  np.sum(np.hstack([self.odf.weights, self.iso]))
        else:
            signal /=  np.sum(self.odf.weights)
            
        return signal
示例#2
0
    def adc(self):
        """

        The ADC in each bvec direction, given the ODF

        """
        
        # Initialize to zero:
        adc = np.zeros(self.bvecs.shape[-1])

        # Decompose the response function to its eigen-decomposition:
        evals, evecs = self.response_function.decompose
        # We generate the signal for each one of the fibers in the ODF: 
        for odf_idx, odf_vec in enumerate(self.odf.bvecs):
            this_response = ozt.rotate_to_vector(odf_vec,
                                                 evals,
                                                 evecs,
                                                 self.bvecs,
                                                 self.bvals)
            this_adc = self.odf.weights[odf_idx] * this_response.ADC
            adc += this_adc

        return adc / np.sum(self.odf.weights)