currently, we have methods to save brain objects and model objects (e.g. bo.save('filename')). To save nifti files, the current API is: nii = bo.to_nii('filename') where nii is a nibabel nifti object in memory, and if a filename is passed, it is also saved to disk.
Another possible (or complementary) approach would be to have a separate se.save function (@jeremymanning proposed):
nifti1 = se.save(bo2, 'nifti1.nii') <-- convert bo2 to a nifti image, save to disk, and return a nifti object
nift2 = se.save(bo2, 'nifti2.nii', template='template.nii') <-- convert bo2 to a nifti image using the specified template, save to disk, and return the nifti ojbect
bo2_copy = se.save(bo2, 'bo2.bo') <-- save bo2 to disk and return a copy of itself
bo3 = se.save(bo2, 'bo3.bo', template='template.nii')` <-- convert bo2 into the coordinates specified by template.nii and save to disk; return the new brain object
currently, we have methods to save brain objects and model objects (e.g.
bo.save('filename')). To save nifti files, the current API is:nii = bo.to_nii('filename')whereniiis a nibabel nifti object in memory, and if a filename is passed, it is also saved to disk.Another possible (or complementary) approach would be to have a separate
se.savefunction (@jeremymanning proposed):nifti1 = se.save(bo2, 'nifti1.nii') <-- convert bo2 to a nifti image, save to disk, and return a nifti object
nift2 = se.save(bo2, 'nifti2.nii', template='template.nii') <-- convert bo2 to a nifti image using the specified template, save to disk, and return the nifti ojbect
bo2_copy = se.save(bo2, 'bo2.bo') <-- save bo2 to disk and return a copy of itself
bo3 = se.save(bo2, 'bo3.bo', template='template.nii')` <-- convert bo2 into the coordinates specified by template.nii and save to disk; return the new brain object