This section describes the data format for importing binary data to define an object. In this binary import, the data should have values of 1 or 0, indicating that the object is or is not present.
The file formats are shown in the following tables. Spaces, commas or tabs can be used as separators in the files. The columns do not have to be aligned.
The values of x range from X1 to Xn, y from Y1 to Ym and z from Z1 to Zp. The values of x, y, and z must be uniformly spaced. The number n should be either 1 (the material is present at this location) or 0 (the material is not present). If other values are used, any non-zero value will be interpreted to be 1.
Note that there must be at least 2 data points in each dimension (ie, n, m, p >= 2).
Binary import window
To import binary data, click on the Binary import option of the Import button in the main toolbar, which will open up the import wizard.
A screenshot of the wizard is shown in the following figure
The different fields are
- X, Y, Z: the data origin in the global coordinates of the Graphical Layout Editor. If you defined your volume with respect to a particular point in space, for example (0,0,-5) microns, then you should set z0 to -5 microns.
- X SPAN, YSPAN, ZSPAN: This defines the size of volume that you are importing. These fields are inactive and help to determine that the file units have been properly chosen.
- FILE UNITS: Select units for the data in your file.
- IMPORT AS Mkji INSTEAD OF Mijk: It is often easy to cycle through the array indices in the wrong order when exporting the file, and this check button allows you to reverse the order easily. Typically, it is very easy to see in the figure window when you have the order incorrect.
- PLOT PLANE: You can image the data in either the x-y plane, the x-z plane or the y-z plane to be sure that it is correctly imported. Use this menu chooser to switch between planes.
- Z (or X or Y): Depending on the PLOT PLANE chosen, you can view cross sections at any depth into the structure. Use this slider or the value input field to choose the depth of cross section.
BINARY THRESHOLD: This property can be set between 0 to 1 to define the object's edge. By default, it is set to 0.5 which means that as the binary data (0 or 1) is interpolated onto the current mesh, any point that has a value of 0.5 or larger is considered "inside" the object. This default value can be the best setting for curved surfaces such as spheres.
Importing binary data using script commands
The following script commands are described in detail in the Reference Guide. Examples script files are provided here.
Import binary data from a file.
Import binary data from script variables
Note: Imported binary object boundaries
The boundary of the import binary object is positioned between the vertices where the material is present and the vertices where the material is not present. The shape of this implied boundary can be complex, and the viewport does not show the full detail. The boundary can be moved closer to vertices where the material is present by increasing the "binary threshold" property of the import object. To confirm the boundary that will be used in the simulation by the solver, use an index monitor.
The following lines of script will generate a simple binary object and visualize the actual boundary in an index monitor as shown below. You can see that the actual boundary (right) is not represented by the layout editor window (left).
x = [-3e-6;3e-6];
y = [-2e-6;2e-6];
z = [-1e-6;1e-6];
X = meshgrid3dx(x,y,z);
Y = meshgrid3dy(x,y,z);
Z = meshgrid3dz(x,y,z);
binary = zeros(2,2,2);
binary(1,1,1) = 1;
binary(2,1,2) = 1;
importbinary2(binary, x, y, z);
set("x span", 10e-6);
set("y span", 10e-6);
set("z span", 10e-6);
set("x span", x(2)-x(1));
set("y span", y(2)-y(1));
set("z span", z(2)-z(1));