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:
ActionListener,WindowListener,Runnable,EventListener
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 ClassesModifier and TypeClassDescription(package private) class(package private) class(package private) classprivate classprivate classprivate classprivate class(package private) class(package private) class(package private) class(package private) class(package private) classNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescription(package private) double[](package private) double[](package private) double[][]Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(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, 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, Vector<Integer> start_vertices, HashMap<Integer, HashSet<Integer>> cut_tree) voiddemo_tools(String file_name, String method, 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) voidmake_BFF_confmap(String file_name, String mode) make_CETM_confmap(String file_name, 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) void(package private) double[]remainder(double[] x, double val) (package private) doubleremainder(double x, double val) voidStarts the program.voidvoidvoidvoidvoidvoidvoiddouble[][]tri_angles(double[][] lengths, boolean ineq_violation) voidvoidMethods 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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
_clausen1
double[] _clausen1 -
_clausen2
double[] _clausen2 -
_MX
double[][] _MX
-
-
Constructor Details
-
Confmap
public Confmap()Confmap - default constructor.
-
-
Method Details
-
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
-
write_obj
-
write_obj
public void write_obj(String file_path, double[][] vertices, int[][] faces, double[][] uvs, int[][] uv_faces) -
compute_mesh_edges
public int[][] compute_mesh_edges(int[][] face_edges, 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
-
simple_demo
public void simple_demo() -
main_demo
public void main_demo() -
demo_tools
-
make_BFF_confmap
-
make_CETM_confmap
-