I want to remove null (inactive) voxels from my analysis. I have an ROI mask. I want to restrict my analysis to the top 70% of active voxels within the mask. I have figured out how to use 3dBrickStat to get the numerical value of the 70th percentile of my data. However, I am stuck on how to mask by that. It looks like 3dmerge allows you to use a mask but not to specify a value (mrange) within that mask…
If there is a more efficient/straightforward way to accomplish this, that would be fine too.
Calling the value from 3dBrickStat that you want “M”, then how about with 3dcalc:
3dcalc -a FILE -b MASK -expr 'step(b)*ispositive(a-M)' -prefix OUTPUT
The first “step” restricts values to your masked region, and the ispositive() (which, funnily enough, behaves identically to step()), is used to only get values in the ‘a’ dset which are greater than M: (a > M) == (a - M > 0).
In your followup question: how do I restrict it to one value in the mask? My mask has multiple ROIs, but I only want to use one. Like how you can use “mrange” with 3dmaskave
… I don’t know what “it” is.
Your earlier question seems to be wanting to restrict a map to voxels: A) within a masked region and B) above a 70% threshold in the brain (or in that masked region, however you calculated it).
Are you asking how to select just one ROI out of a map of ROIs? Say, for example, that you have ROI #1 with all values 1, and ROI #2 with all values 2, etc.
In that case, if that magical ROI value were “R” you could try:
3dcalc -a FILE -b MASK'<R>' -expr 'step(b)*ispositive(a-M)' -prefix OUTPUT
or
3dcalc -a FILE -b MASK -expr 'equals(b,R)*ispositive(a-M)' -prefix OUTPUT
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.