diff --git a/README.md b/README.md index 19026395..53ad2880 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,8 @@ M. K. Ahn, J. D. Tucker, W. Wu, and A. Srivastava. “Regression Models Using Sh J. D. Tucker, L. Shand, and K. Chowdhary. “Multimodal Bayesian Registration of Noisy Functions using Hamiltonian Monte Carlo”, Computational Statistics and Data Analysis, accepted, 2021. +Q. Xie, S. Kurtek, E. Klassen, G. E. Christensen and A. Srivastava. Metric-based pairwise and multiple image registration. IEEE European Conference on Computer Vision (ECCV), September, 2014 + X. Zhang, S. Kurtek, O. Chkrebtii, and J. D. Tucker, “Elastic k-means clustering of functional data for posterior exploration, with an application to inference on acute respiratory infection dynamics”, arXiv:2011.12397 [stat.ME], 2020. diff --git a/bin/ex_image_align.py b/bin/ex_image_align.py new file mode 100644 index 00000000..621833a2 --- /dev/null +++ b/bin/ex_image_align.py @@ -0,0 +1,53 @@ +#%% +import fdasrsf as fs +import numpy as np +from scipy.io import loadmat +import matplotlib.pyplot as plt + +dat = loadmat('image.mat') +I1 = dat['I1'] +I2 = dat['I2'] + +(m,n) = I1.shape + +I1 -= I1.min() +I1 /= I1.max() + +I2 -= I2.min() +I2 /= I2.max() + +F1 = np.zeros((m,n,2)) +F1[:,:,1],F1[:,:,0] = np.gradient(I1, 1/699,1/699) +F2 = np.zeros((m,n,2)) +F2[:,:,1],F2[:,:,0] = np.gradient(I2, 1/699,1/699) + +F1 -= F1.min() +F1 /= F1.max() + +F2 -= F2.min() +F2 /= F2.max() + +# %% +M = 10 +b = fs.formbasisTid(M, m, n, 't') + +gamnew,Inew,H,stepsize = fs.reparam_image(F1,F2,None,b,stepsize=1e-2, itermax=1000) + +I2_new = fs.apply_gam_imag(I2,gamnew) + +plt.figure() +ax1 = plt.subplot(131) +plt.imshow(I1) +plt.title('I1'); +ax1 = plt.subplot(132) +plt.imshow(I2) +plt.title('I2'); +ax1 = plt.subplot(133) +plt.imshow(I2_new) +plt.title('I2 Warped'); + +plt.figure() +gamid = fs.makediffeoid(m,n) +plt.quiver(gamid[:,:,0],gamid[:,:,1],gamid[:,:,0]-gamnew[:,:,0],gamid[:,:,1]-gamnew[:,:,1]) + +# %% diff --git a/bin/image.mat b/bin/image.mat new file mode 100644 index 00000000..93dfe85d Binary files /dev/null and b/bin/image.mat differ diff --git a/doc/build/html/_modules/boxplots.html b/doc/build/html/_modules/boxplots.html index aaed1327..ab96a4e8 100644 --- a/doc/build/html/_modules/boxplots.html +++ b/doc/build/html/_modules/boxplots.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • diff --git a/doc/build/html/_modules/geodesic.html b/doc/build/html/_modules/geodesic.html index 754a76bf..03144069 100644 --- a/doc/build/html/_modules/geodesic.html +++ b/doc/build/html/_modules/geodesic.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • @@ -104,7 +108,11 @@

    Source code for geodesic

     
     
     
    [docs]def plot_geod(path): +<<<<<<< HEAD r""" +======= + r""" +>>>>>>> image Plots the geodesic path as a sequence of curves :param path: numpy ndarray of shape (2,M,K) of M sample points of K samples along path @@ -210,7 +218,11 @@

    Source code for geodesic

     
     
     
    [docs]def path_straightening(beta1, beta2, betamid=None, init="rand", T=100, k=5): +<<<<<<< HEAD """ +======= + """ +>>>>>>> image Perform path straightening to find geodesic between two shapes in either the space of closed curves or the space of affine standardized curves. This algorithm follows the steps outlined in section 4.6 of the diff --git a/doc/build/html/_modules/index.html b/doc/build/html/_modules/index.html index 36061318..fd3e6bcf 100644 --- a/doc/build/html/_modules/index.html +++ b/doc/build/html/_modules/index.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • @@ -93,7 +97,11 @@

    All modules for which code is available

  • fPCA
  • fPLS
  • geodesic
  • +<<<<<<< HEAD
  • kmeans
  • +======= +
  • image
  • +>>>>>>> image
  • pcr_regression
  • regression
  • time_warping
  • diff --git a/doc/build/html/_modules/time_warping.html b/doc/build/html/_modules/time_warping.html index 8676a946..598508d6 100644 --- a/doc/build/html/_modules/time_warping.html +++ b/doc/build/html/_modules/time_warping.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • diff --git a/doc/build/html/_modules/tolerance.html b/doc/build/html/_modules/tolerance.html index 04055731..905ecd18 100644 --- a/doc/build/html/_modules/tolerance.html +++ b/doc/build/html/_modules/tolerance.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • @@ -104,7 +108,11 @@

    Source code for tolerance

     
     
     
    [docs]def bootTB(f, time, a=0.05, p=.99, B=500, no=5, parallel=True): +<<<<<<< HEAD """ +======= + """ +>>>>>>> image This function computes tolerance bounds for functional data containing phase and amplitude variation using bootstrap sampling diff --git a/doc/build/html/_modules/utility_functions.html b/doc/build/html/_modules/utility_functions.html index 7d46d577..a595f174 100644 --- a/doc/build/html/_modules/utility_functions.html +++ b/doc/build/html/_modules/utility_functions.html @@ -54,7 +54,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • diff --git a/doc/build/html/_sources/index.rst.txt b/doc/build/html/_sources/index.rst.txt index ab1d9614..a50c824e 100644 --- a/doc/build/html/_sources/index.rst.txt +++ b/doc/build/html/_sources/index.rst.txt @@ -28,7 +28,11 @@ using functional component analysis and regression. pcr_regression.rst elastic_glm_regression.rst tolerance.rst +<<<<<<< HEAD kmeans.rst +======= + image.rst +>>>>>>> image curve_statistics.rst geodesic.rst utility_functions.rst @@ -107,6 +111,8 @@ References for posterior exploration, with an application to inference on acute respiratory infection dynamics”, arXiv:2011.12397 [stat.ME], 2020. + Q. Xie, S. Kurtek, E. Klassen, G. E. Christensen and A. Srivastava. Metric-based pairwise and multiple image registration. IEEE European Conference on Computer Vision (ECCV), September, 2014 + Indices and tables ================== diff --git a/doc/build/html/boxplots.html b/doc/build/html/boxplots.html index 2e2240ee..57145106 100644 --- a/doc/build/html/boxplots.html +++ b/doc/build/html/boxplots.html @@ -68,7 +68,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • diff --git a/doc/build/html/curve_functions.html b/doc/build/html/curve_functions.html index 8afdd00c..22aaed7b 100644 --- a/doc/build/html/curve_functions.html +++ b/doc/build/html/curve_functions.html @@ -56,7 +56,11 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • +======= +
  • Elastic Image Warping
  • +>>>>>>> image
  • Curve Registration
  • SRVF Geodesic Computation
  • Utility Functions
  • diff --git a/doc/build/html/curve_statistics.html b/doc/build/html/curve_statistics.html index a2cfeabd..0688196b 100644 --- a/doc/build/html/curve_statistics.html +++ b/doc/build/html/curve_statistics.html @@ -23,7 +23,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> image @@ -58,6 +62,7 @@
  • Elastic Principal Component Regression
  • Elastic GLM Regression
  • Elastic Functional Tolerance Bounds
  • +<<<<<<< HEAD
  • Elastic Functional Clustering
  • Curve Registration
    • fdacurve
    • +======= +
    • Elastic Image Warping
    • +
    • Curve Registration
    • +>>>>>>> image
    • SRVF Geodesic Computation
    • Utility Functions
    • Curve Functions
    • @@ -296,9 +305,21 @@

      Examples +======= +