Skip to content
Snippets Groups Projects
Commit 32011bcf authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

Conflicts analysis : bug fix and better commenting...

ForwardSimulate_v2 : add ';' to end lines

Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@938 4c865b51-4357-4376-afb4-474e03ccb993
parent 3b97717a
No related branches found
No related tags found
No related merge requests found
...@@ -4,20 +4,21 @@ function grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solv ...@@ -4,20 +4,21 @@ function grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solv
% grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solve_flag, log_flag, save_flag, minnum, maxnum) % grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solve_flag, log_flag, save_flag, minnum, maxnum)
% ------------------------------------------------------------------------------------------------------------------- % -------------------------------------------------------------------------------------------------------------------
% %
% Reads ./parameters.mat % Reads ./parameters.mat : cryst -> length(cryst)
% ./parameters.mat : acq : dir
%
% ./4_grains/spot2grain.mat % ./4_grains/spot2grain.mat
% ./4_grains/phase_##/index.mat:grain
% %
% Saves ./4_grains/grains_merge.mat % ./4_grains/phase_##/index.mat : grain -> length(grain)
% ./4_grains/conflicts.mat
% %
% conflicts.mat contains: grain_conflict = list of logical if difspot(i) % Saves ./4_grains/grains_merge.mat (See output for details)
% is claimed by more than one grain % ./4_grains/conflicts.mat : grain_conflict = list of logical if difspot(i)
% <row vector num_phases x num_spots> % is claimed by more than one grain
% phase_conflict = list of difspots in conflict between phases % <row vector num_phases x num_spots>
% <row vector num_phases x spotids> % phase_conflict = list of difspots in conflict between phases
% phase = list of difspotIDs for each phase % <row vector num_phases x spotids>
% <cell num_phases x 1> % phase = list of difspotIDs for each phase
% <cell num_phases x 1>
% %
% SUB-FUNCTIONS: % SUB-FUNCTIONS:
%[sub]- sfCompareGrains %[sub]- sfCompareGrains
...@@ -55,10 +56,10 @@ function grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solv ...@@ -55,10 +56,10 @@ function grains_merge = gtAnalyseGrainsConflicts(analyse_flag, update_flag, solv
% .difspotID = vector of difspotID from Fsim <double> % .difspotID = vector of difspotID from Fsim <double>
% %
% .conflicts{grainid} = GtConflict object array <cell numgrainx1> % .conflicts{grainid} = GtConflict object array <cell numgrainx1>
% .difspots = [idconflict, [difspots]] <cell> % .difspots = [idconflict, [difspots]] <cell>
% .maxnum = logical % .maxnum = logical
% .merge = [idconflict, [difspots]] if maxnum = true <cell> % .merge = [idconflict, [difspots]] if maxnum = true <cell>
% .allequals = logical % .allequals = logical
% %
% .hasConflicts(grainid) = boolean to say if grainid has conflicts <logical numgrainx1> % .hasConflicts(grainid) = boolean to say if grainid has conflicts <logical numgrainx1>
% .nofConflicts(grainid) = number of conflicts <int numgrainx1> % .nofConflicts(grainid) = number of conflicts <int numgrainx1>
......
...@@ -486,7 +486,7 @@ for n = first : last ...@@ -486,7 +486,7 @@ for n = first : last
out.proj.num_rows = vsize; out.proj.num_rows = vsize;
out.proj.num_cols = hsize; out.proj.num_cols = hsize;
% We should in the future handle properly vertical detector (general geometry) % We should in the future handle properly vertical detector (general geometry)
out.proj.vol_size_x = round(grainBBox(1) * fsim.oversizeVol) out.proj.vol_size_x = round(grainBBox(1) * fsim.oversizeVol);
out.proj.vol_size_y = round(grainBBox(1) * fsim.oversizeVol); out.proj.vol_size_y = round(grainBBox(1) * fsim.oversizeVol);
out.proj.vol_size_z = round(grainBBox(2) * fsim.oversizeVol); out.proj.vol_size_z = round(grainBBox(2) * fsim.oversizeVol);
out.proj.num_iter = parameters.rec.num_iter; out.proj.num_iter = parameters.rec.num_iter;
......
function [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
allvalues = [];
ids = [];
count = 0;
if ~isempty(selected)
cellArray = arrayfun(@(num) cellArray{num}, selected, 'UniformOutput', false);
else
selected = 1:length(cellArray);
end
for i = 1 : length(cellArray)
array = cellArray{i};
if ~isempty(array)
for j = 1 : length(array)
current = array(j);
if isempty(current)
count = count + 1;
else
ids = [ids; selected(i)];
allvalues = [allvalues; current];
end
end
end
end
end
function [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
% GTGETSINGLEVALUES Operates on cellArray to get values as column vector
% [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
% ----------------------------------------------------------
%
% The empty element are skipped.
%
% INPUT:
% cellArray = cell array as input <cell>
% selected = indexes to be taken into account <double>
%
% OUTPUT:
% allvalues = column vector as output
% ids = indexes as column vector <double>
%
% USAGE: cellArray = {1,2,3,4,5};
% selected = [2 3];
% [allvalues, ids] = gtGetSinglesValues(cellArray, selected);
% allvalues =
% 2
% 3
% ids =
% 2
% 3
%
%
% cellArray = {0,4,[],3,5}; (empty entry)
% selected = [2 3];
% [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
% allvalues =
% 4
% ids =
% 2
%
%
% cellArray = {[1 -1],[2 3 5],[]}; (empty entry and vector as
% element)
% selected = [2 3];
% [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
% allvalues =
% 2
% 3
% 5
% ids =
% 2
% 2
% 2
%
%
% confl = {{'2', '-1'},[2 3 5],[]}; (empty entry and vectors as
% element: includes strings)
% selected = [1 3];
% [allvalues, ids] = gtGetSinglesValues(cellArray, selected)
% allvalues =
% '2'
% '-1'
% ids =
% 1
% 1
%
%
% Version 001 03-12-2012 by LNervo
allvalues = [];
ids = [];
if ~isempty(selected)
cellArray = arrayfun(@(num) cellArray{num}, selected, 'UniformOutput', false);
else
selected = 1:length(cellArray);
end
for ii = 1 : length(cellArray)
array = cellArray{ii};
if ~isempty(array)
for jj = 1 : length(array)
current = array(jj);
if ~isempty(current)
ids = [ids; selected(ii)];
allvalues = [allvalues; current];
end
end
end
end
end % end of function
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