Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
graintracking
DCT
Commits
ab5d17a4
Commit
ab5d17a4
authored
Jun 23, 2022
by
Zheheng Liu
Browse files
detector l2 norm weight default structure.
Signed-off-by:
Zheheng Liu
<
zheheng.liu@esrf.fr
>
parent
5a6cf0cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
5_reconstruction/gtRecGrainsOptionsDetectorL2NormWeightDefaultParameters.m
0 → 100644
View file @
ab5d17a4
function detector_l2_norm_weight = gtRecGrainsOptionsDetectorL2NormWeightDefaultParameters(weight_type, weight_coef, acq)
possible_weight_types = {'linear','sqrt','log'};
if ((~exist('weight_type', 'var')) || (~ismember(lower(weight_type), possible_weight_types)))
detector_l2_norm_weight = [];
else
weight_type = lower(weight_type);
if ((~exist('weight_coef', 'var')) || isempty(weight_coef) || (~isnumeric(weight_coef)))
if (~exist('acq', 'var') || isempty(acq))
acq = gtLoadParameters;
acq = acq.acq;
end
weight_coef = sfCalcDarkImagesVariance(acq);
else
weight_coef = weight_coef(1);
end
detector_l2_norm_weight = struct('type', weight_type, 'coefficient', weight_coef);
end
end
function noise_var = sfCalcDarkImagesVariance(acq)
darkend = cell(1, acq.ndark);
for ii_dark = 1:acq.ndark
darkname = fullfile(acq.dir,'0_rawdata',acq.name,sprintf('darkend%04d.edf', ii_dark-1));
darkend{ii_dark} = edf_read(darkname);
end
darkend = cat(3, darkend{:});
dark = sum(darkend, 3) / acq.ndark;
darkend = bsxfun(@minus, darkend, dark);
noise_var = sum(darkend(:) .^ 2) / numel(dark(:)) / (acq.ndark - 1);
end
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment