Hey,
Given a integer valued data set (e.g., a mask), what’s the most straightforward way to get a list of the unique values in the data set?
Regards,
Colm.
Hey,
Given a integer valued data set (e.g., a mask), what’s the most straightforward way to get a list of the unique values in the data set?
Regards,
Colm.
Howzabout this elegant combination of AFNI and shell commands:
3dROIstats -quiet -mask DSET_INT DSET_INT | tr '\t' '\n' | awk '{print int($1)}'
… which, in turn, get the mean value of each ROI region (which produces a line of floating point values of the ROI integers); which gets turned into a vertical column of those floating point values; when then get integerized?
–pt
You can also get a list of the unique output values in a table
3dRank -prefix testrank -input myatlas_or_roi_dset.nii.gz
or
3dmerge -1rank -prefix testrankmerge myatlas_or_roi_dset.nii.gz
cat testrank.rankmap.1D
#Rank Map (361 unique values)
#Col. 0: Rank
#Col. 1: Input Dset Value
0 0
1 1
2 2
3 3
4 4
…
360 1180
You can also loop in a script across individual values in the range from min to max and count the number of voxels with 3dBrickStat.
Thanks! I figured there’d be more than one one way to do this in the Swiss army knife that is AFNI!
The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.
Freedom of Information Act |
HHS Vulnerability Disclosure
National Institute of Mental
Health | National Institutes of Health | U.S.
Department of Health and Human Services |