To save/load the transformation object you can try using pickle instead of numpy:
filehandler = open('transform.obj', 'wb')
filehandler = open('transform.obj', 'rb')
final = pickle.load(filehandler)
Hi @drombas, thanks very much! pickle does the trick :)
I thought that np.save with "allow pickle" would work, assuming that it would do the same as pickle (it doesn't) or that using JSON would be possible -- unfortunately it isn't (I tried to do the nested serialisation but failed). The reason for that is that many people have reservations about pickle.
For me it does the job perfectly.
from dipy.align import write_mapping, read_mappingwe use the nifti format to save this
my_sphere = Sphere(xyz=gtab.bvecs[~gtab.b0s_mask])
voxel2streamlineto see which streamlines pass through which voxels. I feed in the streamlines and the inverse of the DWI affine to map from streamline to voxel. I am having trouble interpreting the output, as I do not know how to map voxel index to location. Any guidance would be appreciated, thanks!
Hi Everyone! We are very happy to announce that a new educational course is available online: https://youtube.com/playlist?list=PLRZ9VSqV-6soOC0rUEAOV-QiSa_Qxk8JM :rocket: This is a complete course on Diffusion MRI with Theory and Practice :snake: This is your chance to go from zero-to-hero in using :star: DIPY :star: Topics include -
:white_check_mark: dMRI Basics
:white_check_mark: Microstructure Modeling
:white_check_mark: Dictionary Learning
:white_check_mark: Advanced Multidimensional Diffusion Encodings
:white_check_mark: Tissue Classification
:white_check_mark: Deep Learning methodologies in MRI
:white_check_mark: High Field MRI
:white_check_mark: GPU Acceleration
:white_check_mark: Data Harmonization
:white_check_mark: ML in the Clinic and much more.....
Do not miss out on this golden opportunity! If you do like and use DIPY please do give us a star and cite the piece of software that you are using! It encourages us to keep going! May your data live a new life!!
data, affine, img = load_nifti(file2_path, return_img=True) bvals, bvecs = read_bvals_bvecs(fbval, fbvec) print(bvals) gtab = gradient_table(bvals, bvecs) print(gtab) tenmodel = TensorModel(gtab) print(len(bvals)) new_img = img.get_fdata() tenfit = tenmodel.fit(new_img)