Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ixstools
xrstools
Commits
ae368178
Commit
ae368178
authored
Sep 24, 2020
by
myron
Browse files
aggiunto i fattori cdim per aggiustare separatamente la regolarizzazione sulle diverse direzioni
parent
cc5f7334
Changes
2
Hide whitespace changes
Inline
Side-by-side
XRStools/XRS_swissknife.py
View file @
ae368178
...
...
@@ -2601,9 +2601,7 @@ def superR_getVolume_Esynt(mydata):
print
(
" GROUPNAME "
,
scalprods_groupname
)
target_address
=
mydata
[
"target_address"
]
output_prefix
=
mydata
[
"output_prefix"
]
target_filename
,
target_groupname
=
split_hdf5_address
(
target_address
)
interpolation_dict
=
json
.
load
(
open
(
mydata
[
"dict_interp"
],
"r"
)
)
...
...
XRStools/superr.py
View file @
ae368178
...
...
@@ -57,7 +57,7 @@ def my_denoise_tv_chambolle_positive(image, weight=0.1, n_iter_max=200):
def
_denoise_tv_chambolle_nd
(
image
,
weight
=
0.1
,
eps
=
2.e-4
,
n_iter_max
=
200
,
positivity
=
False
):
positivity
=
False
,
cdim
=
None
):
"""Perform total-variation denoising on n-dimensional images.
Parameters
...
...
@@ -139,7 +139,10 @@ def _denoise_tv_chambolle_nd(image, weight=0.1, eps=2.e-4, n_iter_max=200,
slices_d
[
ax
]
=
slice
(
1
,
None
)
slices_p
[
ax
+
1
]
=
slice
(
0
,
-
1
)
slices_p
[
0
]
=
ax
d
[
tuple
(
slices_d
)]
+=
p
[
tuple
(
slices_p
)]
if
cdim
is
None
:
d
[
tuple
(
slices_d
)]
+=
p
[
tuple
(
slices_p
)]
else
:
d
[
tuple
(
slices_d
)]
+=
p
[
tuple
(
slices_p
)]
*
cdim
[
ax
]
slices_d
[
ax
]
=
slice
(
None
)
slices_p
[
ax
+
1
]
=
slice
(
None
)
out_nopos
=
image
+
d
...
...
@@ -161,7 +164,11 @@ def _denoise_tv_chambolle_nd(image, weight=0.1, eps=2.e-4, n_iter_max=200,
for
ax
in
range
(
ndim
):
slices_g
[
ax
+
1
]
=
slice
(
0
,
-
1
)
slices_g
[
0
]
=
ax
g
[
tuple
(
slices_g
)]
=
np
.
diff
(
out
,
axis
=
ax
)
if
cdim
is
None
:
g
[
tuple
(
slices_g
)]
=
np
.
diff
(
out
,
axis
=
ax
)
else
:
g
[
tuple
(
slices_g
)]
=
np
.
diff
(
out
,
axis
=
ax
)
*
cdim
[
ax
]
slices_g
[
ax
+
1
]
=
slice
(
None
)
norm
=
np
.
sqrt
((
g
**
2
).
sum
(
axis
=
0
))[
np
.
newaxis
,
...]
...
...
@@ -242,7 +249,7 @@ def Fista( scalDD, scalDS , scalSS, solution , niter=500, beta=0.1 ):
solution
[:]
=
y
-
grad
/
Lip
# solution[:]=skimage.restoration.denoise_tv_chambolle(solution, weight=beta, eps=0.000002)
solution
[:]
=
_denoise_tv_chambolle_nd
(
solution
,
weight
=
beta
,
eps
=
0.000002
,
positivity
=
True
)
solution
[:]
=
_denoise_tv_chambolle_nd
(
solution
,
weight
=
beta
,
eps
=
0.000002
,
positivity
=
True
,
cdim
=
[
0
,
0
,
1
]
)
## solution[:] = np.maximum(solution, 0)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment