No idea why. What is the difference in the headers? Can you post the terminal output of both your mri_vol2surf commands? Also, you can try using MRIread.m and MRIwrite.m (these use load_nifti and save_nifti under the hood but also do some things to the header).
doug On 11/20/2013 08:46 AM, Leila Reddy wrote: > Hi, > > I am trying to save a nifti file using save_nifti. I'm running into a > strange problem that I describe below. > > I have a nifti file (subj_mask.nii) created by a colleague using > Nibabel (http://nipy.sourceforge.net/nibabel/). This volume is in the > MNI305 space. > > Step1: In a first step I wanted to convert this volume to the > fsaverage surface format. To do that I used : > > mri_vol2surf --src subj_mask.nii --hemi rh --out_type mgh --float2int > round --o blah9-rh.mgh --projfrac 0.5 --trgsubject fsaverage > --regheader fsaverage. > > I load it in tksurfer and when I do view-> configure->overlay, I see a > range of values (as expected) and am able to set the min and max > thresholds as I want. > > Step 2: In a second step I loaded this nifti file into matlab using > load_nifti and had to alter the volume a little bit as below: > hdr=load_nifti('subj_mask.nii'); > vol=hdr.vol; > vol(find(vol<4))=0; > hdr.vol=vol; > save_nifti(hdr,'new_mask.nii'). > > I convert the volume to fsaverage surface space as before but when I > view it in tksurfer I am not able to set a min and max threshold with > configure->overlay. Instead, there is no distribution of values > plotted in the configure overlay window and I get the following error > message: % ERROR updating histo: impossible limits (min 0.55556 >= max > 0.55556) for axis "x" > > I finally managed to solve this problem by loading the header > information from a FS-FAST created nifti: > > hdr_fsfast = load_nifti('bold/analysis.mni/mask.nii.gz'); > hdr_fsfast.vol=vol; > save_nifti(hdr_fsfast,'new_mask.nii'). > > Now I am able to see the distribution of values in the configure > overlay window and am able to set the thresholds. > > The headers for FS-FAST and Nibabel generated niftis are indeed > slightly different but why do I not have the problem in step 1 when I > use the Nibabel file, but only in step 2 after I use save_nifti with > the Nibabel header ? > > I use the load_nifti and save_nifti commands very often (and haven't > had problems before because I was only using FS-FAST generated files) > so I would really appreciate it if someone could point out what is > going on so that I understand what to do in future. > > Thanks, > Leila > > > > > _______________________________________________ > Freesurfer mailing list > [email protected] > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Douglas N. Greve, Ph.D. MGH-NMR Center [email protected] Phone Number: 617-724-2358 Fax: 617-726-7422 Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 www.nmr.mgh.harvard.edu/facility/filedrop/index.html Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ _______________________________________________ Freesurfer mailing list [email protected] https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
