def test_register_dwi(): fdata, fbval, fbvec = dpd.get_fnames('small_64D') with nbtmp.InTemporaryDirectory() as tmpdir: # Use an abbreviated data-set: img = nib.load(fdata) data = img.get_fdata()[..., :10] nib.save(nib.Nifti1Image(data, img.affine), op.join(tmpdir, 'data.nii.gz')) # Save a subset: bvals = np.loadtxt(fbval) bvecs = np.loadtxt(fbvec) np.savetxt(op.join(tmpdir, 'bvals.txt'), bvals[:10]) np.savetxt(op.join(tmpdir, 'bvecs.txt'), bvecs[:10]) reg_file = register_dwi(op.join(tmpdir, 'data.nii.gz'), op.join(tmpdir, 'bvals.txt'), op.join(tmpdir, 'bvecs.txt')) npt.assert_(op.exists(reg_file))
def test_register_dwi(): fdata, fbval, fbvec = dpd.get_data('small_64D') with nbtmp.InTemporaryDirectory() as tmpdir: # Use an abbreviated data-set: img = nib.load(fdata) data = img.get_data()[..., :10] nib.save(nib.Nifti1Image(data, img.affine), op.join(tmpdir, 'data.nii.gz')) # Convert from npy to txt: bvals = np.load(fbval) bvecs = np.load(fbvec) np.savetxt(op.join(tmpdir, 'bvals.txt'), bvals[:10]) np.savetxt(op.join(tmpdir, 'bvecs.txt'), bvecs[:10]) reg_file = register_dwi(op.join(tmpdir, 'data.nii.gz'), op.join(tmpdir, 'bvals.txt'), op.join(tmpdir, 'bvecs.txt')) npt.assert_(op.exists(reg_file))