Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
a206b77a
Commit
a206b77a
authored
10 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
6D-Reconstruction: fixed some verbose output and calculation
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
0827355c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zUtil_Deformation/Gt6DBlobReconstructor.m
+50
-54
50 additions, 54 deletions
zUtil_Deformation/Gt6DBlobReconstructor.m
with
50 additions
and
54 deletions
zUtil_Deformation/Gt6DBlobReconstructor.m
+
50
−
54
View file @
a206b77a
...
@@ -98,7 +98,15 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -98,7 +98,15 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
otherwise
otherwise
iters
=
numIters
;
iters
=
numIters
;
end
end
tot_iters
=
numel
(
iters
);
tot_iters
=
numel
(
iters
);
if
(
self
.
verbose
)
result_slice
=
eps
(
'single'
)
.*
rand
(
size
(
self
.
currentSolution
{
1
},
1
),
...
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
vol_viewer
=
GtVolView
(
result_slice
);
end
for
ii
=
iters
for
ii
=
iters
numchars
=
fprintf
(
'%03d/%03d (in %f s)'
,
ii
-
min
(
iters
),
tot_iters
,
toc
(
c
));
numchars
=
fprintf
(
'%03d/%03d (in %f s)'
,
ii
-
min
(
iters
),
tot_iters
,
toc
(
c
));
...
@@ -136,22 +144,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -136,22 +144,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
proj_bls
=
gtMathsGetSameSizeZeros
(
self
.
blobs
);
[
value
,
summed_vols
]
=
self
.
compute_functional_value
(
p
,
'6DL1'
,
lambda
);
for
n
=
1
:
numel
(
self
.
currentSolution
)
ind
=
ii
/
sample_rate
;
proj_bls
=
self
.
fwd_project_volumes
(
...
self
.
normResiduals
(
ind
)
=
value
;
proj_bls
,
nextEnhancedSolution
{
n
},
n
);
end
half_slice
=
round
(
size
(
summed_vols
,
3
)
/
2
);
proj_bls
=
internal_cell_sub_assign
(
proj_bls
,
self
.
blobs
);
result_slice
(:,
:,
ind
)
=
summed_vols
(:,
:,
half_slice
);
self
.
normResiduals
(
ii
/
sample_rate
)
=
...
vol_viewer
.
changeVol
(
result_slice
);
internal_cell_square_norm
(
proj_bls
)
/
2
...
vol_viewer
.
changeSlice
(
ind
);
+
lambda
*
gtMathsNorm_l1
(
self
.
currentSolution
)
...
+
internal_cell_square_norm
(
p
)
/
2
...
+
internal_cell_dot_product
(
p
,
self
.
blobs
);
proj_bls
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
ctr_slice
=
round
(
size
(
proj_bls
,
3
)
/
2
);
figure
,
imagesc
(
proj_bls
(:,
:,
ctr_slice
)),
...
title
(
sprintf
(
'Slice: %d, Iteration: %d'
,
ctr_slice
,
ii
))
end
end
drawnow
();
drawnow
();
end
end
...
@@ -194,7 +194,15 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -194,7 +194,15 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
otherwise
otherwise
iters
=
numIters
;
iters
=
numIters
;
end
end
tot_iters
=
numel
(
iters
);
tot_iters
=
numel
(
iters
);
if
(
self
.
verbose
)
result_slice
=
eps
(
'single'
)
.*
rand
(
size
(
self
.
currentSolution
{
1
},
1
),
...
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
vol_viewer
=
GtVolView
(
result_slice
);
end
for
ii
=
iters
for
ii
=
iters
numchars
=
fprintf
(
'%03d/%03d (in %f s)'
,
ii
-
min
(
iters
),
tot_iters
,
toc
(
c
));
numchars
=
fprintf
(
'%03d/%03d (in %f s)'
,
ii
-
min
(
iters
),
tot_iters
,
toc
(
c
));
...
@@ -228,21 +236,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -228,21 +236,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
proj_bls
=
gtMathsGetSameSizeZeros
(
self
.
blobs
);
[
value
,
summed_vols
]
=
self
.
compute_functional_value
(
p
,
'6DLS'
);
for
n
=
1
:
numel
(
self
.
currentSolution
)
ind
=
ii
/
sample_rate
;
proj_bls
=
self
.
fwd_project_volumes
(
...
self
.
normResiduals
(
ind
)
=
value
;
proj_bls
,
nextEnhancedSolution
{
n
},
n
);
end
half_slice
=
round
(
size
(
summed_vols
,
3
)
/
2
);
proj_bls
=
internal_cell_sub_assign
(
proj_bls
,
self
.
blobs
);
result_slice
(:,
:,
ind
)
=
summed_vols
(:,
:,
half_slice
);
self
.
normResiduals
(
ii
/
sample_rate
)
=
...
vol_viewer
.
changeVol
(
result_slice
);
internal_cell_square_norm
(
proj_bls
)
/
2
...
vol_viewer
.
changeSlice
(
ind
);
+
internal_cell_square_norm
(
p
)
/
2
...
+
internal_cell_dot_product
(
p
,
self
.
blobs
);
proj_bls
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
ctr_slice
=
round
(
size
(
proj_bls
,
3
)
/
2
);
figure
,
imagesc
(
proj_bls
(:,
:,
ctr_slice
)),
...
title
(
sprintf
(
'Slice: %d, Iteration: %d'
,
ctr_slice
,
ii
))
end
end
drawnow
();
drawnow
();
end
end
...
@@ -289,7 +290,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -289,7 +290,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
tot_iters
=
numel
(
iters
);
tot_iters
=
numel
(
iters
);
if
(
self
.
verbose
)
if
(
self
.
verbose
)
result_slice
=
zeros
(
size
(
self
.
currentSolution
{
1
},
1
),
...
result_slice
=
eps
(
'single'
)
.*
rand
(
size
(
self
.
currentSolution
{
1
},
1
),
...
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
vol_viewer
=
GtVolView
(
result_slice
);
vol_viewer
=
GtVolView
(
result_slice
);
end
end
...
@@ -332,16 +333,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -332,16 +333,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
l
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
[
value
,
summed_vols
]
=
self
.
compute_functional_value
(
p
,
'6DTV'
);
sES
=
gtMathsGradient
(
l
/
numel
(
self
.
currentSolution
));
ind
=
ii
/
sample_rate
;
self
.
normResiduals
(
ii
/
sample_rate
)
=
...
self
.
normResiduals
(
ind
)
=
value
;
+
gtMathsNorm_l1
(
sES
)
...
+
internal_cell_dot_product
(
p
,
self
.
blobs
);
half_slice
=
round
(
size
(
summed_vols
,
3
)
/
2
);
result_slice
(:,
:,
ind
)
=
summed_vols
(:,
:,
half_slice
);
half_slice
=
round
(
size
(
l
,
3
)
/
2
);
result_slice
(:,
:,
ii
/
sample_rate
)
=
l
(:,
:,
half_slice
);
vol_viewer
.
changeVol
(
result_slice
);
vol_viewer
.
changeVol
(
result_slice
);
vol_viewer
.
changeSlice
(
i
i
/
sample_rate
);
vol_viewer
.
changeSlice
(
i
nd
);
end
end
drawnow
();
drawnow
();
end
end
...
@@ -389,7 +388,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -389,7 +388,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
tot_iters
=
numel
(
iters
);
tot_iters
=
numel
(
iters
);
if
(
self
.
verbose
)
if
(
self
.
verbose
)
result_slice
=
zeros
(
size
(
self
.
currentSolution
{
1
},
1
),
...
result_slice
=
eps
(
'single'
)
.*
rand
(
size
(
self
.
currentSolution
{
1
},
1
),
...
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
size
(
self
.
currentSolution
{
1
},
2
),
floor
(
tot_iters
/
sample_rate
));
vol_viewer
=
GtVolView
(
result_slice
);
vol_viewer
=
GtVolView
(
result_slice
);
end
end
...
@@ -437,17 +436,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -437,17 +436,14 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
fprintf
(
'%s'
,
repmat
(
sprintf
(
'\b'
),
1
,
numchars
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
if
(
self
.
verbose
&&
(
mod
(
ii
,
sample_rate
)
==
0
))
l
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
[
value
,
summed_vols
]
=
self
.
compute_functional_value
(
p
,
'6DTVL1'
,
lambda
);
sES
=
gtMathsGradient
(
l
/
numel
(
self
.
currentSolution
));
ind
=
ii
/
sample_rate
;
self
.
normResiduals
(
ii
/
sample_rate
)
=
...
self
.
normResiduals
(
ind
)
=
value
;
+
gtMathsNorm_l1
(
sES
)
...
+
internal_cell_dot_product
(
p
,
self
.
blobs
)
...
half_slice
=
round
(
size
(
summed_vols
,
3
)
/
2
);
+
lambda
*
gtMathsNorm_l1
(
self
.
currentSolution
);
result_slice
(:,
:,
ind
)
=
summed_vols
(:,
:,
half_slice
);
half_slice
=
round
(
size
(
l
,
3
)
/
2
);
result_slice
(:,
:,
ii
/
sample_rate
)
=
l
(:,
:,
half_slice
);
vol_viewer
.
changeVol
(
result_slice
);
vol_viewer
.
changeVol
(
result_slice
);
vol_viewer
.
changeSlice
(
i
i
/
sample_rate
);
vol_viewer
.
changeSlice
(
i
nd
);
end
end
drawnow
();
drawnow
();
end
end
...
@@ -570,7 +566,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -570,7 +566,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
end
end
end
end
function
[
value
,
summed_vols
]
=
compute_functional_value
(
self
,
algo
,
lambda
)
function
[
value
,
summed_vols
]
=
compute_functional_value
(
self
,
p
,
algo
,
lambda
)
value
=
internal_cell_dot_product
(
p
,
self
.
blobs
);
value
=
internal_cell_dot_product
(
p
,
self
.
blobs
);
if
(
any
(
strcmpi
(
algo
,
{
'6DLS'
,
'6DL1'
})))
if
(
any
(
strcmpi
(
algo
,
{
'6DLS'
,
'6DL1'
})))
...
@@ -585,7 +581,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
...
@@ -585,7 +581,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
summed_vols
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
summed_vols
=
gtMathsSumCellVolumes
(
self
.
currentSolution
);
if
(
any
(
strcmpi
(
algo
,
{
'6DTV'
,
'6DTVL1'
})))
if
(
any
(
strcmpi
(
algo
,
{
'6DTV'
,
'6DTVL1'
})))
sES
=
gtMathsGradient
(
l
/
numel
(
self
.
currentSolution
));
sES
=
gtMathsGradient
(
summed_vols
/
numel
(
self
.
currentSolution
));
value
=
value
+
gtMathsNorm_l1
(
sES
);
value
=
value
+
gtMathsNorm_l1
(
sES
);
end
end
...
...
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