Fixed a datatype mismatch issue.
This commit is contained in:
parent
bbc4081b89
commit
3f33787237
@ -148,15 +148,17 @@ function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list,
|
||||
pb.run(' Done!');
|
||||
end
|
||||
end
|
||||
|
||||
% --- Convert cell array to numeric matrix after parfor ---
|
||||
|
||||
% --- Convert cell array to numeric matrix after parfor ---
|
||||
if nParams == 1
|
||||
raw_scan_parameter_values = cellfun(@(c)c, temp_scan_vals);
|
||||
raw_scan_parameter_values = reshape(raw_scan_parameter_values, 1, []); % Ensure it's a row vector
|
||||
raw_scan_parameter_values = cellfun(@double, temp_scan_vals); % enforce double here
|
||||
raw_scan_parameter_values = reshape(raw_scan_parameter_values, 1, []); % row vector
|
||||
else
|
||||
raw_scan_parameter_values = vertcat(temp_scan_vals{:}); % rows = files, cols = parameters
|
||||
raw_scan_parameter_values = cellfun(@double, temp_scan_vals, 'UniformOutput', false);
|
||||
raw_scan_parameter_values = vertcat(raw_scan_parameter_values{:}); % rows = files, cols = parameters
|
||||
end
|
||||
|
||||
% --- Determine scan reference values ---
|
||||
if (~isfield(options,'scan_reference_values') || isempty(options.scan_reference_values))
|
||||
if isvector(raw_scan_parameter_values)
|
||||
% Single parameter case
|
||||
@ -167,7 +169,8 @@ function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list,
|
||||
scan_reference_values = unique(raw_scan_parameter_values, 'rows', 'stable');
|
||||
end
|
||||
else
|
||||
scan_reference_values = options.scan_reference_values;
|
||||
% Ensure anything coming from options is also double **once, here**
|
||||
scan_reference_values = double(options.scan_reference_values);
|
||||
end
|
||||
end
|
||||
|
||||
@ -290,21 +293,14 @@ function [scanParamNames, nParams] = detectScanParametersFromFiles(fileNames, mi
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function writeFullODImagesToDisk(fullODImageFolder, od_img, bkg_img, scan_vals, file_name, idx)
|
||||
% Writes OD/BKG image + scan parameter(s) to a MAT file
|
||||
matFilePath = fullfile(fullODImageFolder, sprintf('Image_%04d.mat', idx));
|
||||
OD = single(od_img);
|
||||
BKG = single(bkg_img);
|
||||
File = string(file_name);
|
||||
|
||||
if isscalar(scan_vals)
|
||||
Scan = single(scan_vals);
|
||||
save(matFilePath, 'OD','BKG','Scan','File','-v7.3');
|
||||
else
|
||||
Scan = single(scan_vals); %#ok<NASGU>
|
||||
save(matFilePath, 'OD','BKG','Scan','File','-v7.3');
|
||||
end
|
||||
Scan = single(scan_vals);
|
||||
save(matFilePath, 'OD','BKG','Scan','File','-v7.3');
|
||||
end
|
||||
|
||||
function dataSource = makeDataSourceStruct(folderPath)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user