# Geodesic Regression on Sphere Manifold
# Manifolds
import manifolds
import numpy as np
import StatsModel as sm

import matplotlib.pyplot as plt
# Visualization
import vtk

# Parameters
nDimManifold = 3

# Ground Truth
p_interp = manifolds.sphere(nDimManifold)
v_slope = manifolds.sphere_tVec(nDimManifold)

p_interp.SetPoint([0.0, 0.0, 1.0])
v_slope.SetTangentVector([0, np.pi * 0.25, 0])

# Generating sphere manifolds. distributed over time perturbed by Gaussian random
# Time
t0 = 0
t1 = 2.0

# Generate a random point on the manifold
nData = 500
dim = nDimManifold
sigma = 0.1

pt_list = []
# Generating sphere manifolds. distributed over time perturbed by Gaussian random
# Time
t0 = 0
t1 = 2

# Generate a random point on the manifold
# Parameters
nDimManifold = 3
nData = 200
dim = nDimManifold
sigma = 0.15

# Ground Truth
p_interp = manifolds.sphere(nDimManifold)
v_slope = manifolds.sphere_tVec(nDimManifold)

p_interp.SetPoint([0.0, 0.0, 1.0])
v_slope.SetTangentVector([0, np.pi * 0.25, 0])

# Point List
# Base Function ( Geodesic )
pt_list = []

# Projected sin on the base point function at time t
pt_list_proj_sin = []

# Time List
t_list = []

# Points Generation over a sin function
Beispiel #3
0
nDimManifold = 3

nData_1 = 300
nData_2 = 300
nData = nData_1 + nData_2

# Data Noise Parameter
pt_sigma = 0.05

## Time
t0 = 0.0
t1 = 1.0

# Ground Truth
beta0 = manifolds.sphere(nDimManifold)
beta1 = manifolds.sphere_tVec(nDimManifold)
beta2 = manifolds.sphere_tVec(nDimManifold)

# Intercept Point
# beta0.SetPoint( [ 0.94644084, 0.00146423, -0.32287396 ] )
# beta0.SetPoint( [ np.sqrt( 0.28 ), 0.6, 0.6  ] )
beta0.SetPoint([1.0, 0.0, 0.0])

# A tangent vector for different sex
beta1.SetTangentVector([0.0, 0.5, 0.0])

# A slope tangent vector for age
beta2.SetTangentVector([0.0, 0.0, 0.5])

# # Visualize group level grount truth
# Curve Visualization Parameter
Beispiel #4
0
    arrow_transform.Scale(length, length, length)
    arrow_transform.Update()

    transformPD = vtk.vtkTransformPolyDataFilter()
    transformPD.SetInputData(arrowBase.GetOutput())
    transformPD.SetTransform(arrow_transform)
    transformPD.Update()

    return transformPD.GetOutput()


# Base Intercept Point
beta0 = manifolds.sphere(nDimManifold)
beta0.SetPoint([1, 0, 0])

gamma1 = manifolds.sphere_tVec(nDimManifold)
gamma1.SetTangentVector([0.0, -0.3, 0.0])

tVec_to_f_i = manifolds.sphere_tVec(nDimManifold)
tVec_to_f_i.SetTangentVector([0.0, -1.0, 0.0])

f_i = beta0.ExponentialMap(tVec_to_f_i)
# f_i.SetPoint( [ 0, 1, 0 ] )

gamma1_f_i = beta0.ParallelTranslateAtoB(beta0, f_i, gamma1)

pt_sigma = 0.15

# Draw beta0 to f_i - Main Geodesic
nLineTimePt = 100
t1 = 1.0
Beispiel #5
0
# Parameters
nDimManifold = 3

nData_1 = 500
nData_2 = 500
nData_g = 100

nData = nData_1 + nData_2

# Data Noise Parameter
pt_sigma = 0.05

# Ground Truth
beta0 = manifolds.sphere(nDimManifold)
beta1 = manifolds.sphere_tVec(nDimManifold)
beta2 = manifolds.sphere_tVec(nDimManifold)
beta3 = manifolds.sphere_tVec(nDimManifold)
beta4 = manifolds.sphere_tVec(nDimManifold)

# Intercept Point
# beta0.SetPoint( [ 0.94644084, 0.00146423, -0.32287396 ] )
beta0.SetPoint([1.0, 0.0, 0.0])

## Time
t0 = 0.0
t1 = 60.0

## CAG Repeath Length
c0 = 0.0
c1 = 20.0
import manifolds
import numpy as np
import StatsModel as sm

# Visualization
import vtk

# Time
import time

# Parameters
nDimManifold = 3

# Ground Truth
p_interp = manifolds.sphere(nDimManifold)
v_slope = manifolds.sphere_tVec(nDimManifold)

p_interp.SetPoint([0.0, 0.0, 1.0])
v_slope.SetTangentVector([0, np.pi * 0.25, 0])

# Generating sphere manifolds. distributed over time perturbed by Gaussian random
# Time
t0 = 0
t1 = 2

# Generate a random point on the manifold
nData = 15
dim = nDimManifold
sigma = 0.15

pt_list = []
import manifolds
import numpy as np
import StatsModel as sm

# Visualization
import vtk

# Parameters
nDimManifold = 3

# Mean Interpolation Point
p_interp = manifolds.sphere(nDimManifold)
p_interp.SetPoint([0.0, 0.0, 1.0])

# Mean Slope Tangent Vector
v_slope = manifolds.sphere_tVec(nDimManifold)
v_slope.SetTangentVector([0, np.pi * 0.25, 0])

# Mean Interpolation Point / Mean Slope Tangent Vector - VTK PolyData Line
nTimePt = 100
t1 = 1.0
t0 = 0

meanLinePointsArr = []

for n in range(nTimePt):
    time_pt = (t1 - t0) * n / (nTimePt - 1) + t0

    # Generate a random Gaussians with polar Box-Muller Method
    v_t = manifolds.sphere_tVec(nDimManifold)
    v_t.SetTangentVector([
Beispiel #8
0
#####################################################
# Generating sphere manifolds. distributed over time perturbed by Gaussian random
# Time
t0 = 0
t1 = 2

# Generate a random point on the manifold
# Parameters
nDimManifold = 3
nData = 200
dim = nDimManifold
sigma = 0.15

# Population Bias
p_bias = manifolds.sphere(nDimManifold)
v_bias = manifolds.sphere_tVec(nDimManifold)

p_bias.SetPoint([0.0, 0.0, 1.0])
v_bias.SetTangentVector([0, np.pi * 0.1, 0])

bias_param_t0 = 0.0
bias_param_t1 = 3.0

nSubj = 10
bias_step = (bias_param_t1 - bias_param_t0) / float(nSubj - 1)

# Subject-wise Ground Truth
subj_t0 = -0.5
subj_t1 = 0.5

v_subj_slope_base = manifolds.sphere_tVec(nDimManifold)
import manifolds 
import numpy as np
import StatsModel as sm

import matplotlib.pyplot as plt
# Visualization
import vtk

# Parameters
nDimManifold = 3


# Group Level Parameters
## Ground Truth
p0 = manifolds.sphere( nDimManifold )
v0 = manifolds.sphere_tVec( nDimManifold )

## Random interpolation - mean
# p0.SetPoint( [ -1.0, 0.0, 0.0 ] )

# p0 = sm.GaussianNoisePerturbation( p0, 2.0 )

# Mean Interpolation Point - Fixed for Experiment
p0.SetPoint( [ 0.94644084, 0.00146423, -0.32287396 ] )

print( p0.pt )

## Time
t0 = 0.0
t1 = 60.0
Beispiel #10
0
print( eucl_tVec_r.nDim )
print( eucl_tVec_r.Type )

eucl_pt = manifolds.euclidean( 3 )
eucl_pt.SetPoint( [ 3, 1, 5 ] )
eucl_pt.Write( "eucl.rpt" )

eucl_pt_r = manifolds.euclidean( 3 )
eucl_pt_r.Read( "eucl.rpt" )

print( eucl_pt_r.pt )
print( eucl_pt_r.nDim ) 
print( eucl_pt_r.Type )

# Sphere
sphere_tVec = manifolds.sphere_tVec( 3 )
sphere_tVec.SetTangentVector( [ 0, 0.8192, 0 ] ) 

sphere_tVec.Write( "sphere_tVec.tvec" )

sphere_tVec_r = manifolds.sphere_tVec( 3 )
sphere_tVec_r.Read( "sphere_tVec.tvec" )

print( sphere_tVec_r.tVector )
print( sphere_tVec_r.nDim )
print( sphere_tVec_r.Type )

sphere_pt = manifolds.sphere( 3 )
sphere_pt.SetPoint( [ 0.0, 1.0, 0.0 ] )
sphere_pt.Write( "sphere.rpt" )
Beispiel #11
0
# Generating sphere manifolds. distributed over time perturbed by Gaussian random
# Time
t0 = 0	
t1 = 2

# Generate a random point on the manifold
# Parameters
nDimManifold = 3
nData = 500
dim = nDimManifold
sigma = 0.15

# Ground Truth
p_interp = manifolds.sphere( nDimManifold )
v_slope = manifolds.sphere_tVec( nDimManifold )

p_interp.SetPoint( [ 0.0, 0.0, 1.0 ] )
v_slope.SetTangentVector( [ 0, np.pi * 0.25, 0 ] )

# Point List
# Base Function ( Geodesic )
pt_list = []

# Added sin on the first axis
pt_list_add_sin = []

# Projected sin on the base point function at time t
pt_list_proj_sin = []

## Point List - Sin Function: Parallel Transported
Beispiel #12
0
# Time Interval
t_int0 = 0.5
t_int1 = 2

# Number of Observations
nObs0 = 2
nObs1 = 5

# # Visualize group level grount truth
# Curve Visualization Parameter
nLineTimePt = 100

# Ground Truth
# Intercept Coefficeints
beta0 = manifolds.sphere(nDimManifold)
beta1 = manifolds.sphere_tVec(nDimManifold)
beta2 = manifolds.sphere_tVec(nDimManifold)

# Intercept Point
beta0.SetPoint([1.0, 0.0, 0.0])

# A tangent vector for different sex
beta1.SetTangentVector([0.0, 0.2, 0.0])

# A tangent vector for CAG repeat length
# beta2.SetTangentVector( [ 0.0, 0.05, 0.0 ] )
beta2.SetTangentVector([0.0, 0.0, 0.15])

# beta2.SetTangentVector( [ 0.0, 0.0, -0.2 ] )

# Slope Coefficients
Beispiel #13
0
import numpy as np
import StatsModel as sm

import matplotlib.pyplot as plt
# Visualization
import vtk

# Parameters
nDimManifold = 3


# Group Level Parameters
## Ground Truth
p0 = manifolds.sphere( nDimManifold )

v0 = manifolds.sphere_tVec( nDimManifold )
v1 = manifolds.sphere_tVec( nDimManifold )

## Random interpolation - mean
# p0.SetPoint( [ -1.0, 0.0, 0.0 ] )

# p0 = sm.GaussianNoisePerturbation( p0, 2.0 )

# Mean Interpolation Point - Fixed for Experiment
p0.SetPoint( [ np.sqrt( 0.28 ), 0.6, 0.6  ] )

print( p0.pt )

## Time
t0 = 0.0
t1 = 60.0