# Compare a 3D shape measurement with a numerical model?

GROUPS:
 Halo,I have a set of measurements of a 3D shape in the form of a rectangular array (1000 x 1000) with z-values. The matrix location represents the x,y coordinates associated with each z-value. I want to compare these measurements with a numerical (not an analytical) model of this 3D shape. I can easily convert the model to an array of z-values of the same dimension. But the measurements have some uncertainty: the xy-position of the object being measured is not precise and the object might have some tilt or even distortion. How should I fit my model to the measurement data and get a numerical comparison between the measured shape and the model? I assume there are methods around to this: there are machines which measure 3D shapes and compare the measurement to the CAD data. How to do something similar in Mathematica?Thanks a lot for your help. Maarten
10 months ago
4 Replies
 Hi Maarten,just as a little remark: In radiotherapy the comparison of 3D dose distributions (e.g. measurement vs. calculation) is a standard problem. The typical approach here is to use the "gamma evaluation" method (see e.g. this article), because discrepancies may be due to measurement errors or spacial distortions. To me your task seems to be exactly equivalent.When coding gamma evaluation with Mathematica the function Nearest might be most helpful.Regards -- Henrik
10 months ago
 Did you notice new versions of Mathematica give volumes of shapes, and that if you save an Image[] of the shape, Mathematica can give you Area/volute measurements as well?Did you try Volume Rendering (new feature in Mathematica)? It with "3D" render using {x,y,z} "cubes", which may be easier for you to work with "as a grid".Mathematica will not distort Graphics3D if you choose your BoxRatios / Aspect ratios.Mathematica has an option Screen Environment (see Format in main frame/top menu bar): "Working" "Printout". Also you can choose to "show ruler". Printout should show an ACCURATE representation (and if your OS is setup right, you can put a ruler on the screen to the ruler on Mathematica's ruler). Furthermore when you print if the inches/millimeter shown on ruler do not print EXACTLY as seen on screen (ie, 4" on ruler on screen is 4" exact on paper): then you have some OS / Printer problems or perhaps a Mathematica bug.HOWEVER: Mathematica's GL I don't think is as accurate as the older version use of Postscript graphics as far as "measuring in em's 1/72 of an inch. Infact I believe you may find that you can find glitches in some GL renderings (i have a list of ones i found). Therefore make sure your 3D is "upright and proper" before using measurements for anything other than general study. I would have to print a page with Text (using fixed fonts known measurements in em's) and with 2d pictures and 3d graphs to see/insure if GL is rendering them faithfully to scale (given printer settings, etc). I'm not sure how Mathematica deals with 3D that does not fit onto page when "aspect" is 1:1 nor how it converts between Scaled[] (0-1 range) to em's - and note you need to Scale[] as "everything is relative" when your talking about 3D and giving range 0-1 let's you fix the relativity to em's, I'm only sure that Postscript graphics are/were faithful as are Image[].
10 months ago
 More briefly: if you use Scaled (make all vertex are reals between 0 and 1) and ImageSize, you can fixate any graphic (relative) to being measurable on-screen and on-paper. If you want to calculate another way: see above or keep looking, Mathematica has many features that can "automate" calculation of area and volume for you.
10 months ago
 Dear Henrik, John,Thanks a lot. I was already looking into Image3D, but I am afraid the processing could get slow. Thanks for the link to the gamma dose paper. Still hope to get some reply from somebody who is familiar with comparing mechanical CAD models with a 3D measurement data set.Best regards, Maarten