Exemple #1
0
def test_coefficient_of_determination():
    """
    Test the computation of coefficient of determination
    """
    cod = ozm.coeff_of_determination(TM1, TM2)

    # Test for regressions:
    npt.assert_almost_equal(cod,
    np.array([[[ -3.44661890e+00,  -9.56966221e-01,  -2.95984527e-01,
          -2.14809778e-01],
        [ -1.13823857e+00,  -1.47624354e+00,  -2.49836988e-01,
           4.45058522e-01]],

       [[ -2.12348903e+00,  -1.03695127e+00,   3.43880861e-03,
          -5.08955429e-01],
        [ -2.70970026e+00,  -8.62731412e-01,   3.21255708e-01,
           1.52058544e-01]],

       [[ -1.54499435e+00,  -1.12129147e+00,  -1.34573166e+00,
          -5.70547139e-01],
        [ -1.31661328e+00,  -1.31546355e-02,  -9.43582307e-03,
          -4.12026495e-01]]]))
                    help='Bvals file (FSL format)')

parser.add_argument('out_file', action='store', metavar='File',
                    help='Output file name (.nii.gz)')

parser.add_argument('--mask_file', action='store', metavar='File',
                    help='Mask file (only the voxels within the binary mask will be analyzed (.nii.gz; default: analyze all) ',
                    default=None)

params = parser.parse_args()


if __name__ == "__main__":
     
    Model1 = dti.TensorModel(params.dwi_file1,
                                         params.bvecs_file1,
                                         params.bvals_file1,
                                         mask=params.mask_file,
                                         params_file='temp')

    Model2 = dti.TensorModel(params.dwi_file2,
                                         params.bvecs_file2,
                                         params.bvals_file2,
                                         mask=params.mask_file,
                                         params_file='temp')
    
    # Do it and save: 
    nib.Nifti1Image(ana.coeff_of_determination(Model1, Model2),
                    Model1.affine).to_filename(params.out_file)

Exemple #3
0
                    metavar='File',
                    help='Output file name (.nii.gz)')

parser.add_argument(
    '--mask_file',
    action='store',
    metavar='File',
    help=
    'Mask file (only the voxels within the binary mask will be analyzed (.nii.gz; default: analyze all) ',
    default=None)

params = parser.parse_args()

if __name__ == "__main__":

    Model1 = dti.TensorModel(params.dwi_file1,
                             params.bvecs_file1,
                             params.bvals_file1,
                             mask=params.mask_file,
                             params_file='temp')

    Model2 = dti.TensorModel(params.dwi_file2,
                             params.bvecs_file2,
                             params.bvals_file2,
                             mask=params.mask_file,
                             params_file='temp')

    # Do it and save:
    nib.Nifti1Image(ana.coeff_of_determination(Model1, Model2),
                    Model1.affine).to_filename(params.out_file)