Issues with 3dUndump

I dumped some beta values from an imaging file using a mask (GM_mask, N=202893 voxels) and ran them through a permutation program. I am now trying to plot some of the permuted beta values back on the brain to do some trouble shooting with 3dUndump but it doesn’t appear to be working as expected.

When I use the command below I get a ton of warnings stating some of my y coordinates are outside a particular range, leading it to only fill 198172 of the 202893 voxels. I don’t understand how this could be the case since my coordinates came from my “master” dataset. Also when I try to open the resulting file, the image is blank. I’ve also tried adding voxels not in the mask to the text file with the betas I want to plot, but had the same issues with warnings of coordinates falling out of range and filling only 753571 of the 902629.

3dUndump -master …/GM_mask.nii.gz -xyz -prefix SZ_perm1 SZ_perm1_undump.txt

I’ve also tried using the original beta image as the -master, and using the original beta image as the -master and the GM_mask in the -mask option but I’m still experiencing the same issues.

Any help is appreciated,


Can you please be more explicit about your commands to dump the values (as well as the one about undumping)?

And what is the program doing the permutation? Is it leaving the data in a text file format, or is it making some kind of volumetric thing? What is that using for I/O?

Also, what is the output for the following:

# A: info about initial dset
3dinfo -obliquity -orient -o3 -n4 -prefix DSET_TO_BE_DUMPED


The xyz order and direction of the input coordinates should match the master dataset for 3dUndump. Either make the coordinates match or create a new resampled master dataset in the same orientation as the coordinates.

To answer ptaylor, the beta text file I am trying to Undump is simply a space delimited .txt file with the x y z coordinates in the first three columns and the beta in the fourth like below
-90 126 -72 1.346309717928097140e-03
-88 126 -72 9.674140720261500091e-04
-86 126 -72 6.497048896877241804e-04
-84 126 -72 3.503492632751341318e-04
-82 126 -72 -3.437759569162332583e-04

The x,y,z values in the first three columns were taken directly from the master dataset (GM_mask.nii) via 3dmaskdump -noijk -xyz -o wholebrainvox.txt GM_mask.nii

The 3dinfo for that same dataset is:
0.000 RPI -90.000000 126.000000 -72.000000 91 109 91 1 GM_mask.nii

I have ensured that all coordinates present in wholebrainvox.txt are present in my beta.txt file and that they are in the same order and I’m still getting a message saying it has only filled 753571 of the 902629 voxels with the following command:
3dUndump -master …/GM_mask.nii -xyz -prefix undumped.nii beta.txt

or if I use the additional mask option it only fills 198172 of the 202893 voxels:
3dUndump -master …/GM_mask.nii -mask …/GM_mask.nii -xyz -prefix undumped.nii beta.txt

I was able to get my beta values to at least partially show up on the brain (Image attached-I needed to include the -datum float flag), but there are parts of the brain that are clearly missing, I presume because it’s failing to plot all the voxels.

Another conundrum is that one of the warnings says:
File beta.txt line 894348: y coord=-92 is outside -91.002 … 127.002 BUT when I look at line 894348 the line reads “88 92 108 0” so I’m not sure why it is introducing a negative sign when it isn’t there.


3dmaskdump always outputs coordinates in RAI order. 3dUndump uses the xyz storage order with the -master option. The simplest solution to match the coordinates to the storage orientation might be to make a new RAI storage order master.

3dresample -prefix GM_mask_RAI.nii.gz -orient RAI -input GM_mask.nii
3dUndump -master GM_mask_RAI.nii.gz -mask GM_mask_RAI.nii.gz -xyz -prefix undumped.nii.gz beta.txt

Thanks Daniel!
That solved the problem. Although for others reading this thread, I believe you meant to use the -prefix instead of -master in the 3dresample command as orient and master can’t be used in the same command, correct?

Thanks again!

That’s right. Thanks.