Human body 3D data

I am currently writing a textbook for CRC Press, Applied X-Ray Science Calculations: Monte Carlo Methods. In consequence, articles will appear here only infrequently until June 2016. I will post items of interest that I discover while researching the book.

Detailed dose calculations for radiation safety require a three-dimensional model of the human body organized by tissue type. Most of the available information consists of MRI-type images. The gray-scale data indicate divisions within the body, but have no correlation with local physical properties. Fortunately, I found one data set that provides all the information necessary for Monte Carlo radiation simulations, the Zubal Phantom ( The work, supported by the U.S. Department of Energy, is described in this paper:

Zubal, I.G., Harrell, C.R, Smith, E.O, Rattner, Z., Gindi, G. and Hoffer, P.B., Computerized three-dimensional segmented human anatomy, Medical Physics, 21(2):299-302, 1994.

Working from MRI data, the researchers painstakingly identified tissue regions over the scan volume and coded the tissue type as a byte value in each voxel. Four data sets are available:

  • Human head (superior-inferior slice direction)
  • Human torso (superior-inferior slice direction)
  • Human body arms down  (superior-inferior slice direction)
  • Human body arms folded (lateral slice direction)

The principal investigator has requested that the phantom files (or any modifications of them) not be distributed. Instead, individual users must obtain the files directly from his site. Users are free to modify the files for their applications. Accordingly, I wrote a utility program, PhantomConv, to read the phantom information and to produce standard Mesh and MetaMesh output files in text  format. The resulting files may be entered directly into GamBet (or any other TriComp or AMaze solution engines). PhantomConv organizes the region numbers in the phantoms into a continuous set and supplies easily-displayed tissue names. The program produces a single MDF file containing all slices. It also produces a large set of MIN files (one per slice) for 2D work. Figures 1 and 2 show displays in Mesh and MetaMesh.

Mesh display of the human body, single slice

Figure 1. Mesh display of the human body, single slice.


MetaMesh display of the human body

Figure 2. MetaMesh display of the human body, complete 3D information.

Please contact us to obtain a free copy of PhantomConv along with instructions for creating your own data set.

[1] Contact us :

[2] Field Precision home page:

Manually creating a new file type in Windows

File types in Windows are designated by extensions (e.g., .txt, .html, .jpg, …). You can associate a file type with a specific program. Then, if you double-click on a file in FP File Organizer or Windows Explorer, the file opens in the associated program. For example, my computer is set up to open files of type .txt with the ConText text editor.

It’s easy to set the associated program for an existing file type. In Windows 7, go to Control panel/Default programs/Associate a file type or protocol with a program. Scroll down, select the extension and then click the Change program button. Navigate to the program executable and pick it.

But, what if the file extension is not on the list? Things get more complicated — there is no procedure in the Control panel to add a new file extension. Here’s how to do it by editing the Registry with regedit (a built-in Windows utility) [1].

Let’s use an example. I often generate or modify .min files (input to Mesh and MetaMesh) with the ConText editor. A check of the existing associations shows that .min is not included. Here is the procedure to add it:

  1. Run regedit. (The Run option in the Start Menu seems to have disappeared from Windows 7. To start the program, right-click in FP File Manager, open a terminal window and enter the command regedit).
  2. In regedit, right click HKEY_CLASSES_ROOT and choose New/Key.
  3. Enter the name .min (be sure to include the dot).
  4. Within the new key (right-hand side of the window), right-click on (Default) and choose Modify.
  5. Type in the name MetaMesh input.
  6. Again, right-click on HKEY_CLASSES_ROOT and choose New/Key.
  7. Name the key MetaMesh input (the same name as in Step 5).
  8. Exit regedit.

Now if you go back to Associate a file type with a specific program from the Control panel, the file type .min appears in the list. Click the Choose program button and navigate to ConText. Arcane procedure, but it works.


[1] Be cautious if you decide to edit the Registry. A big mistake could ruin the Windows setup.

[2] Contact us :

[3] Field Precision home page:

Using MeshLab with Geometer and MetaMesh

Several years ago, we faced a decision on how to import information from CAD programs into MetaMesh, our 3D mesh generator. There was a sense of urgency for two reasons: 1) we had a consulting project with shaped electrodes that were beyond the capabilities of the native solid models of MetaMesh and 2) users increasingly expected to be able to port models from SolidWorks and other programs. We rejected so-called standardized file types like IGES and STEP because the proprietary format specifications were not generally available and the files contained far more information than was needed for our application. Working directly through the APIs of popular CAD programs would have required adding several full-time staff members. Fortunately, there was a simple and effective alternative: the STL (stero-lithography) file. It has several attractive features:

  • The format contains only geometric information. It defines the surface of a solid as a set of contiguous triangular facets. This is exactly what we needed, and nothing more.
  • The format is a standard for controlling 3D machine tools; therefore, all CAD programs must support STL export.
  • The format is simple and cast in concrete. No manufacturer or group can add proprietary features.

Since that time, our decision to go with STL has proved even more (pick one):

  • Prescient.
  • Serendipitous.
  • Lucky

First, interest in 3D printing has exploded. STL is the format of choice for this application. Second, powerful software resources are available to correct and to modify STL files. This means that even if you get a clunker file, you can still make a good mesh for field calculations.

In this article, I’ll give a quick introduction to MeshLab, a wonderful open-source program that is a must-have for anyone working with STL files. The functions of the program range from basic to beyond-PhD — in other words, it may be intimidating at first. My purpose in the tutorial is to focus on features useful for MetaMesh import. Once you get the basic ideas, MeshLab is easy to use. I’ll illustrate with a specific example. Suppose we want a human-shaped phantom for a GamBet dose calculation. There are many Internet sites offering free STL files to support the 3D printing community. I found the following file of the human female figure, body30.stl. The raw file (content shown in Fig. 1), has a multitude of flaws that we will fix with MeshLab:

  • The number of facets is large (83,078), far more than is needed. For example, it’s not necessary to resolve the swimsuit lines for the application.
  • There are orphan facets (for example near the fingers).
  • The file has logical errors such as redundant vertices, so that it cannot be read directly by Geometer and MetaMesh.
Test object displayed in the Geometer STL viewer

Figure 1. Test object displayed in the Geometer STL viewer.

Install and run MeshLab[1]. If you find the sophisticated Italian color scheme distracting, you can dull it down as I did. Click Tools/Options and change BackgroundBotColor, BackgroundTopColor and LogAreaColor. When you find a good color, be sure to press the Save button so that the program remembers it for next time. MeshLab starts in the default Project_1. To add the STL mesh to the project, click File/Import mesh and choose body30.stl. Accept the program prompt to unify duplicate vertices. We’ve already achieved some benefit at this point. Choose File/Export as, pick the STL format and supply the name body30fixed.stl. The result is a logically-correct file that can now be loaded into the Geometer STL Viewer of Fig. 1.

In the Export as operation, it was apparent that MeshLab can deal with a lot of formats besides STL. These formats can include extensive information, such as texture and even PNG images associated with facets. The implication is that there are many operations in MeshLab that are not relevant to STL files.

MeshLab displays the facets of body30.stl from a viewpoint above the head (Fig. 2). To begin, let’s learn some basics of changing the view:

1) To rotate the viewpoint, move the cursor inside the display area, hold down the left mouse button and drag the mouse.

2) To pan, do the same thing but hold down the control key.

3) Use the mouse control wheel to zoom in and out.

4) Change the rendition method using the circled tools in Fig. 2.


MeshLab screenshot

Figure 2. MeshLab screenshot after loading body30.stl.

Using the view controls, create an expanded view of the hand region as shown in Fig. 3. There are orphan facets, edges are spiky, surfaces are noisy and there are many more facets than we need. The symptoms are typical of a 3D scanner. Clearly, it’s impractical to do individual editing on 83,078 facets. Instead, we will apply the automatic filters available in MeshLab. If you click on Filters and check out the sub-directories, there are a dizzying number of arcane options. Fortunately, only a small subset is useful for STL files intended for mesh generation.

  • Normals, Curvature and Orientation/Transform …
  • Smoothing, Faring and Deformation/Laplacian Smooth
  • Cleaning and Repairing/Remove Isolated Pieces (wrt Diameter)
  • Remeshing, Simplification and Reconstruction/Surface Reconstruction (Poisson)

Transformations modify the coordinates of the facet vertices. With them, you can move and rotate the object and change the size. One application is to create an assembly of STL objects using files that were recorded in local coordinate systems. Alternatively, you can use the transformation operations in Geometer or add Shift and Rotation commands in the MetaMesh script.

Orphan facets

Figure 3. Detailed view of orphan facets in body30.stl.

The smoothing operation iteratively averages coordinates of neighboring vertices. Figure 4 shows the effect. The filter is useful to reduce small holes or noise from scans. The Remove Isolated Pieces filter can be applied to eliminate disconnected facets such as those near the fingertips (Fig. 5). First, we need a scale size for the disconnected pieces. Activate the Measuring Tool and click on two points that span the orphan facets. We’ll remove any objects with a diameter smaller than 15.0. Figure 5 shows a before-and-after shot along with the dialog settings. The figure is now self-connected, a big plus for a MetaMesh analysis.

Effect of Laplacian smoothing

Figure 4. Effect of Laplacian smoothing.

Removing isolated parts

Figure 5. Removing isolated parts.

The Surface Reconstruction (Poisson) filter is the most useful operation. It often accomplishes everything we want in one step: consolidation and smoothing combined with a reduction in the number of facets. We’ll check it out in detail. Close the project, start a new project and reload the raw mesh body30.stl. Then apply the Surface Reconstruction (Poisson) filter with the parameters shown in Fig. 6.  The first two parameters give the inverse of the level of simplification: 6 gives less detail and 8 gives more detail. The other two parameters should be left at a value of unity. Higher values significantly reduce the size of the object. Values of 0 crash the program.

Using the Surface Reconstruction (Poisson) filter

Figure 6. Using the Surface Reconstruction (Poisson) filter.

When you apply the filter, the mesh does not appear to change. It certainly does not look like Fig. 6. In contrast to the previous operations, the reconstruction filter creates a new mesh rather than modifying the present one. The display shows a superposition of the two meshes. How do we know there are two meshes? We need to activate the Layer Dialog. Right-click anywhere in the menu or toolbar to bring up the pop-up menu at the top-right of Fig. 6 and check Project_1. The program adds the list of layers displayed on the right-hand side of Fig. 6. It contains the original mesh and the modified one. Turn off the visibility of the original mesh to see the display of Fig. 6. You can experiment with the reconstruction command, adding additional meshes. Right click within the Layer dialog for a set of options such a deleting a mesh.

The mesh shown is ideal for the radiology application. It is self-connected with no spurious details, providing a good definition of the human-body volume. The number of facets has been reduced by about a factor of 5 to 16,008. To save the mesh, highlight it in the Layer Dialog and choose Export Mesh As in the File menu. Save it as an STL file with the name simplify8.stl.

I generated STL files for Poisson parameters 6 (3968 facets), 7 (16008 facets) and 8 (64120 facets). Here is a simple MetaMesh test script:

   -7.50000E+01  7.50000E+01  2.50000E+00
   -9.00000E+01  9.00000E+01  2.50000E+00
   -2.50000E+02  2.50000E+02  2.50000E+00
  RegName(  1): SolutionVolume
  RegName(  2): HumanBody
  Parallel 4
  Region: SolutionVolume
  Name: SolutionVolume
  Type: Box
  Fab:   1.50000E+02  1.80000E+02  5.00000E+02
  Region: HumanBody
  Name: HumanBody
  Type: STL  Simplify7  Fit
  Fab:   8.00000E-01  3.00000E-01
  Surface Region SolutionVolume

At a resolution of 0.25, the mesh contained 864,000 elements. Figure 7 shows the resulting meshes for Poisson parameters of 6, 7 and 8. The choice of 7 was well suited for the application. The processing time in MetaMesh was 31 seconds. For the radiology application, a resolution of 0.5 is probably sufficient. In this case, the total number of elements is 108,000 with processing time of 6 seconds.

MetaMesh representations of the object

Figure 7. MetaMesh representations of the object with an element size of 0.25 and Poisson parameters 6,7 and 8.

Corrections in MeshLab work well when the surfaces of the object are relatively smooth and the facets have approximately the same areas (as in the current example). On the other hand, STL files exported from 3D CAD programs may have sharp edges and very large variations of facet size. The Poisson correction method fails for such a file. In this case, you should use the export controls in the CAD program to control the facet resolution.

Finally, MeshLab and the Geometer STL Viewer have relative merits as general-purpose STL displays. MeshLab has more responsive controls and display options, but is limited to the perspective view of Fig. 2. On the other hand, Geometer supports both the perspective view and the precise projection view of Fig. 1. This view is better suited for extracting quantitative data.


[1] MeshLab always starts in full screen mode. It would certainly be nice if the program remembered its previous window.

[2] Contact us :

[3] Field Precision home page:

Resources for finite-element electric/magnetic field solutions

This is the concluding article of the online course, Electric and magnetic field calculations with finite-element methods. In the course, we’ve had a chance to get familiar with the operation sequences and data organization of 2D and 3D programs and discovered many useful analysis techniques. Hopefully, the material will help you get started on your own applications. There’s still a lot to discover – EStat, PerMag, HiPhi and Magnum have a wealth of capabilities that I couldn’t cover in a short introduction. This article lists resources supplied with the programs or available on our Internet site to help you build your expertise.

First, let’s review materials included with the software packages. There are individual PDF manuals for Mesh, EStat, PerMag, MetaMesh, HiPhi and Magnum. They serve as versatile references through the intensive use of hyperlinks. The active table of contents is displayed if you activate the bookmark view in your PDF reader. Each manual also has a index with active page links.

All software packages include an example library containing ready-to-run, annotated input files for wide variety of applications. Be sure to look at text files in the example directories with names like HIPHI_EXAMPLE_INDEX.TXT. They contain a list of the examples along with a brief description of interesting features.

The following free resources are available on our Internet site:


Finite-element Methods for Electromagnetics
This full length text was published in 1997 by CRC Press. It reviews the physics of electrostatics and magnetostatics and gives a detailed description of the mechanics of EStat and PerMag. The book is an essential reference if you want to check under the hood to see how finite-element programs work.


Example input files
Complete input files for all the examples discussed in the course.


Field Precision Technical library
This Internet page has downloadable copies of the latest manuals for all Field Precision programs. In addition, there are many tutorials in PDF format that review solution techniques for electric and magnetic field applications. Here are links to the tutorials:


Field Precision software tips blog
We’ve added numerous how-to articles to this blog, whenever there is an interesting tech-help question. The following articles are related to mesh generation, electrostatics and magnetostatics.



 EStat and HiPhi

PerMag and Magnum


[1] Contact us :

[2] Field Precision home page:

3D magnetic fields: iron and permanent magnets

This article is part of the continuing online course, Electric and magnetic field calculations with finite-element methods. For the final calculation of the course, we’ll characterize forces in a latching solenoid. The example exercises the full finite-element capabilities of Magnum and provides an opportunity to use the force-calculation capabilities of MagView. In preparation, copy the files LATCHING.CDF, LATCHING.MIN and LATCHING.GIN to a working directory and set the Data folder of AMaze. The three input files have the same functions as the ones we encountered in the previous article.

Figure 1 shows a drawing of the solenoid assembly along with the mesh created by MetaMesh. The neodymium-iron permanent magnets have magnetization directions pointing toward the plunger. They provide a resting holding force to keep the plunger in contact with the steel bobbin. Depending on the polarity of solenoid current, the coil may work in opposition to the permanent magnet to unlatch the plunger or it may assist the permanent magnet to pull in the plunger.

Latching solenoid assembly

Figure 1. Latching solenoid assembly — drawing and three-dimensional mesh. The parts are displayed in the space y > 0.0 mm and the coil in y < 0.0 mm. The plunger has diameter 10.0 mm and length 28.0 mm.

Run Geometer and load the file LATCHING.MIN. Check out the script content with the internal editor. By now, you should be familiar with the format conventions. A variable-resolution foundation mesh is employed for accurate field calculations at the gap between the bobbin and plunger. The solution includes five physical regions: air, the steel of the case, the steel plunger and the upper and lower magnets. Notice the use of labels and comments to document features of the calculation. Construction of the mesh is straightforward. The Box model is used to represent the steel plates and the magnets, while the bobbin is a Cylinder. The plunger is a Turning, a model we have not yet discussed. A turning is an outline rotated about the z axis of the workbench space. Note the outline vectors in the script following the Type command of the Plunger section.

Outline editor showing the outline for the plunger turning

Figure 2. Outline editor showing the outline for the plunger turning.

To see the outline, exit the editor and click Outline. Geometer opens the window of Fig. 2. In contrast to the convention for extrusions, the outline of a turning is defined in cylindrical coordinates, (z,r)[1]. In the editor, you can modify vectors of the outline using the CAD operations. The changes appear immediately in the Geometer display when you return to the main menu. Changes are recorded if you save the MIN file under the same or a different name. To check the variable mesh definitions, exit the outline editor and click Foundation. The foundation mesh window (Fig. 3) shows 2D plots of the assembly along with the initial mesh divisions (before fitting). Figure 3 is a zoomed view in a plane normal to the y axis. Note the region of very fine elements (0.025 mm) along z near the gap between the bobbin and plunger. To investigate the holding force of the solenoid, we need to perform surface integrals with very small gaps.

Detailed view of the foundation mesh

Figure 3. Detailed view of the foundation mesh showing the fine division in z at the bobbin-plunger gap.

Let’s proceed to the solution. Run Magwinder and load LATCHING.CDF with the content:

  DUnit:   1.0000E+03
  Ds:   2.0000E+00
  Name: Solenoid
  Current: -1.0000E+03
    Name: Solenoid
    Type: Solenoid
    Fab:   6.0  10.0  27.0  2    20    20
    Shift:   0.00  0.00  -9.50

The coil definition file uses the Solenoid model to create 800 applied current elements with a coil current of -1000 A-turn. The negative value gives a coil field inside the bobbin in the same direction as the permanent magnet field. Click File/Save element file to create LATCHING.WND.

Run MetaMesh and process the MIN file to create LATCHING.MDF. To check out the controls for the finite-element solution, run Magnum, click File/Edit input files and choose LATCHING.GIN. The file has the following content:

Mesh = Latching
Source = Latching
DUnit = 1000.0
ResTarget = 5.00E-08
MaxCycle = 2000
* Region 1: AIR
Mu(1) =   1.0
 * Region 2: STEEL
Mu(2) =   1000.0
 * Region 3: PLUNGER
Mu(3) =   1000.0
 * Region 4: MAGNETUP
PerMag(4) =   1.25 ( -1.0 0.0 0.0)
 * Region 5: MAGNETDN
PerMag(4) =   1.25 (  1.0 0.0 0.0)

In contrast to the free space solutions we discussed previously, the solution type is set to Standard and physical parameters are assigned to the regions. The quantities ResTarget and MaxCycle control the iterative solution of the finite-element equations (default values are usually appropriate). For magnetic-field solutions, material quantities are the relative magnetic permeability and the parameters of permanent magnets. Because we do not expect saturation effects at the device field levels, we assign the high value μr = 1000.0 to the case, bobbin and plunger. The specification of a permanent magnet material includes the remanence field Br = 1.25 tesla and a vector pointing along the direction of magnetization. The magnetization of the top magnet points in the –x direction and the top magnet in the +x direction.

Run Magnum to create the output file LATCHING.GOU. Figure 4 shows the distribution of |B| in the plane y = 0.0 mm with the plunger in contact with the bobbin. The combination of flux from the two magnets produces an approximately uniform field at the contact point of B0 = 1.61 tesla. Note that it is not necessary to surround the assembly with a large external volume because the flux is well-contained in the magnetic circuit.

Field distribution in the latched state in the plane y = 0.0 mm

Figure 4. Field distribution in the latched state in the plane y = 0.0 mm. Color-coding shows |B| in tesla.

The goal of the calculation is to find the force on the plunger as a function of the gap width. The force calculation is easy when the plunger is well-separated from the bobbin. Because the plunger is surrounded by air (μr = 1.0) elements, we can apply a surface integral of the Maxwell stress tensor over the plunger facets. The definition of the Maxwell tensor is contained in the configuration file Magview_Standard.CFG[2]. It is useful to take a moment to look at the configuration file (usually contained in the Program folder defined in AMaze). Open the file with an editor. It contains definitions for plot quantities and numerical calculations. This section applies to automatic surface integrals:

* Force components
  FxSurf = &Bx 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *;&Bx &By * $IMu0 *;&Bx &Bz * $IMu0 *
  FySurf = &By &Bx * $IMu0 *;&By 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *;&By &Bz * $IMu0 *
  FzSurf = &Bz &Bx * $IMu0 *;&Bz &By * $IMu0 *;&Bz 2 ^ &BMag 2 ^ 2.0 / - $IMu0 *

The expressions give the force components determined from the Maxwell integral at a point. Quantities like &Bx are calculated field quantities at the point, while quantities like $IMu0 are defined constants.

Run MagView and load LATCHING.GOU. To find the total force on the plunger, click Analysis/Surface integrals in the main menu to bring up the dialog of Fig. 5. The internal region is the Plunger and the single external region is Air. Click OK and save the results to the file LATCHING.DAT. Here is the result for a gap width of 0.20 mm with zero coil current:

---------- Surface Integrals ----------
 Region status
 RegNo   Status    Name
     1  External   AIR
     3  Internal   PLUNGER
 Surface area of region set (m2):   1.076727E-03
   FxSurf:   1.103232E-04
   FySurf:  -1.477638E-03
   FzSurf:  -2.413384E+02

As an indication of accuracy, the force components Fx and Fy (theoretically zero) are smaller than Fz by a factor exceeding 1/100,000. With a gap of 3.0 mm, the axial force with no coil current is Fz = -1.111 N. The force increases to -7.427 N with a coil current of -1000 A-turns.

Surface integral dialog

Figure 5. Surface integral dialog. In this case, the integral is taken over all external facets of the plunger in contact with air elements.

A quantity of particular interest is the holding force in the latched state (i.e., plunger touching the bobbin with no coil current). In this case, a Maxwell stress tensor integral around the plunger does not apply because the plunger and bobbin are effectively the same piece of material. One option is to perform a series of calculations with an air gap of decreasing width dg. The goal would be to fit the force variation with an interpolation function that could be extrapolated to dg = 0.0.

Figure 6 shows results of the calculation. A simple plot of Fz versus dg would not be informative because the force varies by orders of magnitude. The strong variation reflects the familiar experience of two magnets snapping together when they are close. A helpful observation is that force scales as 1/dg^2 for gaps greater than 0.5 mm. Therefore, it is useful to construct a log-log plot of 1/√Fz versus dg. The data of Fig. 6 suggest show that the force approaches a constant value at zero spacing. This approach requires considerable accuracy and effort. It is necessary to include results for very small gap widths (dg = 0.05 mm) to observe the inflection toward a constant value.

Function of force versus gap with

Figure 6. Plot of 1/sqrt(Fz) as function of the gap between the plunger and the bobbin, where Fz is the force on the plunger in newtons. Blue circles indicate results determined by a MagView surface integral. The dashed red line indicates the theoretical value for zero gap.

Fortunately, there is a simple way to determine the exact holding force from a knowledge of the flux distribution at dg = 0.0 mm. Suppose we displace the plunger an infinitesimal distance dx from the bobbin. The field in the air gap would remain confined to the cross section area A of steel parts with a value approximately equal to the zero gap field, B0. The change in field energy in the magnet circuit is

dU = [B0^2/(2 μ0)] A dx.

Using the principle of virtual work, the holding force is

Fz = – dU/dx = – [B0^2/(2 μ0)] A.

With a plunger diameter of 10.0 mm, the area is A = 7.854E-5 m^2. With B0 = 1.61 tesla, the total predicted force is Fz = -80.935 N (plotted as a dashed red line in Fig. 6). The mass equivalent is 8.25 kg.

We’ve covered a lot of territory in these articles, hopefully enough to get you started on finite-element calculations for your electric or magnetic field application. The final article will discuss additional resources to guide your calculations.


[1] Vector coordinates of outlines for turnings must satisfy the condition r ≥ 0.0.

[2] The MagView default configuration file is sufficient for most code users. On the other hand, MagView has the flexibility to meet the needs of power users. You can set up custom configuration files with user-defined quantities.

[3] Contact us :

[4] Field Precision home page: