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

FwdSim: modularized and vectorized the core

parent c6b25291
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,8 @@ end
labgeo = parameters.labgeo;
samgeo = parameters.samgeo;
det_index = 1;
if (~isfield(parameters.seg, 'writehdf5') || ~parameters.seg.writehdf5)
error('gtForwardSimulate_v2:wrong_parameter', ...
[ 'Segmentation has to write HDF5 blobs in order for ' ...
......@@ -208,14 +210,14 @@ for n = first : last
%%% Predict spot positions
gr = gtCalculateGrain(gr, parameters);
uvw = gr.allblobs.detector(1).uvw;
uvw = gr.allblobs.detector(det_index).uvw;
%%% Get:
% - average difspot X and Y sizes for the current spots in the grain
% - theshold values used during the database search
% - offset in possible lateral grain orientation
% - diffstack Vertical and Horizontal sizes
spotsCommProps = gtFwdSimGetDiffspotsCommonProperties(gr, parameters, 1);
spotsCommProps = gtFwdSimGetDiffspotsCommonProperties(gr, parameters, det_index);
%%% Get the indices of all spots which fully intersect the active
% region of the detector
......@@ -228,53 +230,17 @@ for n = first : last
fprintf(' (Done).\n - Preallocating structs..')
% number of exspected diffraction spots
numspots = numel(onDet);
flag = ones(numspots, 1); % see above
% stack of zero padded diffraction spots (projections used for 3D reconstruction)
bl(1:numspots) = struct( ...
'intm', [], ... % The normalized blob
'mask', [], ... % The segmentation mask
'bbuim', [], ... % Image BB on U
'bbvim', [], ... % Image BB on V
'bbwim', [], ... % Image BB on W <- Not strictly w
'bbsize', [], ... % Image BoundingBox (includes margins)
'mbbsize', [], ... % Real (Measured) Blob Bounding Box
'mbbu', [], ... % Real (Measured) Blob BB on U
'mbbv', [], ... % Real (Measured) Blob BB on V
'mbbw', [], ... % Real (Measured) Blob BB on W <- Not strictly w
'intensity', [] ); % Blob original intensity
checkSpots = struct('info', cell(numspots, 1));
bb = zeros(numspots, 4); % difspot BoundingBox from database
cent = zeros(numspots, 1); % centroid distance from database added 06-02-2014 LNervo
spotid = zeros(numspots, 1); % Mysql difspottable difspotID
check = false(numspots, 2);
intensity = zeros(numspots, 1); % Integrated blob intensity
avg_pixel_int = zeros(numspots, 1); % Average pixel intensity in blob
likelihood = zeros(numspots, 1); % Integrated blob intensity
cands = struct(...
'id', cell(numspots, 1), ...
'likelihood_tot', cell(numspots, 1), ...
'likelihood_proj_mask', cell(numspots, 1), ...
'likelihood_dev_uv', cell(numspots, 1), ...
'likelihood_dev_w', cell(numspots, 1) );
% Diffraction vectors directions
diff_beam_dirs = zeros(numspots, 3);
U = zeros(numspots, 1); % CoM u positions of difspots from difspottable
V = zeros(numspots, 1); % CoM v positions of difspots from difspottable
W = zeros(numspots, 1); % CoM w positions of difspots from difspottable
if (parameters.fsim.assemble_figure)
full = zeros(detgeo.detsizev, detgeo.detsizeu);
full = zeros(detgeo(det_index).detsizev, detgeo(det_index).detsizeu);
else
full = [];
end
tempIsSpotA = false(numspots, 1);
% number of exspected diffraction spots
numspots = numel(onDet);
% Diffraction vectors directions
diff_beam_dirs = zeros(numspots, 3);
fprintf(' (Done).\n - Matching reflections and spots..');
......@@ -284,100 +250,8 @@ for n = first : last
% examine all hklsp and search corresponding spots / intensity on the
% detector..
%%% But also build the diffraction blob stack
for ii = 1:numspots
% Producing predicted spot's properties
spot_props = predict_spot_properties(spotsCommProps, proj_bls(ii), gr.stat, parameters);
% Look for difspots appying loose search criteria - is there any intensity at the predicted spot
% position ? Choose the one which is closest to the expected size
[candidateIDs, spotsCands] = gtFwdSimFindCandidates(spot_props, uvw(onDet(ii), :), segmentedSpots);
if (isempty(candidateIDs))
% NO CANDIDATES FOUND:
% segmentation / overlap / intensity / ... problem ?
if (spotsCands.found_intensity)
% A bigger spot was found in the region.. it may be an
% overlap
flag(ii) = 2;
end
% If requested, we will check into the raw images later.
continue;
end
bls = gtFwdSimBuildDifstackBlobs(candidateIDs, [], parameters, ...
spotsCommProps.stackUSize, spotsCommProps.stackVSize);
proj_bl = proj_bls(ii * ones(numel(bls), 1));
% Computing spot area/shape deviation/likelihood
ls_pb = compute_proj_bbs_partial_likelihoods(bls, proj_bl);
refl_indx = onDet(ii) * ones(numel(bls), 1);
% Computing UV deviation/likelihood
th_uv = uvw(refl_indx, 1:2);
blobs_uv = [ spotsCands.CentroidX, spotsCands.CentroidY ];
ls_uv = compute_uv_partial_likelihoods(blobs_uv, th_uv, proj_bl);
% Computing W deviation/likelihood
th_w = gr.allblobs.omega(refl_indx);
blob_w = spotsCands.CentroidImage * labgeo.omstep;
ls_w = compute_w_partial_likelihoods(blob_w, th_w);
% in case there are several candidates, take the one with best
% likelihood in terms of: shape, UV position, and W position.
ls = ls_pb .* ls_uv .* ls_w;
[~, cand_inc_index] = max(ls);
cands(ii).id = candidateIDs';
cands(ii).likelihood_tot = ls';
cands(ii).likelihood_proj_mask = ls_pb';
cands(ii).likelihood_dev_uv = ls_uv';
cands(ii).likelihood_dev_w = ls_w';
spotid(ii) = candidateIDs(cand_inc_index);
bl(ii) = bls(cand_inc_index); %#ok<AGROW>
U(ii) = spotsCands.CentroidX(cand_inc_index);
V(ii) = spotsCands.CentroidY(cand_inc_index);
W(ii) = spotsCands.CentroidImage(cand_inc_index) * labgeo.omstep;
bb(ii, :) = [...
spotsCands.BoundingBoxXorigin(cand_inc_index), ...
spotsCands.BoundingBoxYorigin(cand_inc_index), ...
spotsCands.BoundingBoxXsize(cand_inc_index), ...
spotsCands.BoundingBoxYsize(cand_inc_index) ];
% The following should be beter than the previous, but it seems to
% geneterate problems
% bb(ii, :) = bls(cand_inc_index).mbbsize([1 2 4 5]);
intensity(ii) = bls(cand_inc_index).intensity;
avg_pixel_int(ii) = intensity(ii) / sum(bls(cand_inc_index).mask(:));
likelihood(ii) = ls(cand_inc_index);
% Found a segmented difspot at expected position:
% we will check if it does match strict criteria
uv_ok = cent(ii, :) <= spotsCommProps.Offset;
bb_ok = all( [...
between(bb(ii, 3), spotsCommProps.XsizeMin, spotsCommProps.XsizeMax), ...
between(bb(ii, 4), spotsCommProps.YsizeMin, spotsCommProps.YsizeMax) ] );
check(ii, :) = [uv_ok, bb_ok];
isSpotA = ~isempty(find(gr.difspotidA == spotid(ii), 1));
isSpotB = ~isempty(find(gr.difspotidB == spotid(ii), 1));
if (isSpotA || isSpotB)
% This spot is part of a pair and has been used by INDEXTER
flag(ii) = 5;
tempIsSpotA(ii) = isSpotA;
elseif all(check(ii, :))
flag(ii) = 4; % This flag is kinda obsolete
else
flag(ii) = 3;
end
end
[fwd_sim, bl] = forward_simulate_grain(gr, onDet, spotsCommProps, ...
segmentedSpots, proj_bls, parameters, det_index);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Re-check flag == 1, to see if there's intensity at the predicted
......@@ -385,80 +259,84 @@ for n = first : last
if (parameters.fsim.check_spot)
fprintf(' (Done).\n - Checking spots in Raw images..');
toBeChecked = find(flag == 1);
for ii = reshape(toBeChecked, [1 numel(toBeChecked)]);
toBeChecked = find(fwd_sim.flag == 1);
for ii = reshape(toBeChecked, 1, []);
[found_intensity, spotInfo] = gtFwdSimCheckSpotInRawImages(...
uvw(onDet(ii), :), spotsCommProps, parameters);
if (found_intensity)
% Found intensity in FULL images at predicted position
flag(ii) = 2;
fwd_sim.flag(ii) = 2;
if (parameters.fsim.assemble_figure)
full = gtPlaceSubImage2(spotInfo.spot, full, spotInfo.bb(1), spotInfo.bb(2), 'summed');
end
end
checkSpots(ii).info = spotInfo;
fwd_sim.check_spots(ii).info = spotInfo;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reflections that have been matched to segmented spots
included = find(flag >= 3);
included = find(fwd_sim.flag >= 3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% We now build the diffraction stack
fprintf(' (Done).\n - Building difstack..');
difstack = gtFwdSimBuildDifstackSpots(spotid, included, parameters, ...
spotsCommProps.stackUSize, spotsCommProps.stackVSize, ...
difstack = gtFwdSimBuildDifstackSpots(fwd_sim.spotid, included, ...
parameters, spotsCommProps.stackUSize, spotsCommProps.stackVSize, ...
spotsCommProps.Xsize, spotsCommProps.Ysize, ...
bb, info);
fwd_sim.bb, info);
if (parameters.fsim.assemble_figure)
% no padded spots
full = sfBuildFull(spotid(reshape(included, 1, [])), ...
parameters, spotsCommProps, bb(reshape(included, 1, []), :));
full = sfBuildFull(fwd_sim.spotid(included), ...
parameters, spotsCommProps, fwd_sim.bb(included, :));
end
fprintf(' (Done).\n - Building geometry..');
%%% Diffraction geometry
for ii = reshape(included, 1, [])
% we found a segmented spot - can use the theoretically
% predicted direction or apparent direction (based on CoM of
% grain and spot) for backprojection
% theoretically prediceted omega angle
if (flag(ii) == 5)
% If available, we want to use the angles as determined from
% the Friedel pairs - interrogate spotpair table
%
% diff_beam_dirs: direction of diffracted beam used in ASTRA
[diff_beam_dirs(ii, :), W(ii)] = sfGetFriedelPair(pairsTable, spotid(ii), tempIsSpotA(ii));
elseif (parameters.fsim.use_th)
currentReflection = onDet(ii);
% use theoretically predited directions (default)
W(ii) = gr.allblobs.omega(currentReflection);
% theoretically predicted beam direction (in sample
% coordinate system)
diff_beam_dirs(ii, :) = gr.allblobs.dvecsam(currentReflection, :);
else
% use experimentally determined omega angles
W(ii) = segmentedSpots.CentroidImage(spotid(ii)) * labgeo.omstep;
% projection direction as inferred from grain / spot center
% positions
diff_beam_dirs(ii, :) = gtGeoDiffVecInSample([U(ii), V(ii)], W(ii), gr.center, detgeo, labgeo, samgeo);
end
% diff_beam_dirs: direction of diffracted beam used in ASTRA
identif_indexed = fwd_sim.flag(included) == 5;
incl_indx = included(identif_indexed);
incl_not_indx = included(~identif_indexed);
% we found a segmented spot - can use the theoretically
% predicted direction or apparent direction (based on CoM of
% grain and spot) for backprojection
% If available, we want to use the angles as determined from
% the Friedel pairs - interrogate spotpair table
[diff_beam_dirs(incl_indx, :), fwd_sim.uvw(incl_indx, 3)] = sfGetFriedelPair( ...
pairsTable, fwd_sim.spotid(incl_indx), fwd_sim.spot_type(incl_indx) == 'a');
% Otherwise we have two choices
if (parameters.fsim.use_th)
% use theoretically predited directions (default)
fwd_sim.uvw(incl_not_indx, 3) = gr.allblobs.omega(onDet(incl_not_indx));
% theoretically predicted beam direction (in sample
% coordinate system)
diff_beam_dirs(incl_not_indx, :) = gr.allblobs.dvecsam(onDet(incl_not_indx), :);
else
% use experimentally determined omega angles (which we find in:
% fwd_sim.uvw(incl_not_indx, 3))
% projection direction as inferred from grain / spot center
% positions
diff_beam_dirs(incl_not_indx, :) = gtGeoDiffVecInSample( ...
fwd_sim.uvw(incl_not_indx, 1:2), fwd_sim.uvw(incl_not_indx, 3), ...
gr.center, detgeo(det_index), labgeo, samgeo);
end
[selected, goodness] = gtFwdSimSelectSpots(likelihood, intensity, ...
avg_pixel_int, flag, included, parameters);
%%% Selection of the spots
[selected, goodness] = gtFwdSimSelectSpots(fwd_sim.likelihood, fwd_sim.intensity, ...
fwd_sim.avg_pixel_int, fwd_sim.flag, included, parameters);
%%% We now Build ASTRA's geometry
proj = gtFwdSimBuildProjGeometry(...
diff_beam_dirs(included, :), gr.center, W(included), ...
bb(included, :), parameters, ...
diff_beam_dirs(included, :), gr.center, fwd_sim.uvw(included, 3), ...
fwd_sim.bb(included, :), parameters, ...
spotsCommProps.stackUSize, spotsCommProps.stackVSize, ...
selected);
......@@ -472,25 +350,25 @@ for n = first : last
out.center = gr.center;
out.allblobs = gr.allblobs;
out.check = check;
out.flag = flag;
out.check = fwd_sim.check;
out.flag = fwd_sim.flag;
out.pairid = gr.pairid;
out.spotid = spotid;
out.spotid = fwd_sim.spotid;
% only included spots info
out.cands = cands(included);
out.likelihood = likelihood(included);
out.difspotID = spotid(included);
out.uv_exp = [U(included), V(included)];
out.om_exp = W(included);
out.bb_exp = bb(included, :);
out.intensity = intensity(included);
out.cands = fwd_sim.cands(included);
out.likelihood = fwd_sim.likelihood(included);
out.difspotID = fwd_sim.spotid(included);
out.uv_exp = fwd_sim.uvw(included, 1:2);
out.om_exp = fwd_sim.uvw(included, 3);
out.bb_exp = fwd_sim.bb(included, :);
out.intensity = fwd_sim.intensity(included);
% save full image
out.full = full;
% check spot info
out.checkSpots = checkSpots;
out.checkSpots = fwd_sim.check_spots;
% diffraction geometry
out.proj = proj;
......@@ -502,9 +380,9 @@ for n = first : last
out.proj.bl = bl(included);
out.proj.stack = difstack(:, included, :);
found_reflections = numel(find(flag > 1));
found_reflections = numel(find(fwd_sim.flag > 1));
out.completeness = found_reflections / numspots;
out.completeness_incl = numel(find(flag >= 3)) / numspots;
out.completeness_incl = numel(find(fwd_sim.flag >= 3)) / numspots;
out.goodness = goodness;
out.goodness_sel = mean(out.likelihood(selected));
out.confidence = out.goodness * out.completeness_incl;
......@@ -559,7 +437,7 @@ for n = first : last
fprintf('\n Grain number %d:\n', n);
newspots = length(find(flag == 4));
newspots = length(find(fwd_sim.flag == 4));
fprintf(['Forward simulation found intensity at %d out of %d expected ' ...
'spot positions \n'], found_reflections, numspots);
fprintf('Completeness estimate: %f\n', out.completeness);
......@@ -601,6 +479,146 @@ end
% sub-functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Forward Simulation
function fwd_sim = gtFwdSimDataStructureDefinition(numspots)
fwd_sim = struct( ...
'flag', ones(numspots, 1), ... % see above
'bb', zeros(numspots, 4), ... % difspot BoundingBox from database
'cent', zeros(numspots, 1), ... % centroid distance from database added 06-02-2014 LNervo
'spotid', zeros(numspots, 1), ... % Mysql difspottable difspotID
'check', false(numspots, 2), ...
'intensity', zeros(numspots, 1), ... % Integrated blob intensity
'avg_pixel_int', zeros(numspots, 1), ... % Average pixel intensity in blob
'likelihood', zeros(numspots, 1), ... % Blob likelihood
'cands', struct( ...
'id', cell(numspots, 1), ...
'likelihood_tot', cell(numspots, 1), ...
'likelihood_proj_mask', cell(numspots, 1), ...
'likelihood_dev_uv', cell(numspots, 1), ...
'likelihood_dev_w', cell(numspots, 1) ), ...
'uvw', zeros(numspots, 3), ... % CoM positions of difspots from difspottable
'spot_type', char(zeros(numspots, 1)), ...
'check_spots', struct('info', cell(numspots, 1)) );
end
function [fwd_sim, bl] = forward_simulate_grain(gr, onDet, ...
spotsCommProps, segmentedSpots, proj_bls, parameters, det_index)
uvw = gr.allblobs.detector(det_index).uvw;
% number of exspected diffraction spots
numspots = numel(onDet);
% stack of zero padded diffraction spots (projections used for 3D reconstruction)
bl(1:numspots) = gtFwdSimBlobDefinition();
fwd_sim = gtFwdSimDataStructureDefinition(numspots);
% We try to match the reflections with the segmented spots, so we
% examine all hklsp and search corresponding spots / intensity on the
% detector..
%%% But also build the diffraction blob stack
for ii = 1:numspots
% Producing predicted spot's properties
spot_props = predict_spot_properties(spotsCommProps, proj_bls(ii), gr.stat, parameters);
% Look for difspots appying loose search criteria - is there any intensity at the predicted spot
% position ? Choose the one which is closest to the expected size
[candidateIDs, spotsCands] = gtFwdSimFindCandidates(spot_props, uvw(onDet(ii), :), segmentedSpots);
if (isempty(candidateIDs))
% NO CANDIDATES FOUND:
% segmentation / overlap / intensity / ... problem ?
if (spotsCands.found_intensity)
% A bigger spot was found in the region.. it may be an
% overlap
fwd_sim.flag(ii) = 2;
end
% If requested, we will check into the raw images later.
continue;
end
bls = gtFwdSimBuildDifstackBlobs(candidateIDs, [], parameters, ...
spotsCommProps.stackUSize, spotsCommProps.stackVSize);
proj_bl = proj_bls(ii * ones(numel(bls), 1));
% Computing spot area/shape deviation/likelihood
ls_pb = compute_proj_bbs_partial_likelihoods(bls, proj_bl);
refl_indx = onDet(ii) * ones(numel(bls), 1);
% Computing UV deviation/likelihood
th_uv = uvw(refl_indx, 1:2);
blobs_uv = [ spotsCands.CentroidX, spotsCands.CentroidY ];
ls_uv = compute_uv_partial_likelihoods(blobs_uv, th_uv, proj_bl);
% Computing W deviation/likelihood
th_w = gr.allblobs.omega(refl_indx);
blob_w = spotsCands.CentroidImage * parameters.labgeo.omstep;
ls_w = compute_w_partial_likelihoods(blob_w, th_w);
% in case there are several candidates, take the one with best
% likelihood in terms of: shape, UV position, and W position.
ls = ls_pb .* ls_uv .* ls_w;
[~, cand_inc_index] = max(ls);
fwd_sim.cands(ii).id = candidateIDs';
fwd_sim.cands(ii).likelihood_tot = ls';
fwd_sim.cands(ii).likelihood_proj_mask = ls_pb';
fwd_sim.cands(ii).likelihood_dev_uv = ls_uv';
fwd_sim.cands(ii).likelihood_dev_w = ls_w';
fwd_sim.spotid(ii) = candidateIDs(cand_inc_index);
bl(ii) = bls(cand_inc_index);
fwd_sim.uvw(ii, :) = [ ...
spotsCands.CentroidX(cand_inc_index), ...
spotsCands.CentroidY(cand_inc_index), ...
spotsCands.CentroidImage(cand_inc_index) * parameters.labgeo.omstep ];
fwd_sim.bb(ii, :) = [...
spotsCands.BoundingBoxXorigin(cand_inc_index), ...
spotsCands.BoundingBoxYorigin(cand_inc_index), ...
spotsCands.BoundingBoxXsize(cand_inc_index), ...
spotsCands.BoundingBoxYsize(cand_inc_index) ];
% The following should be beter than the previous, but it seems to
% geneterate problems
% fwd_sim.bb(ii, :) = bls(cand_inc_index).mbbsize([1 2 4 5]);
fwd_sim.intensity(ii) = bls(cand_inc_index).intensity;
fwd_sim.avg_pixel_int(ii) = fwd_sim.intensity(ii) / sum(bls(cand_inc_index).mask(:));
fwd_sim.likelihood(ii) = ls(cand_inc_index);
% Found a segmented difspot at expected position:
% we will check if it does match strict criteria
uv_ok = fwd_sim.cent(ii, :) <= spotsCommProps.Offset;
bb_ok = all( [...
between(fwd_sim.bb(ii, 3), spotsCommProps.XsizeMin, spotsCommProps.XsizeMax), ...
between(fwd_sim.bb(ii, 4), spotsCommProps.YsizeMin, spotsCommProps.YsizeMax) ] );
fwd_sim.check(ii, :) = [uv_ok, bb_ok];
isSpotA = any(gr.difspotidA == fwd_sim.spotid(ii));
isSpotB = any(gr.difspotidB == fwd_sim.spotid(ii));
if (isSpotA || isSpotB)
% This spot is part of a pair and has been used by INDEXTER
fwd_sim.flag(ii) = 5;
fwd_sim.spot_type(ii) = char('a' * isSpotA + 'b' * isSpotB);
elseif all(fwd_sim.check(ii, :))
fwd_sim.flag(ii) = 4; % This flag is kinda obsolete
else
fwd_sim.flag(ii) = 3;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Support Functions
function full = sfBuildFull(spotid, parameters, spotsCommProps, bb)
% full = sfBuildFull(spotid, parameters, spotsCommProps, bb)
%
......@@ -621,15 +639,17 @@ end
function [diff_beam_dir, omega] = sfGetFriedelPair(pairsTable, spotID, isSpotA)
% [diff_beam_dirs, omega] = sfGetFriedelPair(pairsTable, spotID, isSpotA)
if (isSpotA)
idx = find(pairsTable.difAID == spotID);
omega = pairsTable.omega(idx);
diff_beam_dir = [pairsTable.ldirX(idx), pairsTable.ldirY(idx), pairsTable.ldirZ(idx)];
else
idx = find(pairsTable.difBID == spotID);
omega = pairsTable.omegaB(idx);
% in this case we have to reverse the line direction
diff_beam_dir = -[pairsTable.ldirX(idx), pairsTable.ldirY(idx), pairsTable.ldirZ(idx)];
for ii = numel(spotID):-1:1
if (isSpotA(ii))
idx = find(pairsTable.difAID == spotID(ii));
omega(ii) = pairsTable.omega(idx);
diff_beam_dir(ii, :) = [pairsTable.ldirX(idx), pairsTable.ldirY(idx), pairsTable.ldirZ(idx)];
else
idx = find(pairsTable.difBID == spotID(ii));
omega(ii) = pairsTable.omegaB(idx);
% in this case we have to reverse the line direction
diff_beam_dir(ii, :) = -[pairsTable.ldirX(idx), pairsTable.ldirY(idx), pairsTable.ldirZ(idx)];
end
end
end
......
function blob = gtFwdSimBlobDefinition()
% function blob = gtFwdSimBlobDefinition()
%
blob = struct( ...
'intm', [], ... % The normalized blob
'mask', [], ... % The segmentation mask
'bbuim', zeros(0, 2), ... % Image BB on U
'bbvim', zeros(0, 2), ... % Image BB on V
'bbwim', zeros(0, 2), ... % Image BB on W <- Not strictly w
'bbsize', zeros(0, 3), ... % Image BoundingBox (includes margins)
'mbbu', zeros(0, 2), ... % Real (Measured) Blob BB on U
'mbbv', zeros(0, 2), ... % Real (Measured) Blob BB on V
'mbbw', zeros(0, 2), ... % Real (Measured) Blob BB on W <- Not strictly w
'mbbsize', zeros(0, 3), ... % Real (Measured) Blob Bounding Box
'intensity', zeros(0, 1) ); % Blob original intensity
end
......@@ -16,18 +16,7 @@ function bl = gtFwdSimBuildDifstackBlobs(blobids, indexes, parameters, stackUSiz
indexes = 1:num_blobs;
end
bl(1:num_blobs) = struct( ...
'intm', [], ... % The normalized blob
'mask', [], ... % The segmentation mask
'bbuim', [], ... % Image BB on U
'bbvim', [], ... % Image BB on V
'bbwim', [], ... % Image BB on W <- Not strictly w
'bbsize', [], ... % Image BoundingBox (includes margins)
'mbbsize', [], ... % Real (Measured) Blob Bounding Box
'mbbu', [], ... % Real (Measured) Blob BB on U
'mbbv', [], ... % Real (Measured) Blob BB on V
'mbbw', [], ... % Real (Measured) Blob BB on W <- Not strictly w
'intensity', [] ); % Blob original intensity
bl(1:num_blobs) = gtFwdSimBlobDefinition();
for ii = reshape(indexes, 1, [])
[blob_vol, blob_bb, blob_mask, blob_int] = gtFwdSimBuildBlob(blobids(ii), parameters);
......
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