3dClusterize on a .nii image without subbricks ?

Hello you all,

I was wondering if there was an equivalent of 3dClusterize that would work for .nii files that do not have multiple sub bricks and therefore don’t have an -idat and -ithr?


Hi, Lysianne-

You can make idat and ithr just both point to that [0]th volume:

3dClusterize -idat 0 -ithr 0 ...


but it says:
++ Looks like clustering is not being performed on a stat value; won’t worry about sidedness, then.
** FATAL ERROR: Thresholding volume does not appear to be a stat so you can’t use the ‘p=…’ internal conversion to stat

Even though my .nii is coming from a stat image

Hi Lysianne,

Does that NIFTI image have a proper intent_code?

nifti_tool -disp_hdr -field intent_code -infiles MY_IMAGE.nii

If it does not, and so 3dClusterize cannot convert form p to an appropriate threshold, you can always provide a raw threshold yourself.

  • rick

Hi, Lysianne-

Indeed, the “p= …” convenience comes about only from AFNI-program-produced stats, which stick the conversion information into the header.

What is the 3dClusterize command you are using, and where did the stats dataset come from?


the stats comes from APP, registered in Talairach space ,
then I use 3dAllineate to bring it back to native space, and keep only the t-stats from my contrast of interest in .nii format so I can use it with my neuronavigation software.

I was just being lazy and trying to find a way to extract the peak on my .nii file; I guess I can just switch the order of my steps and get the peak before converting to .nii

this command gives me: Intent_code offset: 68, nvals 1 and values 0

You could use p2dsetstat to get the desired threshold for volume AAA in the original DSET_WITH_INFO, for a given pvalue PVAL, say for a bisided stat:

p2dsetstat \
  -bisided  \
   -inset DSET_WITH_INFO"[AAA]" \
   -pval PVAL

… and then you could use that threshold value directly within your warped dset.


hmm ok let me try that !

oh ok that works well


1 Like

Cool, glad that sorted things.