Skip to content
Snippets Groups Projects
Commit dfc33e6c authored by Nicola Vigano's avatar Nicola Vigano
Browse files

gtPlaceSubVolume: temporary workaround for the breakage of the C++ functions

parent 6b6d40f7
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ function output = gtPlaceSubVolume(output, input, shift, index, assign_op, use_c
% all the voxels will have value of the index
if (~exist('use_c_functions', 'var') || isempty(use_c_functions))
use_c_functions = true;
use_c_functions = false;
end
if (~exist('index', 'var') || isempty(index))
index = 0;
......@@ -136,6 +136,7 @@ function output = place_sub_volume(output, input, shift, assign_op, use_c_functi
output = logical(output);
end
else
% please keep them around, in case you break the C function
input = input( ...
inLims(1, 1):inLims(2, 1), ...
inLims(1, 2):inLims(2, 2), ...
......@@ -153,32 +154,24 @@ function output = place_sub_volume(output, input, shift, assign_op, use_c_functi
output = full_output(:, :, :, extra_dims_shift{:});
end
temp_out = output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6));
switch (assign_op)
case {'zero', 'conflict', 'adaptive'}
% Matlab sugars to do the same that 'internal_gtAssignGrainToVol_interf'
% does: (please keep them around, in case you break the C function)
temp_out = output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6));
temp_out(temp_out & input) = -1;
indexes = ((temp_out == 0) & input);
temp_out(indexes) = input(indexes);
output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6)) = temp_out;
case 'summed'
% Matlab sugar to do the same that 'internal_gtAssignGrainToVol_sum'
% does: (please keep them around, in case you break the C function)
output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6)) ...
= output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6)) ...
+ input;
temp_out = temp_out + input;
case {'assign', 'parent'}
% Matlab sugar to do the same that 'internal_gtAssignGrainToVol'
% does: (please keep them around, in case you break the C function)
output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6)) = input;
indexes = input ~= 0;
temp_out(indexes) = input(indexes);
otherwise
error('PLACE:wrong_argument', 'No option for "%s"', assign_op);
end
output(lims(1):lims(2), lims(3):lims(4), lims(5):lims(6)) = temp_out;
if (~isempty(extra_dims_shift))
full_output(:, :, :, extra_dims_shift{:}) = output;
output = full_output;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment