Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dolfin_warp
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.6.
Show more breadcrumbs
Martin Genet
dolfin_warp
Commits
3d88ef07
Commit
3d88ef07
authored
8 years ago
by
Martin Genet
Browse files
Options
Downloads
Patches
Plain Diff
homogeneous deformation is now based on deformation gradient
parent
0ad52f41
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
generate_images.py
+25
-20
25 additions, 20 deletions
generate_images.py
with
25 additions
and
20 deletions
generate_images.py
+
25
−
20
View file @
3d88ef07
...
@@ -160,8 +160,8 @@ class Image():
...
@@ -160,8 +160,8 @@ class Image():
self
.
I0_noise
=
self
.
I0_noise_no
self
.
I0_noise
=
self
.
I0_noise_no
elif
(
noise
[
"
type
"
]
==
"
normal
"
):
elif
(
noise
[
"
type
"
]
==
"
normal
"
):
self
.
I0_noise
=
self
.
I0_noise_normal
self
.
I0_noise
=
self
.
I0_noise_normal
self
.
avg
=
noise
.
avg
if
(
"
avg
"
in
noise
.
keys
())
else
0.
self
.
avg
=
noise
[
"
avg
"
]
if
(
"
avg
"
in
noise
.
keys
())
else
0.
self
.
std
=
noise
.
std
self
.
std
=
noise
[
"
std
ev
"
]
else
:
else
:
assert
(
0
),
"
noise type must be
\"
no
\"
or
\"
normal
\"
. Aborting.
"
assert
(
0
),
"
noise type must be
\"
no
\"
or
\"
normal
\"
. Aborting.
"
...
@@ -271,15 +271,15 @@ class Mapping:
...
@@ -271,15 +271,15 @@ class Mapping:
self
.
init_t
=
self
.
init_t_no
self
.
init_t
=
self
.
init_t_no
self
.
X
=
self
.
X_no
self
.
X
=
self
.
X_no
self
.
x
=
self
.
x_no
self
.
x
=
self
.
x_no
elif
(
self
.
deformation
[
"
type
"
]
==
"
trans
"
):
elif
(
self
.
deformation
[
"
type
"
]
==
"
trans
lation
"
):
self
.
init_t
=
self
.
init_t_trans
self
.
init_t
=
self
.
init_t_trans
lation
self
.
X
=
self
.
X_trans
self
.
X
=
self
.
X_trans
lation
self
.
x
=
self
.
x_trans
self
.
x
=
self
.
x_trans
lation
self
.
D
=
numpy
.
empty
(
3
)
self
.
D
=
numpy
.
empty
(
3
)
elif
(
self
.
deformation
[
"
type
"
]
==
"
rot
"
):
elif
(
self
.
deformation
[
"
type
"
]
==
"
rot
ation
"
):
self
.
init_t
=
self
.
init_t_rot
self
.
init_t
=
self
.
init_t_rot
ation
self
.
X
=
self
.
X_rot
self
.
X
=
self
.
X_rot
ation
self
.
x
=
self
.
x_rot
self
.
x
=
self
.
x_rot
ation
self
.
C
=
numpy
.
empty
(
3
)
self
.
C
=
numpy
.
empty
(
3
)
self
.
R
=
numpy
.
empty
((
3
,
3
))
self
.
R
=
numpy
.
empty
((
3
,
3
))
self
.
Rinv
=
numpy
.
empty
((
3
,
3
))
self
.
Rinv
=
numpy
.
empty
((
3
,
3
))
...
@@ -301,7 +301,7 @@ class Mapping:
...
@@ -301,7 +301,7 @@ class Mapping:
self
.
Re
=
structure
[
"
Re
"
]
self
.
Re
=
structure
[
"
Re
"
]
self
.
R
=
numpy
.
empty
((
3
,
3
))
self
.
R
=
numpy
.
empty
((
3
,
3
))
else
:
else
:
assert
(
0
),
"
deformation type must be
\"
no
\"
,
\"
trans
\"
,
\"
rot
\"
,
\"
homogeneous
\"
or
\"
heart
\"
. Aborting.
"
assert
(
0
),
"
deformation type must be
\"
no
\"
,
\"
trans
lation
\"
,
\"
rot
ation
\"
,
\"
homogeneous
\"
or
\"
heart
\"
. Aborting.
"
if
(
evolution
[
"
type
"
]
==
"
linear
"
):
if
(
evolution
[
"
type
"
]
==
"
linear
"
):
self
.
phi
=
self
.
phi_linear
self
.
phi
=
self
.
phi_linear
...
@@ -320,12 +320,12 @@ class Mapping:
...
@@ -320,12 +320,12 @@ class Mapping:
def
init_t_no
(
self
,
t
):
def
init_t_no
(
self
,
t
):
pass
pass
def
init_t_trans
(
self
,
t
):
def
init_t_trans
lation
(
self
,
t
):
self
.
D
[
0
]
=
self
.
deformation
[
"
Dx
"
]
*
self
.
phi
(
t
)
if
(
"
Dx
"
in
self
.
deformation
.
keys
())
else
0.
self
.
D
[
0
]
=
self
.
deformation
[
"
Dx
"
]
*
self
.
phi
(
t
)
if
(
"
Dx
"
in
self
.
deformation
.
keys
())
else
0.
self
.
D
[
1
]
=
self
.
deformation
[
"
Dy
"
]
*
self
.
phi
(
t
)
if
(
"
Dy
"
in
self
.
deformation
.
keys
())
else
0.
self
.
D
[
1
]
=
self
.
deformation
[
"
Dy
"
]
*
self
.
phi
(
t
)
if
(
"
Dy
"
in
self
.
deformation
.
keys
())
else
0.
self
.
D
[
2
]
=
self
.
deformation
[
"
Dz
"
]
*
self
.
phi
(
t
)
if
(
"
Dz
"
in
self
.
deformation
.
keys
())
else
0.
self
.
D
[
2
]
=
self
.
deformation
[
"
Dz
"
]
*
self
.
phi
(
t
)
if
(
"
Dz
"
in
self
.
deformation
.
keys
())
else
0.
def
init_t_rot
(
self
,
t
):
def
init_t_rot
ation
(
self
,
t
):
self
.
C
[
0
]
=
self
.
deformation
[
"
Cx
"
]
if
(
"
Cx
"
in
self
.
deformation
.
keys
())
else
0.
self
.
C
[
0
]
=
self
.
deformation
[
"
Cx
"
]
if
(
"
Cx
"
in
self
.
deformation
.
keys
())
else
0.
self
.
C
[
1
]
=
self
.
deformation
[
"
Cy
"
]
if
(
"
Cy
"
in
self
.
deformation
.
keys
())
else
0.
self
.
C
[
1
]
=
self
.
deformation
[
"
Cy
"
]
if
(
"
Cy
"
in
self
.
deformation
.
keys
())
else
0.
self
.
C
[
2
]
=
self
.
deformation
[
"
Cz
"
]
if
(
"
Cz
"
in
self
.
deformation
.
keys
())
else
0.
self
.
C
[
2
]
=
self
.
deformation
[
"
Cz
"
]
if
(
"
Cz
"
in
self
.
deformation
.
keys
())
else
0.
...
@@ -354,9 +354,14 @@ class Mapping:
...
@@ -354,9 +354,14 @@ class Mapping:
Ezx
=
self
.
deformation
[
"
Ezx
"
]
*
self
.
phi
(
t
)
if
(
"
Ezx
"
in
self
.
deformation
.
keys
())
else
0.
Ezx
=
self
.
deformation
[
"
Ezx
"
]
*
self
.
phi
(
t
)
if
(
"
Ezx
"
in
self
.
deformation
.
keys
())
else
0.
Eyz
=
self
.
deformation
[
"
Eyz
"
]
*
self
.
phi
(
t
)
if
(
"
Eyz
"
in
self
.
deformation
.
keys
())
else
0.
Eyz
=
self
.
deformation
[
"
Eyz
"
]
*
self
.
phi
(
t
)
if
(
"
Eyz
"
in
self
.
deformation
.
keys
())
else
0.
Ezy
=
self
.
deformation
[
"
Ezy
"
]
*
self
.
phi
(
t
)
if
(
"
Ezy
"
in
self
.
deformation
.
keys
())
else
0.
Ezy
=
self
.
deformation
[
"
Ezy
"
]
*
self
.
phi
(
t
)
if
(
"
Ezy
"
in
self
.
deformation
.
keys
())
else
0.
self
.
F
=
numpy
.
array
([[
math
.
sqrt
(
1.
+
Exx
),
Exy
,
Exz
],
self
.
F
=
numpy
.
array
([[
Exx
,
Exy
,
Exz
],
[
Eyx
,
math
.
sqrt
(
1.
+
Eyy
),
Eyz
],
[
Eyx
,
Eyy
,
Eyz
],
[
Ezx
,
Ezy
,
math
.
sqrt
(
1.
+
Ezz
)]])
[
Ezx
,
Ezy
,
Ezz
]])
self
.
F
*=
2
self
.
F
+=
numpy
.
eye
(
3
)
w
,
v
=
numpy
.
linalg
.
eig
(
self
.
F
)
#assert (numpy.diag(numpy.dot(numpy.dot(numpy.transpose(v), self.F), v)) == w).all(), str(numpy.dot(numpy.dot(numpy.transpose(v), self.F), v))+" ≠ "+str(numpy.diag(w))+". Aborting."
self
.
F
=
numpy
.
dot
(
numpy
.
dot
(
v
,
numpy
.
diag
(
numpy
.
sqrt
(
w
))),
numpy
.
transpose
(
v
))
self
.
Finv
=
numpy
.
linalg
.
inv
(
self
.
F
)
self
.
Finv
=
numpy
.
linalg
.
inv
(
self
.
F
)
def
init_t_heart
(
self
,
t
):
def
init_t_heart
(
self
,
t
):
...
@@ -374,11 +379,11 @@ class Mapping:
...
@@ -374,11 +379,11 @@ class Mapping:
X
[:]
=
x
X
[:]
=
x
#if (Finv is not None): Finv[:,:] = numpy.identity(numpy.sqrt(numpy.size(Finv)))
#if (Finv is not None): Finv[:,:] = numpy.identity(numpy.sqrt(numpy.size(Finv)))
def
X_trans
(
self
,
x
,
X
,
Finv
=
None
):
def
X_trans
lation
(
self
,
x
,
X
,
Finv
=
None
):
X
[:]
=
x
-
self
.
D
X
[:]
=
x
-
self
.
D
#if (Finv is not None): Finv[:,:] = numpy.identity(numpy.sqrt(numpy.size(Finv)))
#if (Finv is not None): Finv[:,:] = numpy.identity(numpy.sqrt(numpy.size(Finv)))
def
X_rot
(
self
,
x
,
X
,
Finv
=
None
):
def
X_rot
ation
(
self
,
x
,
X
,
Finv
=
None
):
X
[:]
=
numpy
.
dot
(
self
.
Rinv
,
x
-
self
.
C
)
+
self
.
C
X
[:]
=
numpy
.
dot
(
self
.
Rinv
,
x
-
self
.
C
)
+
self
.
C
#if (Finv is not None): Finv[:,:] = self.Rinv
#if (Finv is not None): Finv[:,:] = self.Rinv
...
@@ -430,11 +435,11 @@ class Mapping:
...
@@ -430,11 +435,11 @@ class Mapping:
x
[:]
=
X
x
[:]
=
X
#if (F is not None): F[:,:] = numpy.identity(numpy.sqrt(numpy.size(F)))
#if (F is not None): F[:,:] = numpy.identity(numpy.sqrt(numpy.size(F)))
def
x_trans
(
self
,
X
,
x
,
F
=
None
):
def
x_trans
lation
(
self
,
X
,
x
,
F
=
None
):
x
[:]
=
X
+
self
.
D
x
[:]
=
X
+
self
.
D
#if (F is not None): F[:,:] = numpy.identity(numpy.sqrt(numpy.size(F)))
#if (F is not None): F[:,:] = numpy.identity(numpy.sqrt(numpy.size(F)))
def
x_rot
(
self
,
X
,
x
,
F
=
None
):
def
x_rot
ation
(
self
,
X
,
x
,
F
=
None
):
x
[:]
=
numpy
.
dot
(
self
.
R
,
X
-
self
.
C
)
+
self
.
C
x
[:]
=
numpy
.
dot
(
self
.
R
,
X
-
self
.
C
)
+
self
.
C
#if (F is not None): F[:,:] = self.R
#if (F is not None): F[:,:] = self.R
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment