# prolate spheroid?

Hi AFNI team-

how hard would it be to add options to 3dUndump to create a prolate spheroid instead of a regular sphere?
http://mathworld.wolfram.com/ProlateSpheroid.html
i’d imagine 2 new options would need specification (its semi-axes) as well as the main direction the semi-major axis would ‘point’?
just curious and thanks

-Sam

Here is an example of how to do this using that cartesian coordinate equation juggled around and then modifying the example for a sphere in 3dcalc’s help.

c = z-radius of the spindle-shaped ellipsoid/symmetrical egg
a = xy-radius of the egg
let a=10, c=20
a^2=100, c^2=400, a^2c^2=40000

# make prolate spheroid with 3dcalc

set dset = MP3d_anat+orig

set a = 10

set c = 20

set xc = 10
set yc = 20
set zc = -30

# if you have to do lots of these

set a2 = `ccalc -expr "\$a^2"`
set c2 = `ccalc -expr "\$c^2"`
set a2c2 = `ccalc -expr "\$a2*\$c2"`

# generate 3D volume

3dcalc -a \$dset -RAI -expr “step(\$a2c2-\$c2*((x-\$xc)^2+(y-\$yc)^2)-\$a2*(z-\$zc)^2)” -prefix prolate1 -overwrite

Then you can render this
suma -vol prolate1+orig.

ha, amazing! you did that so fast. thanks so much Daniel, it works perfectly.
p.s. unrelated and no biggie but the “-overwrite” option isn’t in 3dcalc’s help

The -overwrite option is available across all AFNI C-based programs. These kinds of global options aren’t always mentioned in every help, but they are described in the afni GUI help and in this webpage:

https://afni.nimh.nih.gov/pub/dist/doc/program_help/common_options.html

and this from the afni GUI help:
Global Options (available to all AFNI/SUMA programs)
-h: Mini help, at time, same as -help in many cases.
-help: The entire help output
-HELP: Extreme help, same as -help in majority of cases.
-h_view: Open help in text editor. AFNI will try to find a GUI editor
-hview : on your machine. You can control which it should use by
setting environment variable AFNI_GUI_EDITOR.
-h_web: Open help in web browser. AFNI will try to find a browser.
-hweb : on your machine. You can control which it should use by
setting environment variable AFNI_GUI_EDITOR.
-h_find WORD: Look for lines in this programs’s -help output that match
(approximately) WORD.
-h_raw: Help string unedited
-h_spx: Help string in sphinx loveliness, but do not try to autoformat
-h_aspx: Help string in sphinx with autoformatting of options, etc.
-all_opts: Try to identify all options for the program from the
output of its -help option. Some options might be missed
and others misidentified. Use this output for hints only.

-overwrite: Overwrite existing output dataset.
Equivalent to setting env. AFNI_DECONFLICT=OVERWRITE
-ok_1D_text: Zero out uncommented text in 1D file.
Equivalent to setting env. AFNI_1D_ZERO_TEXT=YES
-Dname=val: Set environment variable ‘name’ to value ‘val’
For example: -DAFNI_1D_ZERO_TEXT=YES
-Vname=: Print value of environment variable ‘name’ to stdout and quit.
This is more reliable that the shell’s env query because it would
include envs set in .afnirc files and .sumarc files for SUMA
programs.
For example: -VAFNI_1D_ZERO_TEXT=
-skip_afnirc: Do not read the afni resource (like ~/.afnirc) file.
-pad_to_node NODE: Output a full dset from node 0 to MAX_NODE-1
** Instead of directly setting NODE to an integer you
can set NODE to something like:
ld120 (or rd17) which sets NODE to be the maximum
node index on an Icosahedron with -ld 120. See
CreateIcosahedron for details.
d:DSET.niml.dset which sets NODE to the maximum node found
in dataset DSET.niml.dset.
** This option is for surface-based datasets only.
Some programs may not heed it, so check the output if
you are not sure.
-pif SOMETHING: Does absolutely nothing but provide for a convenient
way to tag a process and find it in the output of ps -a
-echo_edu: Echos the entire command line to stdout (without -echo_edu)
for edification purposes

ah, ok got it. thanks again