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
0ebd4944
Commit
0ebd4944
authored
7 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
6D-cluster: fixed some 0-360 boundary problems
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
81299e38
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrain.m
+42
-22
42 additions, 22 deletions
zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrain.m
with
42 additions
and
22 deletions
zUtil_Deformation/gt6DCreateProjDataFromTwinnedGrain.m
+
42
−
22
View file @
0ebd4944
...
...
@@ -168,7 +168,7 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
blobs_uvw_boundaries
=
zeros
(
num_blobs
,
6
);
blobs_ids
=
zeros
(
num_blobs
,
1
);
base_counter
=
0
;
wa
s_selected
=
false
(
num_blobs
,
1
);
i
s_selected
=
false
(
num_blobs
,
1
);
blob_use_raw_images
=
false
(
num_blobs
,
1
);
blobs_etas
=
zeros
(
num_blobs
,
1
);
...
...
@@ -199,12 +199,17 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
blobs_etas
(
inds_bls
)
=
samp_ors
(
ii_g
)
.
allblobs
.
eta
(
inc_bls
);
blobs_ids
(
inds_bls
)
=
grs
(
ii_g
)
.
fwd_sim
(
conf
.
det_index
)
.
difspotID
;
wa
s_selected
(
inds_bls
)
=
grs
(
ii_g
)
.
proj
(
conf
.
det_index
)
.
selected
;
i
s_selected
(
inds_bls
)
=
grs
(
ii_g
)
.
proj
(
conf
.
det_index
)
.
selected
;
blob_use_raw_images
(
inds_bls
)
=
conf
.
use_raw_images
(
ii_g
);
base_counter
=
base_counter
+
num_bl_grain
;
end
% Transforming blob boundaries to blob center + halfwidth
blobs_uvw_center_width
=
[
...
blobs_uvw_boundaries
(:,
4
:
6
)
+
blobs_uvw_boundaries
(:,
1
:
3
),
...
blobs_uvw_boundaries
(:,
4
:
6
)
-
blobs_uvw_boundaries
(:,
1
:
3
)
]
/
2
;
is_merged
=
false
(
size
(
blobs_ids
));
% We will now scan for blobs which have the same ID and merge them
for
ii_b
=
1
:
num_blobs
...
...
@@ -214,10 +219,17 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
if
(
any
(
matches
))
merge_list
=
[
ii_b
;
ind_b_others
(
matches
)];
blobs_uvw_boundaries
(
ii_b
,
1
:
3
)
=
min
(
blobs_uvw_boundaries
(
merge_list
,
1
:
3
),
[],
1
);
blobs_uvw_boundaries
(
ii_b
,
4
:
6
)
=
max
(
blobs_uvw_boundaries
(
merge_list
,
4
:
6
),
[],
1
);
% making sure that every blobs is on the same side:
temp_bounds
=
blobs_uvw_boundaries
(
merge_list
,
:);
temp_bounds
(:,
[
3
6
])
=
gtGrainAnglesTabularFix360deg
(
...
temp_bounds
(:,
[
3
6
]),
blobs_uvw_center_width
(
ii_b
,
3
),
p
);
was_selected
(
ii_b
)
=
any
(
was_selected
(
merge_list
))
||
conf
.
always_select_shared
;
blobs_uvw_boundaries
(
ii_b
,
1
:
3
)
=
min
(
temp_bounds
(:,
1
:
3
),
[],
1
);
blobs_uvw_boundaries
(
ii_b
,
4
:
6
)
=
max
(
temp_bounds
(:,
4
:
6
),
[],
1
);
blobs_etas
(
ii_b
)
=
mean
(
blobs_etas
(
merge_list
));
is_selected
(
ii_b
)
=
any
(
is_selected
(
merge_list
))
||
conf
.
always_select_shared
;
if
(
conf
.
select_raw_shared
)
blob_use_raw_images
(
ii_b
)
=
any
(
blob_use_raw_images
(
merge_list
));
else
...
...
@@ -232,16 +244,13 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
blobs_uvw_boundaries
(
is_merged
,
:)
=
[];
blob_use_raw_images
(
is_merged
,
:)
=
[];
blobs_etas
(
is_merged
)
=
[];
was_selected
(
is_merged
)
=
[];
is_selected
(
is_merged
)
=
[];
blobs_uvw_center_width
(
is_merged
,
:)
=
[];
num_blobs
=
numel
(
all_blobs_list
);
fprintf
(
'Determining which blobs are close in UVW space: '
)
c
=
tic
();
% Transforming blob boundaries to blob center + halfwidth
blobs_uvw_center_width
=
[
...
blobs_uvw_boundaries
(:,
4
:
6
)
+
blobs_uvw_boundaries
(:,
1
:
3
),
...
blobs_uvw_boundaries
(:,
4
:
6
)
-
blobs_uvw_boundaries
(:,
1
:
3
)
]
/
2
;
% and now we scan for overlaps of blobs
is_merged
=
false
(
size
(
all_blobs_list
));
% We will now scan for blobs which have the same ID and merge them
...
...
@@ -269,14 +278,19 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
if
(
any
(
matches
))
merge_list
=
[
ii_b
;
ind_b_others
(
matches
)];
blobs_uvw_boundaries
(
ii_b
,
1
:
3
)
=
min
(
blobs_uvw_boundaries
(
merge_list
,
1
:
3
),
[],
1
);
blobs_uvw_boundaries
(
ii_b
,
4
:
6
)
=
max
(
blobs_uvw_boundaries
(
merge_list
,
4
:
6
),
[],
1
);
% making sure that every blobs is on the same side:
temp_bounds
=
blobs_uvw_boundaries
(
merge_list
,
:);
temp_bounds
(:,
[
3
6
])
=
gtGrainAnglesTabularFix360deg
(
...
temp_bounds
(:,
[
3
6
]),
blobs_uvw_center_width
(
ii_b
,
3
),
p
);
blobs_uvw_boundaries
(
ii_b
,
1
:
3
)
=
min
(
temp_bounds
(:,
1
:
3
),
[],
1
);
blobs_uvw_boundaries
(
ii_b
,
4
:
6
)
=
max
(
temp_bounds
(:,
4
:
6
),
[],
1
);
all_blobs_list
(
ii_b
)
=
merge_blobs
(
all_blobs_list
(
merge_list
),
blobs_uvw_center_width
(
ii_b
,
3
),
p
);
blobs_etas
(
ii_b
)
=
mean
(
blobs_etas
(
merge_list
));
wa
s_selected
(
ii_b
)
=
any
(
wa
s_selected
(
merge_list
))
||
conf
.
always_select_shared
;
i
s_selected
(
ii_b
)
=
any
(
i
s_selected
(
merge_list
))
||
conf
.
always_select_shared
;
if
(
conf
.
select_raw_shared
)
blob_use_raw_images
(
ii_b
)
=
any
(
blob_use_raw_images
(
merge_list
));
else
...
...
@@ -291,12 +305,16 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
% Updating structures, to remove merged blobs
all_blobs_list
(
is_merged
)
=
[];
blobs_uvw_boundaries
(
is_merged
,
:)
=
[];
blobs_uvw_center_width
(
is_merged
,
:)
=
[];
blob_use_raw_images
(
is_merged
,
:)
=
[];
wa
s_selected
(
is_merged
)
=
[];
i
s_selected
(
is_merged
)
=
[];
blobs_etas
(
is_merged
)
=
[];
num_blobs
=
numel
(
all_blobs_list
);
% updating center and halfwidth
blobs_uvw_center_width
=
[
...
blobs_uvw_boundaries
(:,
4
:
6
)
+
blobs_uvw_boundaries
(:,
1
:
3
),
...
blobs_uvw_boundaries
(:,
4
:
6
)
-
blobs_uvw_boundaries
(:,
1
:
3
)
]
/
2
;
% Fixing blobs' centers to be between 0-360
blobs_w_c
=
mod
(
blobs_uvw_center_width
(:,
3
),
num_images
);
blobs_uvw_boundaries
(:,
[
3
6
])
=
gtGrainAnglesTabularFix360deg
(
blobs_uvw_boundaries
(:,
[
3
6
]),
blobs_w_c
,
p
);
...
...
@@ -332,10 +350,12 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
matches_w_m
=
between
(
ondet_uvw
(
ii_o
,
3
)
-
num_images
,
blobs_uvw_boundaries
(:,
3
),
blobs_uvw_boundaries
(:,
6
));
matches_w_c
=
between
(
ondet_uvw
(
ii_o
,
3
),
blobs_uvw_boundaries
(:,
3
),
blobs_uvw_boundaries
(:,
6
));
matches_w_p
=
between
(
ondet_uvw
(
ii_o
,
3
)
+
num_images
,
blobs_uvw_boundaries
(:,
3
),
blobs_uvw_boundaries
(:,
6
));
matches_w
=
matches_w_m
|
matches_w_c
|
matches_w_p
;
matches
=
[
matches_uv
,
matches_w
];
matches
=
[
matches_uv
(:,
:,
[
1
1
1
]),
cat
(
3
,
matches_w_m
,
matches_w_c
,
matches_w_p
)]
;
matches
=
all
(
matches
,
2
)
;
matches
=
any
(
all
(
matches
,
2
),
3
);
if
(
any
(
matches
))
ii_b
=
find
(
matches
,
1
);
...
...
@@ -350,27 +370,27 @@ function [cl, estim_space_bbox_pix, estim_orient_bbox_rod] = gt6DCreateProjDataF
if
(
conf
.
always_select_shared
)
for
ii_b
=
1
:
num_blobs
wa
s_selected
(
ii_b
)
=
wa
s_selected
(
ii_b
)
||
(
numel
(
blobs_props
(
ii_b
)
.
ors
)
>
1
);
i
s_selected
(
ii_b
)
=
i
s_selected
(
ii_b
)
||
(
numel
(
blobs_props
(
ii_b
)
.
ors
)
>
1
);
end
end
% Filtering vertical blobs
eta_ok
=
acosd
(
abs
(
cosd
(
blobs_etas
)))
>
conf
.
min_eta
;
wa
s_selected
=
wa
s_selected
&
eta_ok
;
i
s_selected
=
i
s_selected
&
eta_ok
;
for
ii_g
=
1
:
num_grains
ondet_bls
=
grs
(
ii_g
)
.
proj
(
conf
.
det_index
)
.
ondet
;
valid_inc_pos
=
or_inc_pos
{
ii_g
}
>
0
;
temp_proj
(
ii_g
)
.
ondet
=
ondet_bls
;
temp_proj
(
ii_g
)
.
included
=
find
(
valid_inc_pos
);
temp_proj
(
ii_g
)
.
selected
=
wa
s_selected
(
or_inc_pos
{
ii_g
}(
valid_inc_pos
));
temp_proj
(
ii_g
)
.
selected
=
i
s_selected
(
or_inc_pos
{
ii_g
}(
valid_inc_pos
));
end
fprintf
(
'\b\b: Done in %g seconds.\nShared blobs:\n'
,
toc
(
c
))
for
ii_b
=
1
:
num_blobs
fprintf
(
' - Blob %03d [u: %4d-%4d, v: %4d-%4d, w %4d-%4d], (
wa
s sel: %d, eta ok: %d, use raw: %d) orientation BBs:%s\n'
,
...
ii_b
,
blobs_uvw_boundaries
(
ii_b
,
[
1
4
2
5
3
6
]),
wa
s_selected
(
ii_b
),
eta_ok
(
ii_b
),
blob_use_raw_images
(
ii_b
),
sprintf
(
' %d'
,
blobs_props
(
ii_b
)
.
ors
))
fprintf
(
' - Blob %03d [u: %4d-%4d, v: %4d-%4d, w %4d-%4d], (
i
s sel: %d, eta ok: %d, use raw: %d) orientation BBs:%s\n'
,
...
ii_b
,
blobs_uvw_boundaries
(
ii_b
,
[
1
4
2
5
3
6
]),
i
s_selected
(
ii_b
),
eta_ok
(
ii_b
),
blob_use_raw_images
(
ii_b
),
sprintf
(
' %d'
,
blobs_props
(
ii_b
)
.
ors
))
end
% If conf.use_raw_images is selected, it is now time to act!
...
...
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