Major update and bugfixes to compute, collect OD images.
This commit is contained in:
parent
e64665af39
commit
93210fb5e6
@ -33,7 +33,7 @@ function [results, scan_parameter_values] = performAnalysis(options)
|
||||
options.skipLivePlot (1,1) logical
|
||||
options.skipSaveFigures (1,1) logical
|
||||
options.skipSaveData (1,1) logical
|
||||
options.skipSaveOD (1,1) logical
|
||||
options.skipSaveProcessedOD (1,1) logical
|
||||
options.skipFullODImagesFolderUse (1,1) logical
|
||||
options.showProgressBar (1,1) logical
|
||||
options.measurementName (1,:) char
|
||||
|
||||
@ -36,8 +36,9 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
scan_parameter_values = evalin('base','scan_parameter_values');
|
||||
file_list = evalin('base','file_list');
|
||||
|
||||
if ~options.skipSaveOD
|
||||
saveODFigures(od_imgs, options.saveDirectory);
|
||||
% --- Save OD images to disk if requested ---
|
||||
if ~options.skipSaveProcessedOD
|
||||
saveOD(od_imgs, options);
|
||||
end
|
||||
|
||||
return; % ✅ bypass cropping/background subtraction
|
||||
@ -219,52 +220,48 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
|
||||
% --- Optional unshuffling based on scan reference values ---
|
||||
if isfield(options, 'skipUnshuffling') && ~options.skipUnshuffling
|
||||
fprintf('\n[INFO] Reordering images according to scan parameter reference values...\n');
|
||||
|
||||
n_values = length(options.scan_reference_values);
|
||||
n_total = length(raw_scan_parameter_values);
|
||||
n_reps = n_total / n_values;
|
||||
|
||||
ordered_scan_parameter_values = zeros(1, n_total);
|
||||
ordered_od_imgs = cell(1, n_total);
|
||||
ordered_file_list = cell(1, n_total);
|
||||
counter = 1;
|
||||
|
||||
temp_scan_values = raw_scan_parameter_values;
|
||||
temp_od_imgs = od_imgs;
|
||||
temp_file_list = raw_file_list;
|
||||
|
||||
for rep = 1:n_reps
|
||||
for val = options.scan_reference_values
|
||||
idx = find(temp_scan_values == val, 1, 'first');
|
||||
if isempty(idx), continue; end
|
||||
ordered_scan_parameter_values(counter) = temp_scan_values(idx);
|
||||
ordered_od_imgs{counter} = temp_od_imgs{idx};
|
||||
ordered_file_list{counter} = temp_file_list{idx};
|
||||
temp_scan_values(idx) = NaN;
|
||||
temp_od_imgs{idx} = [];
|
||||
temp_file_list{idx} = [];
|
||||
counter = counter + 1;
|
||||
fprintf('\n[INFO] Reordering images...\n');
|
||||
|
||||
n_total = numel(raw_scan_parameter_values);
|
||||
n_values = numel(options.scan_reference_values);
|
||||
n_reps = n_total / n_values;
|
||||
tol = 1e-6; % tolerance for floating-point comparisons
|
||||
|
||||
idx_mat = nan(n_reps, n_values);
|
||||
|
||||
for j = 1:n_values
|
||||
% find all matches within tolerance
|
||||
idx_all = find(abs(raw_scan_parameter_values - options.scan_reference_values(j)) < tol);
|
||||
if numel(idx_all) ~= n_reps
|
||||
error('Reference value %.6g occurs %d times; expected %d', ...
|
||||
options.scan_reference_values(j), numel(idx_all), n_reps);
|
||||
end
|
||||
idx_mat(:, j) = idx_all(:); % column = all occurrences of this reference value
|
||||
end
|
||||
od_imgs = ordered_od_imgs;
|
||||
scan_parameter_values = ordered_scan_parameter_values;
|
||||
file_list = ordered_file_list;
|
||||
|
||||
% Reordered indices
|
||||
ordered_idx = reshape(idx_mat.', 1, []);
|
||||
|
||||
% Apply reorder
|
||||
od_imgs = od_imgs(ordered_idx);
|
||||
scan_parameter_values = raw_scan_parameter_values(ordered_idx);
|
||||
file_list = raw_file_list(ordered_idx);
|
||||
|
||||
fprintf('\n[INFO] Image reordering completed.\n');
|
||||
else
|
||||
scan_parameter_values = raw_scan_parameter_values;
|
||||
file_list = raw_file_list;
|
||||
end
|
||||
|
||||
|
||||
% --- Save processed dataset and options to workspace for reuse ---
|
||||
assignin('base', 'od_imgs', od_imgs);
|
||||
assignin('base', 'scan_parameter_values', scan_parameter_values);
|
||||
assignin('base', 'file_list', file_list);
|
||||
assignin('base', 'prior_options', options);
|
||||
|
||||
% --- Save OD images as figures to disk if requested ---
|
||||
if ~options.skipSaveOD
|
||||
saveODFigures(od_imgs, options.saveDirectory);
|
||||
|
||||
% --- Save OD images to disk if requested ---
|
||||
if ~options.skipSaveProcessedOD
|
||||
saveOD(od_imgs, options);
|
||||
end
|
||||
|
||||
fprintf('\n[INFO] OD image dataset ready for further analysis.\n');
|
||||
@ -286,35 +283,74 @@ function changed = haveOptionsChanged(options, prior_options, critical_fields)
|
||||
end
|
||||
end
|
||||
|
||||
function saveODFigures(od_imgs, saveDirectory)
|
||||
odFolder = fullfile(saveDirectory, "Results", "ODImages");
|
||||
if ~exist(odFolder, 'dir')
|
||||
mkdir(odFolder);
|
||||
function saveOD(od_img, options)
|
||||
% Saves a cell array of OD images (with metadata) to .mat files
|
||||
|
||||
nImgs = numel(od_img);
|
||||
if nImgs == 0
|
||||
error('[ERROR] No images found.');
|
||||
end
|
||||
|
||||
nImgs = length(od_imgs);
|
||||
filesExist = all(arrayfun(@(k) isfile(fullfile(odFolder, sprintf('OD_img_%03d.fig', k))), 1:nImgs));
|
||||
% --- Determine image size ---
|
||||
[ny, nx] = size(od_img{1}.OD);
|
||||
|
||||
% --- Create uniquely identified full OD image folder ---
|
||||
dataSource = makeDataSourceStruct(options.folderPath);
|
||||
runID = sprintf('%s_%s_Run%04d', ...
|
||||
dataSource{1}.sequence, ...
|
||||
strrep(dataSource{1}.date,'/','-'), ...
|
||||
dataSource{1}.runs);
|
||||
|
||||
% --- Determine parent folder for FullODImages ---
|
||||
if isfield(options, 'FullODImagesFoldersPath') && ...
|
||||
~isempty(options.FullODImagesFoldersPath) && ...
|
||||
isfolder(options.FullODImagesFoldersPath)
|
||||
parentFolder = options.FullODImagesFoldersPath;
|
||||
else
|
||||
parentFolder = options.saveDirectory;
|
||||
end
|
||||
|
||||
% --- Create uniquely identified full OD image folder ---
|
||||
fullODImageFolder = fullfile(parentFolder, ['FullODImages_' runID]);
|
||||
if ~exist(fullODImageFolder,'dir'), mkdir(fullODImageFolder); end
|
||||
fprintf('\n[INFO] Creating folder of full OD images on disk: %s\n', fullODImageFolder);
|
||||
|
||||
% --- Check if everything already exists ---
|
||||
filesExist = all(arrayfun(@(k) ...
|
||||
isfile(fullfile(fullODImageFolder, sprintf('Image_%04d.mat', k))), 1:nImgs)) ...
|
||||
&& isfile(fullfile(fullODImageFolder,'metadata.mat'));
|
||||
|
||||
if filesExist
|
||||
fprintf('\n[INFO] OD figures already exist in %s. Skipping save.\n', odFolder);
|
||||
fprintf('\n[INFO] OD .mat files already exist in %s. Skipping save.\n', fullODImageFolder);
|
||||
return;
|
||||
end
|
||||
|
||||
fprintf('\n[INFO] Saving OD figures to %s ...\n', odFolder);
|
||||
% --- Save metadata for this run ---
|
||||
metadata.options = options;
|
||||
metadata.timestamp = datetime; % record analysis time
|
||||
metadata.runID = runID; % traceable to experiment run
|
||||
metadata.imageSize = [ny, nx];
|
||||
metadata.fileList = string(cellfun(@(c) c.File, od_img, 'UniformOutput', false));
|
||||
save(fullfile(fullODImageFolder,'metadata.mat'),'metadata','-v7.3');
|
||||
|
||||
% --- Save each image ---
|
||||
for k = 1:nImgs
|
||||
img = od_imgs{k};
|
||||
% Expecting od_img{k} to be a struct with fields: OD, BKG, Scan, File
|
||||
if ~isstruct(od_img{k}) || ...
|
||||
~all(isfield(od_img{k}, {'OD','BKG','Scan','File'}))
|
||||
error('od_img{%d} must be a struct with fields OD, BKG, Scan, File.', k);
|
||||
end
|
||||
|
||||
% Create invisible figure for saving
|
||||
hFig = figure('Visible','off');
|
||||
imagesc(img);
|
||||
axis image off; colormap gray;
|
||||
fileName = fullfile(odFolder, sprintf('OD_img_%03d.fig', k));
|
||||
OD = single(od_img{k}.OD);
|
||||
BKG = single(od_img{k}.BKG);
|
||||
Scan = single(od_img{k}.Scan);
|
||||
File = string(od_img{k}.File);
|
||||
|
||||
% Save as .fig
|
||||
savefig(hFig, fileName);
|
||||
close(hFig);
|
||||
matFilePath = fullfile(fullODImageFolder, sprintf('Image_%04d.mat', k));
|
||||
save(matFilePath, 'OD','BKG','Scan','File','-v7.3');
|
||||
end
|
||||
fprintf('[INFO] OD figures saved successfully.\n');
|
||||
|
||||
fprintf('[INFO] OD .mat files and metadata saved successfully.\n');
|
||||
end
|
||||
|
||||
function dataSource = makeDataSourceStruct(folderPath)
|
||||
|
||||
@ -72,6 +72,8 @@ function [selectedPath, folderPath] = selectDataSourcePath(dataSources, options)
|
||||
end
|
||||
if ~isempty(matchedPaths)
|
||||
allPaths = matchedPaths;
|
||||
else
|
||||
error('No valid paths for data found. Aborting.');
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -10,29 +10,30 @@ dataSources = {
|
||||
options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.measurementName = 'BECToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'F:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'BECToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
% Fourier analysis settings
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
|
||||
options.k_min = 1.2771; % μm⁻¹
|
||||
options.k_max = 2.5541; % μm⁻¹
|
||||
@ -43,7 +44,7 @@ options.Angular_WindowSize = 5;
|
||||
options.zoom_size = 50;
|
||||
|
||||
% Scan parameter
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
|
||||
switch options.measurementName
|
||||
case 'BECToDroplets'
|
||||
@ -61,58 +62,28 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
options.skipSaveFigures = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipLivePlot = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
options.font = 'Bahnschrift';
|
||||
|
||||
%% ===== Build Paths from Data Sources =====
|
||||
|
||||
allPaths = {}; % initialize
|
||||
|
||||
for i = 1:length(dataSources)
|
||||
ds = dataSources{i};
|
||||
|
||||
% Split the date string into year/month/day
|
||||
dateParts = strsplit(ds.date, '/');
|
||||
|
||||
for run = ds.runs
|
||||
runStr = sprintf('%04d', run); % 4-digit run number
|
||||
fullPath = fullfile(options.baseDataFolder, ds.sequence, dateParts{:}, runStr);
|
||||
|
||||
if isfolder(fullPath) % only include valid directories
|
||||
allPaths{end+1} = fullPath;
|
||||
else
|
||||
warning('Path does not exist: %s', fullPath);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Let user select a single path
|
||||
set(0,'DefaultUicontrolFontSize',10); % increase default font size
|
||||
[selectedIndex, tf] = listdlg('PromptString','Select a path to analyze:', ...
|
||||
'SelectionMode','single', ...
|
||||
'ListString', allPaths, ...
|
||||
'ListSize',[400, 300]); % width x height in pixels
|
||||
if tf
|
||||
options.folderPath = allPaths{selectedIndex}; % ✅ store in options
|
||||
fprintf('Path set to selection: %s\n', options.folderPath);
|
||||
else
|
||||
error('No path selected. Aborting.');
|
||||
end
|
||||
|
||||
%% ===== Collect Images and Launch Viewer =====
|
||||
|
||||
[options.selectedPath, options.folderPath] = Helper.selectDataSourcePath(dataSources, options);
|
||||
|
||||
[od_imgs, scan_parameter_values, file_list] = Helper.collectODImages(options);
|
||||
|
||||
Analyzer.runInteractiveODImageViewer(od_imgs, scan_parameter_values, file_list, options);
|
||||
@ -11,6 +11,7 @@ options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'BECToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
@ -61,15 +62,18 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
options.skipSaveFigures = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
|
||||
@ -4,36 +4,36 @@
|
||||
dataSources = {
|
||||
struct('sequence', 'StructuralPhaseTransition', ...
|
||||
'date', '2025/08/16', ...
|
||||
'runs', [8, 9, 10]) % specify run numbers as a string in "" or just as a numeric value
|
||||
'runs', [8, 9, 10, 11, 12, 13]) % specify run numbers as a string in "" or just as a numeric value
|
||||
};
|
||||
|
||||
options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'F:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'DropletsToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 24.6;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
% Fourier analysis settings
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
|
||||
options.k_min = 1.2771; % μm⁻¹
|
||||
options.k_max = 2.5541; % μm⁻¹
|
||||
@ -44,7 +44,7 @@ options.Angular_WindowSize = 5;
|
||||
options.zoom_size = 50;
|
||||
|
||||
% Scan parameter
|
||||
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
||||
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
||||
|
||||
switch options.measurementName
|
||||
case 'BECToDroplets'
|
||||
@ -54,15 +54,15 @@ switch options.measurementName
|
||||
options.scan_reference_values = [2.45, 2.44, 2.43, 2.42, 2.4, 2.39, 2.38, 2.37, 2.36, 2.35, 2.34, 2.32, 2.3, 2.28, 2.25, 2.2, 2.15, 2.10, 2.0, 1.90, 1.8];
|
||||
options.titleString = 'BEC to Stripes';
|
||||
case 'DropletsToStripes'
|
||||
options.scan_reference_values = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45];
|
||||
options.scan_reference_values = [0, 5, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 35, 40];
|
||||
options.titleString = 'Droplets to Stripes';
|
||||
case 'StripesToDroplets'
|
||||
options.scan_reference_values = fliplr([0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
|
||||
options.scan_reference_values = fliplr([0, 5, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 35, 40]);
|
||||
options.titleString = 'Stripes to Droplets';
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipUnshuffling = true;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
@ -71,10 +71,10 @@ options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipLivePlot = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
|
||||
@ -11,10 +11,10 @@ options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'DropletsToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
@ -44,7 +44,7 @@ options.Angular_WindowSize = 5;
|
||||
options.zoom_size = 50;
|
||||
|
||||
% Scan parameter
|
||||
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
||||
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
||||
|
||||
switch options.measurementName
|
||||
case 'BECToDroplets'
|
||||
@ -62,7 +62,7 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipUnshuffling = true;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
@ -71,14 +71,15 @@ options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipLivePlot = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
options.font = 'Bahnschrift';
|
||||
|
||||
|
||||
%% ===== Run Batch Analysis =====
|
||||
results_all = Helper.batchAnalyze(dataSources, options);
|
||||
|
||||
@ -10,29 +10,30 @@ dataSources = {
|
||||
options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.measurementName = 'BECToDroplets';
|
||||
scriptFullPath ´= mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'F:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'BECToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
% Fourier analysis settings
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
|
||||
options.k_min = 1.2771; % μm⁻¹
|
||||
options.k_max = 2.5541; % μm⁻¹
|
||||
@ -43,7 +44,7 @@ options.Angular_WindowSize = 5;
|
||||
options.zoom_size = 50;
|
||||
|
||||
% Scan parameter
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
|
||||
switch options.measurementName
|
||||
case 'BECToDroplets'
|
||||
@ -61,56 +62,28 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipLivePlot = false;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
options.font = 'Bahnschrift';
|
||||
|
||||
%% ===== Build Paths from Data Sources =====
|
||||
|
||||
allPaths = {}; % initialize
|
||||
|
||||
for i = 1:length(dataSources)
|
||||
ds = dataSources{i};
|
||||
|
||||
% Split the date string into year/month/day
|
||||
dateParts = strsplit(ds.date, '/');
|
||||
|
||||
for run = ds.runs
|
||||
runStr = sprintf('%04d', run); % 4-digit run number
|
||||
fullPath = fullfile(options.baseDataFolder, ds.sequence, dateParts{:}, runStr);
|
||||
|
||||
if isfolder(fullPath) % only include valid directories
|
||||
allPaths{end+1} = fullPath;
|
||||
else
|
||||
warning('Path does not exist: %s', fullPath);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Let user select a single path
|
||||
set(0,'DefaultUicontrolFontSize',10); % increase default font size
|
||||
[selectedIndex, tf] = listdlg('PromptString','Select a path to analyze:', ...
|
||||
'SelectionMode','single', ...
|
||||
'ListString', allPaths, ...
|
||||
'ListSize',[400, 300]); % width x height in pixels
|
||||
if tf
|
||||
options.folderPath = allPaths{selectedIndex}; % ✅ store in options
|
||||
fprintf('Path set to selection: %s\n', options.folderPath);
|
||||
else
|
||||
error('No path selected. Aborting.');
|
||||
end
|
||||
|
||||
%% ===== Collect Images and Launch Viewer =====
|
||||
|
||||
[options.selectedPath, options.folderPath] = Helper.selectDataSourcePath(dataSources, options);
|
||||
|
||||
[od_imgs, scan_parameter_values, file_list] = Helper.collectODImages(options);
|
||||
|
||||
Analyzer.runInteractiveODImageViewer(od_imgs, scan_parameter_values, file_list, options);
|
||||
@ -10,29 +10,30 @@ dataSources = {
|
||||
options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.measurementName = 'BECToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'BECToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 24.6;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 24.6;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
% Fourier analysis settings
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
|
||||
options.k_min = 1.2771; % μm⁻¹
|
||||
options.k_max = 2.5541; % μm⁻¹
|
||||
@ -43,7 +44,7 @@ options.Angular_WindowSize = 5;
|
||||
options.zoom_size = 50;
|
||||
|
||||
% Scan parameter
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
options.scan_parameter = 'rot_mag_field';
|
||||
|
||||
switch options.measurementName
|
||||
case 'BECToDroplets'
|
||||
@ -61,15 +62,18 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
options.skipSaveFigures = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
|
||||
@ -4,35 +4,36 @@
|
||||
dataSources = {
|
||||
struct('sequence', 'StructuralPhaseTransition', ...
|
||||
'date', '2025/08/18', ...
|
||||
'runs', [10]) % specify run numbers as a string in "" or just as a numeric value
|
||||
'runs', [13]) % specify run numbers as a string in "" or just as a numeric value
|
||||
};
|
||||
|
||||
options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.measurementName = 'StripesToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'F:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'StripesToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
|
||||
% Camera / imaging
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 24.6;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
options.cam = 5;
|
||||
options.angle = 0;
|
||||
options.center = [1420, 2050];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 23.94;
|
||||
options.removeFringes = false;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
% Fourier analysis settings
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
options.theta_min = deg2rad(0);
|
||||
options.theta_max = deg2rad(180);
|
||||
options.N_radial_bins = 500;
|
||||
options.Radial_Sigma = 2;
|
||||
options.Radial_WindowSize = 5; % odd number
|
||||
|
||||
options.k_min = 1.2771; % μm⁻¹
|
||||
options.k_max = 2.5541; % μm⁻¹
|
||||
@ -61,56 +62,28 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipLivePlot = false;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
options.font = 'Bahnschrift';
|
||||
|
||||
%% ===== Build Paths from Data Sources =====
|
||||
|
||||
allPaths = {}; % initialize
|
||||
|
||||
for i = 1:length(dataSources)
|
||||
ds = dataSources{i};
|
||||
|
||||
% Split the date string into year/month/day
|
||||
dateParts = strsplit(ds.date, '/');
|
||||
|
||||
for run = ds.runs
|
||||
runStr = sprintf('%04d', run); % 4-digit run number
|
||||
fullPath = fullfile(options.baseDataFolder, ds.sequence, dateParts{:}, runStr);
|
||||
|
||||
if isfolder(fullPath) % only include valid directories
|
||||
allPaths{end+1} = fullPath;
|
||||
else
|
||||
warning('Path does not exist: %s', fullPath);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Let user select a single path
|
||||
set(0,'DefaultUicontrolFontSize',10); % increase default font size
|
||||
[selectedIndex, tf] = listdlg('PromptString','Select a path to analyze:', ...
|
||||
'SelectionMode','single', ...
|
||||
'ListString', allPaths, ...
|
||||
'ListSize',[400, 300]); % width x height in pixels
|
||||
if tf
|
||||
options.folderPath = fullfile(allPaths{selectedIndex}); % ✅ store in options
|
||||
fprintf('Path set to selection: %s\n', options.folderPath);
|
||||
else
|
||||
error('No path selected. Aborting.');
|
||||
end
|
||||
|
||||
%% ===== Collect Images and Launch Viewer =====
|
||||
|
||||
[options.selectedPath, options.folderPath] = Helper.selectDataSourcePath(dataSources, options);
|
||||
|
||||
[od_imgs, scan_parameter_values, file_list] = Helper.collectODImages(options);
|
||||
|
||||
Analyzer.runInteractiveODImageViewer(od_imgs, scan_parameter_values, file_list, options);
|
||||
@ -11,6 +11,7 @@ options = struct();
|
||||
|
||||
% File / paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'StripesToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
@ -61,20 +62,24 @@ switch options.measurementName
|
||||
end
|
||||
|
||||
% Flags
|
||||
options.skipNormalization = false;
|
||||
options.skipUnshuffling = false;
|
||||
options.skipNormalization = false;
|
||||
|
||||
options.skipPreprocessing = true;
|
||||
options.skipMasking = true;
|
||||
options.skipIntensityThresholding = true;
|
||||
options.skipBinarization = true;
|
||||
options.skipSaveFigures = true;
|
||||
|
||||
options.skipFullODImagesFolderUse = false;
|
||||
options.skipSaveData = false;
|
||||
options.skipSaveOD = true;
|
||||
options.skipSaveFigures = true;
|
||||
options.skipSaveProcessedOD = true;
|
||||
options.skipLivePlot = true;
|
||||
options.showProgressBar = true;
|
||||
|
||||
% Extras
|
||||
options.font = 'Bahnschrift';
|
||||
|
||||
|
||||
%% ===== Run Batch Analysis =====
|
||||
results_all = Helper.batchAnalyze(dataSources, options);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user