Print

Print


I'm not really sure.  I guess it depends on the max and min values in the
images, which would be used to determine the histogram binning.

Best regards,
-John

On 15 May 2014 15:09, Dorian P. <[log in to unmask]> wrote:

> Dr. Ashburner,
>
> I am trying to understand why the joint histogram starts at different
> positions on the X and Y axes. The X axis seem to have the majority of the
> voxels starting around bin 50 while the Y axis starts correctly at bin 1.
> Is there an explanation for this?
>
> Thank you.
>
>
> 2014-05-14 14:36 GMT-04:00 John Ashburner <[log in to unmask]>:
>
> Perhaps it's just in the display.  If I remember correctly, the
>> coregistration displays log(H+1), rather than H.
>>
>> Best regards,
>> -John
>>
>>
>>
>> On 14 May 2014 18:38, Dorian P. <[log in to unmask]> wrote:
>>
>>> Thank you Dr. Ashburner,
>>>
>>> I managed to get colored histogram following your advice (below an
>>> example). The result is a little different from what spm_hist2 produces,
>>> but I guess this has to do with differences in calculation algorithm.
>>>
>>> Thank you.
>>> Dorian
>>> TJU
>>>
>>> [image: Immagine in linea 1]
>>>
>>>
>>>
>>> 2014-05-13 16:02 GMT-04:00 John Ashburner <[log in to unmask]>:
>>>
>>> I won't help with all the coding, but I could give you a few pointers.
>>>>  You can read images by:
>>>>
>>>> P=spm_select(Inf,'nifti');
>>>> Nii=nifti(P);
>>>>
>>>> x=Nii(1).dat(:);
>>>> y=Nii(2).dat(:);
>>>>
>>>> If you can convert x and y into integer values, ranging from 1..Nx and
>>>> 1..Ny then you can use MATLAB's sparse function to create the joint
>>>> histogram (providing the images are the same size and are in alignment
>>>> voxel-for-voxel).
>>>>
>>>> H = full(sparse(x,y,1,Nx,Ny));
>>>>
>>>> If you have a mask (say a variable z) of ones and zeros, you can get
>>>> the values within the mask by
>>>>
>>>> xmask = x(logical(z));
>>>> ymask = y(logical(z));
>>>>
>>>> You can then generate a joint histogram from this subset of voxels.
>>>>
>>>> If you want to display something in colour, then you'll need to rescale
>>>> the histograms to have values between 0 and 1, and combine three such
>>>> images as rgb = cat(3,Hr,Hg,Hb), before using image(rgb).
>>>>
>>>> Best regards,
>>>> -John
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 13 May 2014 19:42, Dorian P. <[log in to unmask]> wrote:
>>>>
>>>>> Hi SPM list,
>>>>>
>>>>> I am trying to plot a joint histogram of two images where voxels
>>>>> within a mask (third file) are colored differently. The function
>>>>> spm_hist2.m seem to be compiled and therefore not editable.
>>>>>
>>>>> Anybody can help with how to change the colors of specific dots in a
>>>>> joint histogram?
>>>>>
>>>>> I am using SPM8 on Windows Matlab 2012b.
>>>>>
>>>>> Thank you.
>>>>> Dorian
>>>>> TJU
>>>>>
>>>>
>>>>
>>>
>>
>