Package gov.nih.mipav.model.algorithms
Class Confmap
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.Confmap
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class Confmap extends AlgorithmBase
MIT License Copyright (c) 2022 Ruslan Guseinov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Implementation of conformal mapping methods CETM and BFF. Based on papers [Conformal Equivalence of Triangle Meshes](https://dl.acm.org/doi/10.1145/1360612.1360676), B. Springborn, P. Schröder, U. Pinkall, *ACM Transactions on Graphics* (2008) and [Boundary First Flattening](https://dl.acm.org/doi/10.1145/3132705), R. Sawhney, K. Crane, *ACM Transactions on Graphics* (2018). ## Usage example Read an OBJ file from data folder, generate a minimum distortion conformal map using BFF method, and output the original mesh with the UV conformal map as a new OBJ file. vertices, faces = read_obj('../data/bumpcap.obj') cm = BFF(vertices, faces) image = cm.layout() write_obj('bumpcap_with_uv.obj', cm.vertices, cm.faces, image.vertices, image.faces)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classConfmap.BFF(package private) classConfmap.CETM(package private) classConfmap.confMapprivate classConfmap.indexValComparatorprivate classConfmap.indexValItemprivate classConfmap.indexValueComparatorprivate classConfmap.indexValueItem(package private) classConfmap.NewtonSolver(package private) classConfmap.Pair<T,U>(package private) classConfmap.ParametricCircle(package private) classConfmap.ParametricCurve(package private) classConfmap.TriangleMesh
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]_clausen1(package private) double[]_clausen2(package private) double[][]_MX-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description Confmap()Confmap - default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) double[]chebyshev(double[] x, double[] coeff)(package private) double[]clausen(double[] x)(package private) double[]compute_exterior_angles_2d(double[][] points, boolean ccw)int[][]compute_mesh_edges(int[][] face_edges, java.util.Vector<int[]> boundary_loops, int[][] faces, boolean only_manifold)(package private) voidconformal_equivalence(double[] u, double[] u_err, double[][] points, int[][] faces, double[][][] image_points)int[][]cut_faces(int[][] original_faces, java.util.Vector<java.lang.Integer> start_vertices, java.util.HashMap<java.lang.Integer,java.util.HashSet<java.lang.Integer>> cut_tree)voiddemo_tools(java.lang.String file_name, java.lang.String method, java.lang.String output)voidface_face_adjacency(int[][] face_face, int[][] face_face_ind, int[][] faces)voidfinalize()finalize -int[]get_vertex_faces(int[][] ff, int[][] ffi, int[] vf, int[] vfi, int vertex_id)(package private) double[][]inverse3by3(double[][] A)(package private) booleanisclose(double a, double b, double rtol, double atol, boolean equal_nan)(package private) double[]lobachevsky(double[] x)voidmain_demo()Confmap.BFFmake_BFF_confmap(java.lang.String file_name, java.lang.String mode)Confmap.CETMmake_CETM_confmap(java.lang.String file_name, java.lang.String mode)(package private) doublemedian(double[] nums)(package private) double[][]mobius_normalize_layout(double[][] uvoriginal, double eps, int max_iter)(package private) double[]quantize_value(double[] value, double quant)(package private) doublequantize_value(double value, double quant)double[]quasi_conformal_error_map(double[][][] source_points, double[][][] image_points)voidread_obj(java.util.Vector<double[]> vertices, java.util.Vector<int[]> faces, java.lang.String file_path)(package private) double[]remainder(double[] x, double val)(package private) doubleremainder(double x, double val)voidrunAlgorithm()Starts the program.voidsimple_demo()voidtest_boundary_loops()voidtest_clausen()voidtest_face_face_adjacency()voidtest_quantize_value()voidtest_read_write_obj()voidtest_tri_angles()double[][]tri_angles(double[][] lengths, boolean ineq_violation)voidwrite_obj(java.lang.String file_path, double[][] vertices, int[][] faces, double[][] uvs, int[][] uv_faces)voidwrite_obj(java.util.Vector<double[]> vertices, java.util.Vector<int[]> faces, java.lang.String file_path)-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
finalize
public void finalize()
finalize -- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithmin classAlgorithmBase
-
test_quantize_value
public void test_quantize_value()
-
test_clausen
public void test_clausen()
-
test_tri_angles
public void test_tri_angles()
-
test_read_write_obj
public void test_read_write_obj()
-
test_boundary_loops
public void test_boundary_loops()
-
test_face_face_adjacency
public void test_face_face_adjacency()
-
quantize_value
double[] quantize_value(double[] value, double quant)
-
quantize_value
double quantize_value(double value, double quant)
-
isclose
boolean isclose(double a, double b, double rtol, double atol, boolean equal_nan)
-
chebyshev
double[] chebyshev(double[] x, double[] coeff)
-
remainder
double[] remainder(double[] x, double val)
-
remainder
double remainder(double x, double val)
-
clausen
double[] clausen(double[] x)
-
lobachevsky
double[] lobachevsky(double[] x)
-
tri_angles
public double[][] tri_angles(double[][] lengths, boolean ineq_violation)
-
compute_exterior_angles_2d
double[] compute_exterior_angles_2d(double[][] points, boolean ccw)
-
mobius_normalize_layout
double[][] mobius_normalize_layout(double[][] uvoriginal, double eps, int max_iter)
-
inverse3by3
double[][] inverse3by3(double[][] A)
-
median
double median(double[] nums)
-
quasi_conformal_error_map
public double[] quasi_conformal_error_map(double[][][] source_points, double[][][] image_points)
-
conformal_equivalence
void conformal_equivalence(double[] u, double[] u_err, double[][] points, int[][] faces, double[][][] image_points)
-
read_obj
public void read_obj(java.util.Vector<double[]> vertices, java.util.Vector<int[]> faces, java.lang.String file_path)
-
write_obj
public void write_obj(java.util.Vector<double[]> vertices, java.util.Vector<int[]> faces, java.lang.String file_path)
-
write_obj
public void write_obj(java.lang.String file_path, double[][] vertices, int[][] faces, double[][] uvs, int[][] uv_faces)
-
compute_mesh_edges
public int[][] compute_mesh_edges(int[][] face_edges, java.util.Vector<int[]> boundary_loops, int[][] faces, boolean only_manifold)
-
face_face_adjacency
public void face_face_adjacency(int[][] face_face, int[][] face_face_ind, int[][] faces)
-
get_vertex_faces
public int[] get_vertex_faces(int[][] ff, int[][] ffi, int[] vf, int[] vfi, int vertex_id)
-
cut_faces
public int[][] cut_faces(int[][] original_faces, java.util.Vector<java.lang.Integer> start_vertices, java.util.HashMap<java.lang.Integer,java.util.HashSet<java.lang.Integer>> cut_tree)
-
simple_demo
public void simple_demo()
-
main_demo
public void main_demo()
-
demo_tools
public void demo_tools(java.lang.String file_name, java.lang.String method, java.lang.String output)
-
make_BFF_confmap
public Confmap.BFF make_BFF_confmap(java.lang.String file_name, java.lang.String mode)
-
make_CETM_confmap
public Confmap.CETM make_CETM_confmap(java.lang.String file_name, java.lang.String mode)
-
-