Ah, OK.
So indeed avwmaths does not just read the array, typecast all the
numbers in the array, and write it out. My software (which completely
ignores scale_factor, as well as some other things) was more or less
relying on that :).
Segmented images (where the voxel values are cluster indices) should
have scale_factor 1, I guess. I'll just add this into my segmentIm program.
Cheers guys,
Alle Meije
Steve Smith wrote:
> Indeed - also, there may be an issue with your version of FSLView not
> starting with a correct intensity display range, you might try changing
> that by hand - the next version will solve that.
>
> Cheers.
>
>
> On 26 May 2007, at 16:37, Ged Ridgway wrote:
>
>> Hi,
>>
>> Isn't this just the standard NIfTI intensity mapping using "scl_slope"
>> of 0.00326 (and scl_inter, which I assume here is 0)?
>>
>> avwhd spm5/templates/EPI.nii | grep -E 'data_type|scl'
>> data_type UINT8
>> scl_slope 0.003260
>> scl_inter 0.000000
>>
>> E.g. using Matlab/SPM5:
>>
>> V = spm_vol(fullfile(spm('Dir'),'templates','EPI.nii'))
>> img = spm_read_vols(V);
>> max(img(:))
>> fid = fopen(V.fname);
>> dat = fread(fid, inf, 'uint8');
>> max(dat)
>> max(dat)*V.pinfo(1)
>>
>> shows the behaviour I'd expect. max(dat) is 255, but the image
>> intensities read in via spm_read_vols (and presumably FSL?) are scaled
>> by scl_slope. This is helpful with e.g. spm5/tpm/grey.nii where the
>> scaling allows meaningful 0-to-1 probabilities to be stored as UINT8.
>>
>> By copying all the header information, including scl_slope, your
>> binary 1 maps to 1*scl_slope or 0.003260.
>>
>> avwmaths is then casting this to zero, instead of setting an
>> appropriate scl_slope on the output volume. I'm not sure if this is a
>> bug or a feature... Though I believe SPM5 usually recomputes scl_slope
>> for the output volume so that the raw data can be efficiently stored
>> in the chosen data-type, while the intensities remain the same.
>>
>> In any case, feature or bug, if you make scl_slope 1 in your binary
>> mask header, all should be well. E.g. use avwedithd.
>>
>> HTH,
>> Ged
|