-
Notifications
You must be signed in to change notification settings - Fork 0
Preprocessing
First, you need to create a mesh from the 3D points. Change the directory the project's directory and run the following command:
python -m preproc.create_mesh -d file-name -r root-fol
Where file-name is the name of the data file, without the suffix. The first 3 columns in the data file are the 3D coordinates, and the fourth column is the values. The supported files types are mat (Matlab), npy (python numpy matrix) and csv. The root-fol is the folder where the data file is located. You can use the following flags:
- -d: Data file name, without the suffix ('data' for example) points_num x 4, where the first 3 columns are the x,y,z coordinates, and the fourth is the values. The supported data types are mat (Matlab), npy (python) and csv.
- -r: Root folder, where the data file is located
- -f: Which function to run:
- plot_perim_hist: Plot the faces perimeters histogram
- create_mesh: Create the mesh file. The faces perimeters threshold is taken from the faces perimeters histogram (mean + std) or from the cmd arguments
- all (default): Run all of the above
- --plot_perim_hist: Whether to plot the perimeters histogram or not (default is True)
- --perim_threshld: Set the perimeters threshold and not taking it from the histogram (default is 0, so it's taken from the faces perimeters histogram (mean + std)
The code is using the Delaunay algorithm to find all the simplices. The assumption is that only the simplices with a minimal perimeter will participate in a joined face. Therefore one needs to set a cutoff. For doing so, it's recommended to check first the perimeters histogram of your data. To do so, run the following command:
python -m preproc.create_mesh -d file-name -r root-fol -f plot_perim_hist
The function will calculate the perimeters of all the faces, and plot the histogram. You don't want to include all the faces, just those that include close enough vertices. Here is an example of such a histogram:
In this histogram, the reasonable cutoff will be ~30, which is exactly the mean + std. In such a case, you won't need to set the cutoff manually. In a case you want to choose a different value, 40 for example, you'll need to use the --perim_threshld flag:
python -m preproc.create_mesh -d file-name -r root-fol -f plot_perim_hist --perim_threshld 40
Now, you are ready to create the mesh file (using the same call without the --perim_threshld flag). That will create the following files:
- file-name.blend - The blender empty file. This is the file you should open with Blender after running the preprocessing.
- file-name.ply - The Blender mesh file
- file-name_values.npy - The original values saved as a Nx1 numpy matrix
- file-name_faces_verts.npy - A numpy matrix that will be used in Blender to color the mesh.
The function will also check if you have colors maps files under your root-fol/cm folder. If not, it'll create this folder and copy the color maps.