Making ROI with 3dCalc, will only output zeros?

Hello All,

I’m trying to make a square ROI using the 3dCalc command, but I’m finding that it sometimes will only output a file with all zeros. I’m really not sure why it does this? I checked to make sure that there is data where the ROI is, and there most definitely is. I’ve attached the output below. I’m kind of lost. Would appreciate any thoughts.


3dcalc -a T1_D1.nii -expr ‘within(x, -1.5+42.76, 1.5+42.76)*within(y,-1.5+20.84, 1.5+20.84)*within(z, -1.5+92.50, 1.5+92.50)’ -prefix ROI_F3
++ 3dcalc: AFNI version=AFNI_16.1.13 (May 4 2016) [64-bit]
++ Authored by: A cast of thousands
*+ WARNING: input ‘a’ is not used in the expression
++ Symbol x using predefined value
++ Symbol y using predefined value
++ Symbol z using predefined value
*+ WARNING: output sub-brick 0 is all zeros!
++ Output dataset ./ROI_F3+orig.BRIK

3dinfo ROI_F3+orig.
++ 3dinfo: AFNI version=AFNI_16.1.13 (May 4 2016) [64-bit]

Dataset File: ROI_F3+orig
Identifier Code: XYZ_op1Yc4JZWjH7Ujw-yaeH7A Creation Date: Mon May 8 12:14:15 2017
Template Space: ORIG
Dataset Type: Echo Planar (-epan)
Byte Order: LSB_FIRST [this CPU native = LSB_FIRST]
Storage Mode: BRIK
Storage Space: 21,233,664 (21 million [mega]) bytes
Geometry String: “MATRIX(0,0,1,-100.6284,1,0,0,-132.9748,0,-1,0,138.7812):216,256,192”
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Anterior-to-Posterior
second (y) = Superior-to-Inferior
third (z) = Right-to-Left [-orient ASR]
R-to-L extent: -100.628 [R] -to- 90.372 [L] -step- 1.000 mm [192 voxels]
A-to-P extent: -132.975 [A] -to- 82.025 [P] -step- 1.000 mm [216 voxels]
I-to-S extent: -116.219 [I] -to- 138.781 [S] -step- 1.000 mm [256 voxels]
Number of values stored at each pixel = 1
– At sub-brick #0#0’ datum type is short: 0 to 0


Note that your data is ASR, so x is A-P, y is I-S
and z is L-R. So 92.5 (+/- 1.5) is outside the
range of z, and there is nothing in the result.

If the limits are currently meaning RAI/LPI, then
switch the order to ASR, i.e. the center might be
at (20.84, 92.5, 1.5).

  • rick

Also consider enforcing an order like RAI or SPM instead of the dataset’s storage order. From 3dcalc’s help:

NOTE WELL: By default, the coordinate order of (x,y,z) is the order in
********* which the data array is stored on disk; this order is output
by 3dinfo. The options below control can change this order:

-dicom }= Sets the coordinates to appear in DICOM standard (RAI) order,
-RAI }= (the AFNI standard), so that -x=Right, -y=Anterior , -z=Inferior,
+x=Left , +y=Posterior, +z=Superior.

-SPM }= Sets the coordinates to appear in SPM (LPI) order,
-LPI }= so that -x=Left , -y=Posterior, -z=Inferior,
+x=Right, +y=Anterior , +z=Superior.

Let me give those a try. Thanks!