c3d icon indicating copy to clipboard operation
c3d copied to clipboard

-rms doesn't compute RMS

Open cookpa opened this issue 2 years ago • 2 comments

% 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.

cookpa avatar Jun 28 '22 19:06 cookpa

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

pyushkevich avatar May 24 '23 20:05 pyushkevich

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.

cookpa avatar May 26 '23 18:05 cookpa