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
9c66a0dd
Commit
9c66a0dd
authored
10 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Assembling: Fixed R-vector assembling
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
e5a5c014
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
5_reconstruction/GtAssembleVol3D.m
+1
-3
1 addition, 3 deletions
5_reconstruction/GtAssembleVol3D.m
zUtil_Imaging/gtPlaceSubVolume.m
+39
-24
39 additions, 24 deletions
zUtil_Imaging/gtPlaceSubVolume.m
with
40 additions
and
27 deletions
5_reconstruction/GtAssembleVol3D.m
+
1
−
3
View file @
9c66a0dd
...
...
@@ -547,10 +547,8 @@ classdef GtAssembleVol3D < handle
single_dim_dmvol
=
gtCrop
(
single_dim_dmvol
,
segbb
);
single_dim_dmvol
(
~
seg_vol
)
=
0
;
% Turning the C functions off is way slower, but
% for some reason they don't work in this case
dmvol
=
gtPlaceSubVolume
(
dmvol
,
single_dim_dmvol
,
...
[
volBBox
(
1
:
3
),
ii_dim
-
1
],
[],
obj
.
localPar
.
overlaps
,
false
);
[
volBBox
(
1
:
3
),
ii_dim
-
1
],
[],
'assign'
);
end
catch
mexc
gtPrintException
(
mexc
,
sprintf
(
'\nGrain %d failed!!\n'
,
ii
));
...
...
This diff is collapsed.
Click to expand it.
zUtil_Imaging/gtPlaceSubVolume.m
+
39
−
24
View file @
9c66a0dd
...
...
@@ -14,6 +14,11 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
% shift=[2 -2 0] means that voxel (a, b, c) will be at (a+2, b-2, c) in
% output.
%
% if the output volume has more than 3 dimensions, the shifts have to
% be extended in order to select the position in the next dimensions.
% Otherwhise ones will be placed
% However, the placing will still happen in the first 3 dimensions
%
% Note - this is used to add on volume to another one, rather than
% placing one image in the other.
% I have modified so it no longer adds it. I hope this doesn't break
...
...
@@ -32,6 +37,10 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
assign_op
=
'assign'
;
end
if
(
index
~=
0
)
input
=
index
.*
input
;
end
inputSize
=
size
(
input
);
outputSize
=
size
(
output
);
num_input_dims
=
numel
(
inputSize
);
...
...
@@ -49,28 +58,17 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
inputSize
((
num_input_dims
+
1
):
3
)
=
1
;
outputSize
((
num_output_dims
+
1
):
3
)
=
1
;
shift
((
numel
(
shift
)
+
1
):
max
(
num_output_dims
,
3
))
=
0
;
% We add one because the shifting is done in matlab code!
extra_dims_shift
=
arrayfun
(
@
(
x
){
x
+
1
},
shift
(
4
:
num_output_dims
));
full_output
=
output
;
if
(
~
isempty
(
extra_dims_shift
))
output
=
full_output
(:,
:,
:,
extra_dims_shift
{:});
end
shift
((
numel
(
shift
)
+
1
):
num_output_dims
)
=
0
;
% output and input volume limits
[
outLims
,
inLims
]
=
gtGetVolsIntersectLimits
(
outputSize
(
1
:
3
),
inputSize
,
shift
(
1
:
3
));
input
=
input
(
inLims
(
1
,
1
):
inLims
(
2
,
1
),
...
inLims
(
1
,
2
):
inLims
(
2
,
2
),
...
inLims
(
1
,
3
):
inLims
(
2
,
3
)
);
lims
=
[
outLims
(
1
,
1
)
outLims
(
2
,
1
)
...
outLims
(
1
,
2
)
outLims
(
2
,
2
)
...
outLims
(
1
,
3
)
outLims
(
2
,
3
)
];
if
(
use_c_functions
)
% Logicals are not handled in he C++ classes
shifts_op
=
[
outLims
(
1
,
:)
-
1
,
shift
(
4
:
end
)];
shifts_ip
=
inLims
(
1
,
:)
-
1
;
dims
=
outLims
(
2
,
:)
-
outLims
(
1
,
:)
+
1
;
% Logicals are not handled in the C++ function
is_out_logical
=
islogical
(
output
);
if
(
is_out_logical
)
output
=
uint8
(
output
);
...
...
@@ -90,11 +88,11 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
switch
(
assign_op
)
case
{
'zero'
,
'conflict'
,
'adaptive'
}
% Mark overlapping...
output
=
internal_gtAssignGrainToVol_i
nterf
(
output
,
input
,
index
,
lims
);
gtCxxPlaceSubVolumeI
nterf
(
output
,
input
,
shifts_op
,
shifts_ip
,
dims
);
case
'summed'
output
=
internal_gtAssignGrainToVol_s
um
(
output
,
input
,
index
,
lims
);
gtCxxPlaceSubVolumeS
um
(
output
,
input
,
shifts_op
,
shifts_ip
,
dims
);
case
{
'assign'
,
'parent'
}
output
=
internal_gtAssignGrainToVol
(
output
,
input
,
index
,
l
ims
);
gtCxxPlaceSubVolumeAssign
(
output
,
input
,
shifts_op
,
shifts_ip
,
d
ims
);
otherwise
error
(
'PLACE:wrong_argument'
,
'No option for "%s"'
,
assign_op
);
end
...
...
@@ -103,6 +101,23 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
output
=
logical
(
output
);
end
else
input
=
input
(
...
inLims
(
1
,
1
):
inLims
(
2
,
1
),
...
inLims
(
1
,
2
):
inLims
(
2
,
2
),
...
inLims
(
1
,
3
):
inLims
(
2
,
3
)
);
lims
=
[
...
outLims
(
1
,
1
),
outLims
(
2
,
1
),
...
outLims
(
1
,
2
),
outLims
(
2
,
2
),
...
outLims
(
1
,
3
),
outLims
(
2
,
3
)
];
% We add one because the shifting is done in matlab code!
extra_dims_shift
=
arrayfun
(
@
(
x
){
x
+
1
},
shift
(
4
:
num_output_dims
));
full_output
=
output
;
if
(
~
isempty
(
extra_dims_shift
))
output
=
full_output
(:,
:,
:,
extra_dims_shift
{:});
end
switch
(
assign_op
)
case
{
'zero'
,
'conflict'
,
'adaptive'
}
% Matlab sugars to do the same that 'internal_gtAssignGrainToVol_interf'
...
...
@@ -128,10 +143,10 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
otherwise
error
(
'PLACE:wrong_argument'
,
'No option for "%s"'
,
assign_op
);
end
end
if
(
~
isempty
(
extra_dims_shift
))
full_output
(:,
:,
:,
extra_dims_shift
{:})
=
output
;
output
=
full_output
;
if
(
~
isempty
(
extra_dims_shift
))
full_output
(:,
:,
:,
extra_dims_shift
{:})
=
output
;
output
=
full_output
;
end
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