The function reconstruct
reconstructs outline
into spherical surface Reconstruct outline into spherical
surface.
retistruct::OutlineCommon
-> ReconstructedOutline
ol
Annotated outline
ol0
Original Annotated outline
Pt
Transformed cartesian mesh points
Tt
Transformed triangulation
Ct
Transformed links
Cut
Transformed links
Bt
Transformed binary vector representation of edge indices onto a binary vector representation of the indices of the points linked by the edge
Lt
Transformed lengths
ht
Transformed correspondences
u
Indices of unique points in untransformed space
U
Transformed indices of unique points in untransformed space
Rsett
Transformed rim set
i0t
Transformed marker
H
mapping from edges onto corresponding edges
Ht
Transformed mapping from edges onto corresponding edges
phi0
Rim angle
R
Radius of spherical template
lambda0
Longitude of pole on rim
lambda
Longitudes of transformed mesh points
phi
Latitudes of transformed mesh points
Ps
Location of mesh point on sphere in spherical coordinates
n
Number of mesh points
alpha
Weighting of areas in energy function
x0
Area cut-off coefficient
nflip0
Initial number flipped triangles
nflip
Final number flipped triangles
opt
Optimisation object
E.tot
Energy function including area
E.l
Energy function based on lengths alone
mean.strain
Mean strain
mean.logstrain
Mean log strain
debug
Debug function
loadOutline()
Load AnnotatedOutline into ReconstructedOutline object
ReconstructedOutline$loadOutline( ol, n = 500, alpha = 8, x0 = 0.5, plot.3d = FALSE, dev.flat = NA, dev.polar = NA, report = retistruct::report, debug = FALSE )
ol
AnnotatedOutline
object, containing the following information
n
Number of points in triangulation.
alpha
Area scaling coefficient
x0
Area cut-off coefficient
plot.3d
Whether to show 3D picture during optimisation.
dev.flat
Device to plot grid onto. Value of NA
(default)
means no plotting.
dev.polar
Device display projection. Value of NA (default) means no plotting.
report
Function to report progress.
debug
If TRUE
print extra debugging output
reconstruct()
Reconstruct Reconstruction proceeds in a number of stages:
The flat object is triangulated with at least n
triangles. This can introduce new vertices in the rim.
The triangulated object is stitched.
The stitched object is triangulated again, but this time it is not permitted to add extra vertices to the rim.
The corresponding points determined by the stitching process are merged to form a new set of merged points and a new triangulation.
The merged points are projected roughly to a sphere.
The locations of the points on the sphere are moved so as to minimise the energy function.
ReconstructedOutline$reconstruct( plot.3d = FALSE, dev.flat = NA, dev.polar = NA, report = getOption("retistruct.report") )
plot.3d
If TRUE
make a 3D plot in an RGL window
dev.flat
Device handle for plotting flatplot updates to. If
NA
don't make any flat plots
dev.polar
Device handle for plotting polar plot updates
to. If NA
don't make any polar plots.
report
Function to report progress.
Control
argument to pass to optim
mergePointsEdges()
Merge stitched points and edges.
Create merged and transformed versions (all suffixed with t
)
of a number of existing variables, as well
as a matrix Bt
, which maps a binary vector representation
of edge indices onto a binary vector representation of the
indices of the points linked by the edge.
Sets following fields
Pt
Transformed point locations
Tt
Transformed triangulation
Ct
Transformed connection set
Cut
Transformed symmetric connection set
Bt
Transformed binary vector representation
of edge indices onto a binary vector representation of the
indices of the points linked by the edge
Lt
Transformed edge lengths
ht
Transformed correspondences
u
Indices of unique points in untransformed space
U
Transformed indices of unique points in untransformed space
Rset
The set of points on the rim (which has been reordered)
Rsett
Transformed set of points on rim
i0t
Transformed index of the landmark
H
mapping from edges onto corresponding edges
Ht
Transformed mapping from edges onto corresponding edges
ReconstructedOutline$mergePointsEdges()
projectToSphere()
Project mesh points in the flat outline onto a sphere
This takes the mesh points from the flat outline and maps them to
the curtailed sphere. It uses the area of the flat outline and
phi0
to determine the radius R
of the sphere. It
tries to get a good first approximation by using the function
stretchMesh
.
The following fields are set:
phi
Latitude of mesh points.
lmabda
Longitude of mesh points.
R
Radius of sphere.
ReconstructedOutline$projectToSphere()
getStrains()
Return strains edges are under in spherical retina Set information about how edges on the sphere have been deformed from their flat state.
ReconstructedOutline$getStrains()
A list containing two data frames flat
and spherical
.
Each data frame contains for each edge in the flat or spherical meshes:
L
Length of the edge in the flat outline
l
Length of the corresponding edge on the sphere
strain
The strain of each connection
logstrain
The logarithmic strain of each connection
optimiseMapping()
Optimise the mapping from the flat outline to the sphere
ReconstructedOutline$optimiseMapping( alpha = 4, x0 = 0.5, nu = 1, optim.method = "BFGS", plot.3d = FALSE, dev.flat = NA, dev.polar = NA, control = list() )
alpha
Area penalty scaling coefficient
x0
Area penalty cut-off coefficient
nu
Power to which to raise area
optim.method
Method to pass to optim
plot.3d
If TRUE
make a 3D plot in an RGL window
dev.flat
Device handle for plotting flatplot updates to. If
NA
don't make any flat plots
dev.polar
Device handle for plotting polar plot updates
to. If NA
don't make any polar plots.
control
Control argument to pass to optim
optimiseMappingCart()
Optimise the mapping from the flat outline to the sphere
ReconstructedOutline$optimiseMappingCart( alpha = 4, x0 = 0.5, nu = 1, method = "BFGS", plot.3d = FALSE, dev.flat = NA, dev.polar = NA, ... )
alpha
Area penalty scaling coefficient
x0
Area penalty cut-off coefficient
nu
Power to which to raise area
method
Method to pass to optim
plot.3d
If TRUE
make a 3D plot in an RGL window
dev.flat
Device handle for plotting grid to
dev.polar
Device handle for plotting polar plot to
...
Extra arguments to pass to fire
transformImage()
Transform an image into the reconstructed space
Transform an image into the reconstructed space. The four corner
coordinates of each pixel are transformed into spherical
coordinates and a mask matrix with the same dimensions as
im
is created. This has TRUE
for pixels that should
be displayed and FALSE
for ones that should not.
Sets the field
ims
Coordinates of corners of pixels in spherical coordinates
ReconstructedOutline$transformImage()
getIms()
Get coordinates of corners of pixels of image in spherical coordinates
ReconstructedOutline$getIms()
Coordinates of corners of pixels in spherical coordinates
getTearCoords()
Get location of tear coordinates in spherical coordinates
ReconstructedOutline$getTearCoords()
Location of tear coordinates in spherical coordinates
getFeatureSet()
ReconstructedOutline$getFeatureSet(type)
type
Base type of FeatureSet as string.
E.g. PointSet
returns a ReconstructedPointSet
reconstructFeatureSets()
Reconstruct any attached feature sets.
ReconstructedOutline$reconstructFeatureSets()
getPoints()
Get mesh points in spherical coordinates
ReconstructedOutline$getPoints()
Matrix with columns phi
(latitude) and lambda
(longitude)
mapFlatToSpherical()
Return location of point on sphere corresponding to point on the flat outline
ReconstructedOutline$mapFlatToSpherical(P)
P
Cartesian coordinates on flat outline as a matrix
with X
and Y
columns
clone()
The objects of this class are cloneable with this method.
ReconstructedOutline$clone(deep = FALSE)
deep
Whether to make a deep clone.