Exemple #1
0
    def predicted_signal(self, bvecs, bvals, axial_diffusivity,
                         radial_diffusivity):
        """
        Compute the fiber contribution to the *relative signal* along its
        coords.
        
        Notes
        -----
        
        The calculation is based on a simplified Stejskal/Tanner equation:

        .. math::

           \frac{S/S_0} = exp^{-bval (\vec{b}*Q*\vec{b}^T)}
           
        Where $S0$ is the unweighted signal and $\vec{b} * Q * \vec{b}^t$ is
        the ADC for each tensor.

        To get the diffusion signal measured, you will have to multiply back by
        the $S_0$ in each voxel.
        
        Parameters
        ----------
        """
        # Gotta have those tensors:
        tens = self.tensors(axial_diffusivity, radial_diffusivity)

        # Preallocate:
        sig = np.empty((tens.shape[0], len(bvals)))
        for t_idx, ten in enumerate(tens):
            ADC = ozt.apparent_diffusion_coef(bvecs, ten.reshape((3, 3)))
            # Call S/T with the ADC as input:
            sig[t_idx] = ozt.stejskal_tanner(1, bvals, ADC)

        return sig
Exemple #2
0
    def model_adc(self):
        out = np.empty(self.signal.shape)
        tensors_flat = self.tensors[self.mask].reshape((-1, 3, 3))
        adc_flat = np.empty(self.signal[self.mask].shape)

        for ii in xrange(len(adc_flat)):
            adc_flat[ii] = ozt.apparent_diffusion_coef(
                self.bvecs[:, self.b_idx], tensors_flat[ii])

        out[self.mask] = adc_flat
        return out
Exemple #3
0
    def model_adc(self):
        out = np.empty(self.signal.shape)
        tensors_flat = self.tensors[self.mask].reshape((-1,3,3))
        adc_flat = np.empty(self.signal[self.mask].shape)

        for ii in xrange(len(adc_flat)):
            adc_flat[ii] = ozt.apparent_diffusion_coef(
                                        self.bvecs[:,self.b_idx],
                                        tensors_flat[ii])

        out[self.mask] = adc_flat
        return out
Exemple #4
0
    def predict_adc(self, sphere):
        """

        The ADC predicted on a sphere (containing points other than the bvecs)
        
        """
        out = ozu.nans(self.signal.shape[:3] + (sphere.shape[-1], ))
        tensors_flat = self.tensors[self.mask].reshape((-1, 3, 3))
        pred_adc_flat = np.empty((np.sum(self.mask), sphere.shape[-1]))

        for ii in xrange(len(pred_adc_flat)):
            pred_adc_flat[ii] = ozt.apparent_diffusion_coef(
                sphere, tensors_flat[ii])

        out[self.mask] = pred_adc_flat

        return out
Exemple #5
0
    def predict_adc(self, sphere):
        """

        The ADC predicted on a sphere (containing points other than the bvecs)
        
        """
        out = ozu.nans(self.signal.shape[:3] + (sphere.shape[-1],))
        tensors_flat = self.tensors[self.mask].reshape((-1,3,3))
        pred_adc_flat = np.empty((np.sum(self.mask), sphere.shape[-1]))

        for ii in xrange(len(pred_adc_flat)):
            pred_adc_flat[ii] = ozt.apparent_diffusion_coef(sphere,
                                                       tensors_flat[ii])

        out[self.mask] = pred_adc_flat

        return out
Exemple #6
0
    def predicted_signal(self,
                         bvecs,
                         bvals,
                         axial_diffusivity,
                         radial_diffusivity):
        """
        Compute the fiber contribution to the *relative signal* along its
        coords.
        
        Notes
        -----
        
        The calculation is based on a simplified Stejskal/Tanner equation:

        .. math::

           \frac{S/S_0} = exp^{-bval (\vec{b}*Q*\vec{b}^T)}
           
        Where $S0$ is the unweighted signal and $\vec{b} * Q * \vec{b}^t$ is
        the ADC for each tensor.

        To get the diffusion signal measured, you will have to multiply back by
        the $S_0$ in each voxel.
        
        Parameters
        ----------
        """
        # Gotta have those tensors: 
        tens = self.tensors(axial_diffusivity,
                            radial_diffusivity)

        # Preallocate: 
        sig = np.empty((tens.shape[0], len(bvals)))
        for t_idx, ten in enumerate(tens): 
            ADC = ozt.apparent_diffusion_coef(bvecs, ten.reshape((3,3)))
            # Call S/T with the ADC as input:
            sig[t_idx] = ozt.stejskal_tanner(1, bvals, ADC) 

        return sig