3dRankizer- strange behavior?

Afni gurus:

I’m trying to identify the n voxels with the highest t values for a particular contrast. I know 3dRank and the -1rank option in 3dmerge only work on integers, but 3dRankizer doesn’t appear to have that restriction, so that’s what I decided to try. It says it only works on sub-brik #0 so I created a dataset containing only the sub-brik with those t values in it (subj.tvals+orig). I’m using the following command:

3dRankizer -mask brainmask+orig -prefix rankedTs subj.tvals+orig

The program runs and tells me there are ~55000 voxels in brainmask+orig. So I expected to get an output dataset that contains voxel values ranging from 1 to 55000 and then I could just pick off the top n (100, 1000, etc) using 3dcalc. Instead, I get a dataset where the vast majority of the ~55000 voxels have large negative values (-149490, -179121, etc), with only about 250 positive voxels. These 250 positive voxels do actually seem to correspond to the top 250 t-values and have the voxel values I’d expect (55000, 54999, 54998, etc) but I don’t understand why that doesn’t continue all the way down the ranks.

It’s not the case that there are only 250 positive t values in my dataset (at least 75% are positive.) I wondered if perhaps it wasn’t able to handle such a large mask/number of voxels so I tried a different mask with only about 1100 voxels in it and got essentially (but not identically) the same result- about 200 voxels with voxel values in the 900-1100 range and about 900 voxels with large (> 100000) negative values.

I’m a bit baffled. Is there something I’m obviously overlooking or doing wrong? Alternately, is there a different approach I could take to identify the highest n voxels in a dataset? (I do need it to be a certain number of voxels and not a certain percentage of voxels.)

Thanks!
Kate Revill

I haven’t looked at this program, but there are a couple approaches here:

https://afni.nimh.nih.gov/afni/community/board/read.php?1,154669,154671#msg-154671

and here:

https://afni.nimh.nih.gov/afni/community/board/read.php?1,77586,77717#msg-77717

Hi Daniel,

I hope all is well. I was overjoyed to find the handy 3dRankizer only to be saddened by the appearance of negative numbers in the output, much like what happened with Kate in the initial post.

I think this is most likely a type casting problem, my float dataset is high res...

I really need this program to work, the alternate suggestions you made do not cut it for me. Would you please revisit this issue?

All the best,
Ziad

Salut!

As a quick check, does

3dROIMaker -only_some_top ...

do the trick? Or the same program with -only_conn_top ..?

     -only_some_top N :after '-volthr' but before any ref-matching or
                       inflating, one can restrict each found region
                       to keep only N voxels with the highest inset values.
                       (If an ROI has <N voxels, then all would be kept.)
                       This option can result in unconnected pieces.
     -only_conn_top N :similar-ish to preceding option, but instead of just
                       selecting only N max voxels, do the following
                       algorithm: start the ROI with the peak voxel; search
                       the ROI's neighbors for the highest value; add that
                       voxel to the ROI; continue until either the ROI has 
                       reached N voxels or whole region has been  added.
                       The returned ROI is contiguous and 'locally' maximal
                       but not necessarily globally so within the original
                       volume.

--pt

Hi Ziad,

To be specific, do you mean that a single volume has more than 2^31-1 voxels? Indeed, that looks beyond what the function was written to handle.

Thanks,

  • rick

I'd forgotten about this program entirely. However, I just tested it with a mask of size 2329124 voxels, and it seems to work correctly. I'll have to take a look at it. How many voxels in the dataset volume and how many in the mask?

  • Zhark the Sorter

3dRankizer did have a bug with the -mask option, due to the machinations of that dastardly Zhark. However, I have intervened to fix the error.

Someday, perhaps, maybe, the AFNI binaries will reflect this fix.
(signed) The Once and Future Bob

1 Like