**PURPOSE**- Calculates the mean relative error and the discrepancy
between two volumes within an (optional) mask. A scaling
factor and additive constant is determined to scale the second
volume such that the errors are minimized. Optionally volume 1
is subtracted from the scaled volume 2 and the results stored in
an output volume.
**Operation includes all functions of obsolete legacy operation: 'DR ERR'.**Example.

**USAGE**- .OPERATION: DR DIFF [f],[con],[dif],[dis]

- [This operation can return up to four optional register variables:
Variable Example Receives First [f] Optimum scaling factor Second [con] Offset between 2 volumes Third [dif] Mean relative error Fourth [dis] Discrepancy .FIRST VOLUME: 3DR_004

[Enter name of 3-D file].SECOND VOLUME: 3DR_005

[Enter name of second 3-D file].MASK FILE: MASK001

[Enter name of mask file or "*" if no mask is to be applied] - If a mask was specified SPIDER asks:

.APPLY MASK TO BOTH, SCALING AND DIFFERENCE/ERROR? (Y/N): Y

[Specify if the mask should be applied only in the step of scaling the two volumes (answer: 'N') or, besides during scaling also during the error calculation and difference volume calculation (answer: 'Y)' ].OUTPUT DIFFERENCE VOLUME: THREEDDIF001

[Enter file name for difference. Enter "*" if no difference volume is desired.]

**NOTES**

- Error formulas:

Mean relative error: E = SUM |F*V2-V1-CON| / SUM |V1-AV1|

Discrepancy: E = SQRT [SUM |(F*V2-V1-CON)**2| / SUM |(V1-AV1)**2|]

Where:

V1,V2 = Voxel values of volume 1 and volume 2.

F = Optimum scaling factor.

CON = Offset between the two volumes.

AV1 = Average voxel under mask in volume 1

- For more details about the error measures see :

Colsher J.G. Iterative Three-dimensional Image Reconstruction from Tomographic Projections,*Computer Graph. & Image Proc.*6, (1977) 513-537.

Herman G.T. Two Direct Methods for reconstructing pictures from their projections: A comparative study.*Computer Graph. & Image Proc.*1,(1972) 123-144

**SUBROUTINES**- COMP3DMAD

**CALLER**- VTIL2

© Copyright Notice / Enquiries: spider@wadsworth.org