I created a preprocessing script for my images using afni_proc.py. I noticed that the anatomical images became extremely bright (the brain is essentially white) after align_epi_anat. I was able to isolate 3dSkullStrip as the issue. The input image I provide appears normal, but after running just the skull stripping, the output is bright. I didn't see any parameters that explicitly change the intensity values or thresholding, but I still played around with the inputs and nothing resolved the image. I was able to work around the issue by saving the mask and using 3dcalc to multiply it by the original, but I'd appreciate help with trying to fix the underlying issue!
3dSkullStrip -orig_vol -input file_name -prefix new_file_name
If open up the afni GUI, and overlay the skullstripped version on the underlay, and click around, are the voxel values the same (you can see the voxelwise values at the crosshair location in the lower right of the GUI)? Sometimes datasets appear bright or to have different values just because the percentile ranges differ. With
-orig_vol, the original values should still be present.
No, the ULay values range from around 60,000-90,000 while the OLay values are about 3,000
OK, thanks for sharing the dataset. The issue is: It is a short-valued dataset, but there is a big scaling factor applied that blows up the values way above the float maximum (which is 32,767).
You can see the scale factor with:
nifti_tool -disp_hdr -field scl_slope -infiles ./DSET.nii
N-1 header file './DSET.nii', num_fields = 1
name offset nvals values
------------------- ------ ----- ------
scl_slope 112 1 162.468399
or the ratio of:
3dinfo -dmax -dmaxus DSET
The problem is that the output from 3dSkullstrip is not scaled, but it is still short type, so its values get saturated at 32,767, which is why it appears uniformly bright.
So, a couple things that can be done:
you could make that dset a float, so the output of 3dSkullStrip will be a float, and keep all those values; to do so, run:
-a DSET_IN -expr 'a' \
-prefix DSET_OUT \
-datum float -n
convert it to short, which you could do by dividing by the scale factor and making a short output:
-a DSET_IN -expr 'a/162.468399' \
-prefix DSET_OUT \
-datum short -n
I think the latter would be preferable---no reason to create a float valued dset, where there isn't any actual information gained from it.
In either case, visually the output is virtually indistinguishable from the input.