Hi Donna,Usually, I also use SPM for resampling my images. When I resampled the 3D_resliced.nii image with SPM, the histogram showed the same spiking as the original image (3D_original.nii). Only when I resliced the image with Caret, the histogram got smooth. I don't know exactly why...
To test the effects of the histogram bin on the final histogram distribution, I wrote a small matlab program (see attachment). As you can see, depending on the bin size, we can have a spiky histogram (top) or a smooth histogram (bottom). Both histograms were calculated from the same 3D_resliced.nii image. The spikes occur at bin intervals that encloses two successive integer intensity values. In my understanding, those spikes should happen whenever we have a discrete data set and non-integer bin size. What do you think?
Thanks, Mateus Donna Dierker wrote:
Hi Mateus, See inline replies below. On 11/14/2006 09:45 AM, Mateus Joffily wrote:Hi Donna,Thanks for your help. I am sending you two histograms of 3D_resliced.nii: (1) histogram_resliced_1.jpg is the same histogram you already sent to me; (2) histogram_resliced_2.jpg is the histogram of 3D_resliced.nii after resampling at 1x1x1mm with Caret.We can see that the spikes disapear in (2). It looks like much closer to the histograms described in your 'Peak Tweaking' document. As I don't have much experience with image segmentation, I was wondering if there was any problem with my images. I am glad to know that they look fine for you.Try segmenting both inputs using Caret and compare the results. You don't have to patch the resulting hemispheres to get a good feel for the quality; just looking at the fiducial surfaces and segmentations is generally adequate for judging which input is better, and if the differences matter. An unacceptably blurred structural MRI will have a smooth histogram, but probably won't produce a good segmentation. In both histograms, I could detect peaks, so there's probably adequate GM/WM contrast to get a good segmentation.May be the problem is the one pointed by Simon. If this is the case, adjusting the histogram bins could minimize the effect. Do we have control over the histogram bins with Caret interface?It doesn't look like it; the only inputs are the voxdims. To be honest, I rarely use Caret to resample my volumes. I usually do this as part of a preprocessing protocol using AFNI, FSL, or SPM utilities. They allow one to specify interpolation mode, etc. (At wustl.edu, this is done when the volume is written to 711-2B space using Avi Snyder's imgreg and related utilities.)Thanks, Mateus Dierker wrote:Hi Mateus,I can't address your original problem with the NIfTI orientation/rotation, but I did have a look at your volumes, and this statement confuses me:The histogram of my images (3D_original.nii and 3D_resliced.nii) shows several noisy sharp peaks.The attached captures show the histograms of 3D_original.nii (histogram_orig.jpg) and 3D_resliced.nii (histogram_resliced.jpg). The original has smoother looking peaks, but both have discernible gray and white matter peaks. Neither look particularly bothersome.Could you be more clear about what concerns you? On 11/13/2006 05:43 AM, Mateus Joffily wrote:John,May I profit from the fact that I have already uploaded my images to ask you one more question about them? The histogram of my images (3D_original.nii and 3D_resliced.nii) shows several noisy sharp peaks. Do you know what do they mean? I know that, if I reslice the 3D_resliced.nii to 1x1x1mm voxels size with Caret, they disappear. Thanks.Mateus John Harwell wrote:Hi Mateus,Can you upload the nifti volume that is not displayed correctly in Caret at "http://pulvinar.wustl.edu/cgi-bin/upload.cgi". Also, can you capture and upload an image of the volume displayed correctly in SPM5 so that I know how it should appear.After uploading the files, please email me the names of the files. It may be a few days before I can look into this problem.---------------------------------------------------------- John Harwell [EMAIL PROTECTED] 314-362-3467 Department of Anatomy and Neurobiology Washington University School of Medicine 660 S. Euclid Ave. Box 8108 St. Louis, MO 63110 USA On Nov 10, 2006, at 9:42 AM, Mateus Joffily wrote:Hi,I am having some trouble to load nifti images with caret5. The problem is the following:1) When I try to load an image that has a rotation specified in the header, Caret seems not to apply it properly. The displayed image shows a strange orientation and the voxels size is wrong.2) However, when the same image is resliced and no rotation is specified in its header, Caret displays the image correctly, the voxels size are correct and the image origin is also correctly located.Those same images, (1) and (2), are both correctly displayed with SPM5.The images extension is .nii, so I don't think this should be a problem related to image format interpretation (like interpreting nifti images as analyze and ignoring part of the header information).Does anyone else has experienced this problem? Thanks for your help.Mateus _______________________________________________ caret-users mailing list caret-users@brainvis.wustl.edu http://pulvinar.wustl.edu/mailman/listinfo/caret-users_______________________________________________ caret-users mailing list caret-users@brainvis.wustl.edu http://pulvinar.wustl.edu/mailman/listinfo/caret-users_______________________________________________ caret-users mailing list caret-users@brainvis.wustl.edu http://pulvinar.wustl.edu/mailman/listinfo/caret-users------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------_______________________________________________ caret-users mailing list caret-users@brainvis.wustl.edu http://pulvinar.wustl.edu/mailman/listinfo/caret-users------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------------------------------------------------------------ _______________________________________________ caret-users mailing list caret-users@brainvis.wustl.edu http://pulvinar.wustl.edu/mailman/listinfo/caret-users
<<inline: histograms.jpg>>
function histogram % Select volume %-------------------------------------------------------------------------- PP = spm_select(1,'image','Select volume'); V = spm_vol(PP); Y = spm_read_vols(V); X = reshape(Y,1,prod(size(Y))); % calculate voxel size %-------------------------------------------------------------------------- % vox=spm_imatrix(V.mat); % vox=abs(vox(7:9)); % Calculate histogram %-------------------------------------------------------------------------- % Method 1 - fixed number of bins % n = prod(vox); % voxel size (mm^3) n = 1; % fix voxel size to 1mm^3 Nbin1 = 256/n; % number of bins [hh1 xx1] = hist(X,Nbin1); Sbin1 = xx1(2)-xx1(1); % bin size % Method 2 - fixed bin edges Sbin2 = 1; % bin size edges=[0:Sbin2:max(X)+Sbin2]; % bin edges hh2 = histc(X,edges); xx2=edges+Sbin2/2; % position of the bin centers Nbin2 = length(xx2); % number of bins % Plot histogram %-------------------------------------------------------------------------- figure('Color', 'w'); subplot(2,1,1) area(xx1, hh1); title(sprintf('Method 1: number of bins = %d , bin size = %0.02f', ... Nbin1, Sbin1)); subplot(2,1,2) area(xx2, hh2); title(sprintf('Method 2: number of bins = %d , bin size = %0.02f', ... Nbin2, Sbin2)); linkaxes;