有時(shí)候用 spm12的Display選項(xiàng)打開nifti之后發(fā)現(xiàn)nifti數(shù)據(jù)文件的數(shù)據(jù)類型是不一樣的,比如int16和float32,會(huì)心生疑惑,兩種數(shù)據(jù)類型對(duì)數(shù)據(jù)分析有影響嗎?
事實(shí)上子刮,nifti文件的大小就但等于dimensions乘以數(shù)據(jù)類型的長(zhǎng)度,比如下圖中數(shù)據(jù)大小應(yīng)該是646433*16=2162688位窑睁,換算成Kb應(yīng)該是2162688/1024/8=264Kb,那我們?cè)賮?lái)看一下這個(gè)nifti文件的大小呢挺峡?如圖所示,確實(shí)是265Kb担钮。
至于nifti的int16與32float有什么區(qū)別橱赠,我覺得下面的這個(gè)回答還算滿意(原文鏈接:https://afni.nimh.nih.gov/afni/community/board/read.php?1,137005,137007):
giuseppe pagnoni Wrote:
I have noticed that when copying NIFTI data (from
a Philips scanner) with 3dcopy, an automatic
conversion from INT16 to FLOAT32 seems to be
taking place [...]
But why is that
happening? Is there a way to keep the original
format? If the data are originally INT16, it
seems to me that you waste a lot of disk space and
computing time by doubling the size of the data
right away.
In my understanding int16 was used in AFNI in the old days, when disk space was expensive. Nowadays disk space is quite cheap, so it's not too much of an issue.
When using int16, data is stored together with a min value p and max value q; each value v is then stored as an int16 i with v=p + s*i, where s=(q-p)/(2^16-1) is the step size. When having a few outliers (extreme values) q-p is large so the step size s is large too. This reduces the resolution for the rest of the data (which is usually the data of interest). In addition, every processing step usually involves some averaging of existing values that have to be converted back to an int16, which again impoverishes the data (even if during computations the data is stored internally as float32).
Float32 does not have this disadvantage as it holds an exponent, allowing for a large range of data and yet good numerical precision.
Therefore float32 is currently considered as the preferred option by most.
Also note that you can enable compression which reduces file sizes considerably, and this compression works transparently in the AFNI programs. One way is to specify an extension for the output file (e.g. -prefix output.nii.gz to store in nifti and gzip the output). Another approach is to set the environmental variable AFNI_COMPRESSOR to BZIP2 or GZIP so that AFNI compresses the data automatically.
簡(jiǎn)單而言,就是如果你空間足夠箫津,還是用float32方便狭姨。
20190319