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
ffc58d4a
Commit
ffc58d4a
authored
10 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Moving segmentation output to the details/reconstruction files
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
74c82e7d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
4_grains/GtThreshold.m
+15
-27
15 additions, 27 deletions
4_grains/GtThreshold.m
4_grains/gtSaveGrainRec.m
+1
-1
1 addition, 1 deletion
4_grains/gtSaveGrainRec.m
5_reconstruction/GtAssembleVol3D.m
+24
-18
24 additions, 18 deletions
5_reconstruction/GtAssembleVol3D.m
with
40 additions
and
46 deletions
4_grains/GtThreshold.m
+
15
−
27
View file @
ffc58d4a
...
...
@@ -258,15 +258,15 @@ classdef GtThreshold < handle
end
methods
(
Access
=
protected
)
function
grain_
rec
=
loadGrain
(
obj
,
phaseID
,
grainID
,
sample
)
function
grain_
out
=
loadGrain
(
obj
,
phaseID
,
grainID
,
sample
)
% GTTHRESHOLD/LOADGRAIN
% grain = loadGrain(obj, phaseID, grainID)
grain_
rec
=
gtLoadGrain
(
phaseID
,
grainID
,
'fields'
,
{
'id'
,
'vol'
,
'proj'
});
grain_rec
.
shift
=
grain_rec
.
proj
.
shift
;
grain_
out
=
gtLoadGrain
(
phaseID
,
grainID
,
'fields'
,
{
'id'
});
grain_rec
=
gtLoadGrainRec
(
phaseID
,
grainID
)
;
is_6D
=
isfield
(
obj
.
param
.
rec
,
'grains'
)
...
&&
ismember
(
upper
(
obj
.
param
.
rec
.
grains
.
algorithm
),
{
'6D
L1'
,
'6DTV'
,
'6DTVL1'
}
);
&&
strcmpi
(
obj
.
param
.
rec
.
grains
.
algorithm
(
1
:
2
),
'6D
'
);
if
(
is_6D
)
file_ext_rec_path
=
fullfile
(
obj
.
param
.
acq
.
dir
,
...
'4_grains'
,
sprintf
(
'phase_%02d'
,
phaseID
),
...
...
...
@@ -274,40 +274,27 @@ classdef GtThreshold < handle
if
(
sample
.
phases
{
phaseID
}
.
getUseExtended
(
grainID
))
grain_rec
=
load
(
file_ext_rec_path
,
'ODF6D'
);
else
grain_rec
=
gtLoadGrainRec
(
phaseID
,
grainID
);
end
grain_rec
.
vol
=
grain_rec
.
ODF6D
.
intensity
;
grain_rec
.
shift
=
grain_rec
.
ODF6D
.
shift
;
grain_out
.
vol
=
grain_rec
.
ODF6D
.
intensity
;
grain_out
.
shift
=
grain_rec
.
ODF6D
.
shift
;
else
grain_out
.
vol
=
grain_rec
.
VOL3D
.
intensity
;
grain_out
.
shift
=
grain_rec
.
VOL3D
.
shift
;
end
if
(
~
isfield
(
grain_
rec
,
'vol'
)
||
isempty
(
grain_
rec
.
vol
))
if
(
~
isfield
(
grain_
out
,
'vol'
)
||
isempty
(
grain_
out
.
vol
))
gtError
(
'GtThreshold:wrong_argument'
,
...
'Volume to segment is empty!'
)
end
end
function
saveGrain
(
obj
,
phaseID
,
grainID
,
grain_seg
)
function
saveGrain
(
~
,
phaseID
,
grainID
,
grain_seg
)
% GTTHRESHOLD/SAVEGRAIN
% saveGrain(obj, phaseID, grainID, grain)
if
(
verLessThan
(
'matlab'
,
'7.14'
))
phase_dir
=
fullfile
(
obj
.
param
.
acq
.
dir
,
'4_grains'
,
...
sprintf
(
'phase_%02d'
,
phaseID
));
filePath
=
fullfile
(
phase_dir
,
sprintf
(
'grain_%04d.mat'
,
grainID
));
seg
=
grain_seg
.
seg
;
%#ok<NASGU>
segbb
=
grain_seg
.
segbb
;
%#ok<NASGU>
threshold
=
grain_seg
.
threshold
;
%#ok<NASGU>
Area
=
grain_seg
.
Area
;
%#ok<NASGU>
seed
=
grain_seg
.
seed
;
%#ok<NASGU>
save
(
filePath
,
'-append'
,
'seg'
,
'segbb'
,
'threshold'
,
'Area'
,
'seed'
);
else
gtSaveGrain
(
phaseID
,
grainID
,
grain_seg
,
...
'fields'
,
{
'seg'
,
'segbb'
,
'threshold'
,
'Area'
,
'seed'
});
end
seg_struct
=
struct
(
'SEG'
,
grain_seg
);
gtSaveGrainRec
(
phaseID
,
grainID
,
seg_struct
,
'fields'
,
{
'SEG'
});
end
function
cluster
=
loadCluster
(
obj
,
phase_id
,
grain_ids
)
...
...
@@ -332,7 +319,8 @@ classdef GtThreshold < handle
cluster_rec
.
SEG
=
struct
(
...
'seg'
,
cluster
.
seg
,
'segbb'
,
cluster
.
segbb
,
...
'threshold'
,
cluster
.
threshold
,
'Area'
,
cluster
.
Area
);
'threshold'
,
cluster
.
threshold
,
'Area'
,
cluster
.
Area
,
...
'seed'
,
cluster
.
seed
);
save
(
file_cluster_rec_path
,
'-struct'
,
'cluster_rec'
,
'-v7.3'
);
end
...
...
This diff is collapsed.
Click to expand it.
4_grains/gtSaveGrainRec.m
+
1
−
1
View file @
ffc58d4a
function
gtSaveGrainRec
(
phase_id
,
grain_id
,
grain_det
,
varargin
)
details_fields
=
{
'VOL3D'
,
'ODF6D'
,
'ODFw'
,
'ODFuvw'
};
details_fields
=
{
'VOL3D'
,
'ODF6D'
,
'ODFw'
,
'ODFuvw'
,
'SEG'
};
conf
=
struct
(
...
'fields'
,
{
details_fields
},
...
'parameters'
,
{[]},
...
...
...
This diff is collapsed.
Click to expand it.
5_reconstruction/GtAssembleVol3D.m
+
24
−
18
View file @
ffc58d4a
...
...
@@ -124,13 +124,13 @@ classdef GtAssembleVol3D < handle
grainDirsModel
=
fullfile
(
'4_grains'
,
'phase_%02d'
,
'grain_%04d.mat'
);
obj
.
localPar
.
cache
.
createModel
(
grainDirsModel
,
'grain'
);
end
if
(
~
obj
.
localPar
.
cache
.
isModel
(
'grain_
details
'
))
if
(
~
obj
.
localPar
.
cache
.
isModel
(
'grain_
rec
'
))
grainDirsModel
=
fullfile
(
'4_grains'
,
'phase_%02d'
,
'grain_details_%04d.mat'
);
obj
.
localPar
.
cache
.
createModel
(
grainDirsModel
,
'grain_
details
'
);
obj
.
localPar
.
cache
.
createModel
(
grainDirsModel
,
'grain_
rec
'
);
end
if
(
~
obj
.
localPar
.
cache
.
isModel
(
'grain_ext
ended_details
'
))
if
(
~
obj
.
localPar
.
cache
.
isModel
(
'grain_ext
_rec
'
))
grainDirsModel
=
fullfile
(
'4_grains'
,
'phase_%02d'
,
'grain_extended_details_%04d.mat'
);
obj
.
localPar
.
cache
.
createModel
(
grainDirsModel
,
'grain_ext
ended_details
'
);
obj
.
localPar
.
cache
.
createModel
(
grainDirsModel
,
'grain_ext
_rec
'
);
end
if
(
obj
.
localPar
.
deal_with_twins
)
...
...
@@ -391,7 +391,7 @@ classdef GtAssembleVol3D < handle
fprintf
(
' Applying Absorption Mask.\n'
)
% Let's cut of the things out of the mask
newUidVol
=
zeros
(
size
(
uidVol
),
class
(
uidVol
)
)
;
newUidVol
=
zeros
(
size
(
uidVol
),
'like'
,
uidVol
);
indexes
=
(
maskVol
~=
0
);
newUidVol
(
indexes
)
=
uidVol
(
indexes
);
uidVol
=
newUidVol
;
...
...
@@ -609,11 +609,12 @@ classdef GtAssembleVol3D < handle
try
if
(
assemble_6D
)
if
(
sample
.
phases
{
phase_id
}
.
getUseExtended
(
grain_id
))
vol6D
=
obj
.
localPar
.
cache
.
get
(
'grain_ext
ended_details
'
,
{
phase_id
,
grain_id
},
'ODF6D'
);
vol6D
=
obj
.
localPar
.
cache
.
get
(
'grain_ext
_rec
'
,
{
phase_id
,
grain_id
},
'ODF6D'
);
else
vol6D
=
obj
.
localPar
.
cache
.
get
(
'grain_
details
'
,
{
phase_id
,
grain_id
},
'ODF6D'
);
vol6D
=
obj
.
localPar
.
cache
.
get
(
'grain_
rec
'
,
{
phase_id
,
grain_id
},
'ODF6D'
);
end
end
gr_seg
=
obj
.
localPar
.
cache
.
get
(
'grain_rec'
,
{
phase_id
,
grain_id
},
'SEG'
);
if
(
rotate_vols
)
gr_proj
=
obj
.
localPar
.
cache
.
get
(
'grain'
,
{
phase_id
,
grain_id
},
'proj'
);
...
...
@@ -632,21 +633,26 @@ classdef GtAssembleVol3D < handle
vol6D
.
shift
=
gtFwdSimComputeVolumeShifts
(
...
gr_proj
,
obj
.
parameters
,
size
(
int_vol
));
else
int_vol
=
obj
.
localPar
.
cache
.
get
(
'grain'
,
{
phase_id
,
grain_id
},
'vol'
);
int_vol
=
gtRotateVolume
(
int_vol
,
rot
);
vol3D
=
obj
.
localPar
.
cache
.
get
(
'grain_rec'
,
{
phase_id
,
grain_id
},
'VOL3D'
);
int_vol
=
gtRotateVolume
(
vol3D
.
intensity
,
rot
);
vol3D
.
shift
=
gtFwdSimComputeVolumeShifts
(
...
gr_proj
,
obj
.
parameters
,
size
(
int_vol
));
end
thr
=
obj
.
localPar
.
cache
.
get
(
'grain'
,
{
phase_id
,
grain_id
},
'threshold'
);
gr_rec_center
=
round
(
size
(
int_vol
)
/
2
);
gr_seg
=
t
.
volumeThreshold
(
int_vol
,
thr
,
gr_rec_center
);
seg_vol
=
int16
(
gr_seg
.
seg
);
seg_bb
=
gr_seg
.
segbb
;
seg_bb
(
1
:
3
)
=
seg_bb
(
1
:
3
)
+
vol6D
.
shift
;
else
seg_vol
=
obj
.
localPar
.
cache
.
get
(
'grain'
,
{
phase_id
,
grain_id
},
'seg'
);
seg_vol
=
int16
(
seg_vol
);
seg_bb
=
obj
.
localPar
.
cache
.
get
(
'grain'
,
{
phase_id
,
grain_id
},
'segbb'
);
gr_seg
=
t
.
volumeThreshold
(
int_vol
,
gr_seg
.
threshold
,
gr_rec_center
);
if
(
assemble_6D
)
gr_seg
.
segbb
(
1
:
3
)
=
gr_seg
.
segbb
(
1
:
3
)
+
vol6D
.
shift
;
else
gr_seg
.
segbb
(
1
:
3
)
=
gr_seg
.
segbb
(
1
:
3
)
+
vol3D
.
shift
;
end
end
seg_vol
=
int16
(
gr_seg
.
seg
);
seg_bb
=
gr_seg
.
segbb
;
catch
mexc
gtPrintException
(
mexc
,
sprintf
(
'\nGrain %d failed!!\n'
,
grain_id
));
gauge
.
rePrint
();
...
...
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