pyushkevich / c3d

Convert3D tool
GNU General Public License v3.0
32 stars 16 forks source link

-rms doesn't compute RMS #18

Open cookpa opened 2 years ago

cookpa commented 2 years ago
% c3d -help rms                                                                                                                    
-rms                            : Voxelwise vector norm

Syntax: `-rms`

Computes RMS (root mean square) of all images on the stack. The command takes the square of each image on the stack, adds all the squared images and takes the square root of the result. This is very useful for statistical operations. Images must have the same size. 

    c3d img1.img img2.img img3.img img4.img -rms -o rms.img

The equivalent of this command is

    c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \
        -accum -add -endaccum -sqrt -o rms.img

In the code, it appears that -rms sets an option for an anti-aliasing filter. It doesn't actually compute the RMS.

pyushkevich commented 1 year ago

The -alias command for which -rms sets the RMS option does appear in the documentation, so the risk of breaking existing code is minimal. I would recommend making -rms behave as currently documented, and renaming the option to -alias-rms

cookpa commented 1 year ago

PR in #29, I added -antialias-rms.

@pyushkevich would it be better to make the parameter something general, like -rms-error? I'm thinking it could be used in other commands, like -iterations. Happy to update PR if needed.