function results = export_dataset_previews_to_website(varargin)
%EXPORT_DATASET_PREVIEWS_TO_WEBSITE  Beamform each registry dataset and save PNG previews for the website.
%
%   Run from MATLAB with USTB on the path (repository root):
%     addpath('examples/dataset_smoke_tests');
%     addpath('examples/dataset_catalog_previews');
%     export_dataset_previews_to_website();
%
%   Beamforming matches examples/dataset_catalog_previews/dataset_preview_beamform.m
%   (one case per dataset, copied from the canonical example script).
%
%   Writes PNGs to website/assets/images/datasets/<slug>.png using the same
%   naming as website/scripts/build_datasets_page.py (see website_slug_for_dataset).
%
%   Name-value:
%     'url'              — primary dataset base (default 'https://www.ustb.no/datasets',
%                          no trailing slash)
%     'stop_on_error'    — default false
%     'website_root'     — override path to repo root (default: ustb_path())
%     'indices'          — optional row vector of 1-based indices into the registry
%                          (default: all). Use to split export across runs and limit memory.
%     'local_only'       — if true, do not download: only process files already in
%                          data_path(); missing files get a gray stub (default false).
%
%   Tries several public URL bases if the first returns 404. Missing files get a
%   gray stub PNG so the website still has one image per row.
%
%   After exporting, regenerate the HTML:
%     python3 website/scripts/build_datasets_page.py

p = inputParser;
addParameter(p, 'url', 'https://www.ustb.no/datasets', @(s) ischar(s) || isstring(s));
addParameter(p, 'stop_on_error', false, @islogical);
addParameter(p, 'website_root', '', @(s) ischar(s) || isstring(s));
addParameter(p, 'indices', [], @(x) isempty(x) || (isnumeric(x) && isvector(x) && all(x > 0)));
addParameter(p, 'local_only', false, @islogical);
parse(p, varargin{:});

repo_root = fileparts(fileparts(fileparts(mfilename('fullpath'))));
addpath(fullfile(repo_root, 'examples', 'dataset_catalog_previews'));

primary_url = normalize_dataset_base(char(p.Results.url));
stop_on_error = p.Results.stop_on_error;
local_only = p.Results.local_only;
if isempty(p.Results.website_root)
    root = ustb_path();
else
    root = char(p.Results.website_root);
end

out_dir = fullfile(root, 'website', 'assets', 'images', 'datasets');
if ~isfolder(out_dir)
    mkdir(out_dir);
end

local_path = data_path();
if local_path(end) ~= filesep
    local_path = [local_path filesep];
end

T = uff_dataset_registry();
idx = p.Results.indices;
if ~isempty(idx)
    idx = unique(round(idx(:)'));
    idx = idx(idx <= numel(T));
    T = T(idx);
end
n = numel(T);
results = repmat(struct('filename', '', 'ok', false, 'message', '', 'png', ''), n, 1);

fprintf('Exporting %d dataset preview(s) -> %s\n', n, out_dir);

for i = 1:n
    fn = T(i).filename;
    results(i).filename = fn;

    uff_file = fullfile(local_path, fn);
    dl_ok = false;
    last_err = '';
    if local_only
        if isfile(uff_file)
            dl_ok = true;
        else
            last_err = 'local_only: file not in data_path()';
        end
    else
        for ub = dataset_url_bases(primary_url)
            try
                tools.download(fn, ub{1}, local_path);
                dl_ok = true;
                break
            catch ME
                last_err = ME.message;
            end
        end
    end
    if ~dl_ok
        results(i).message = ['Download failed: ' last_err];
        fprintf('[FAIL] %s — %s\n', fn, results(i).message);
        slug = website_slug_for_dataset(fn);
        write_gray_stub_preview(fullfile(out_dir, [slug '.png']), fn);
        fprintf('       (wrote gray stub preview %s.png)\n', slug);
        if stop_on_error
            return
        else
            continue
        end
    end
    try
        b_data = dataset_preview_beamform(uff_file);
    catch ME
        results(i).message = ME.message;
        fprintf('[FAIL] %s — %s\n', fn, ME.message);
        slug = website_slug_for_dataset(fn);
        write_gray_stub_preview(fullfile(out_dir, [slug '.png']), fn);
        if stop_on_error
            return
        else
            continue
        end
    end

    if isempty(b_data)
        results(i).message = 'empty b_data';
        fprintf('[FAIL] %s — empty b_data\n', fn);
        slug = website_slug_for_dataset(fn);
        write_gray_stub_preview(fullfile(out_dir, [slug '.png']), fn);
        if stop_on_error
            return
        else
            continue
        end
    end

    slug = website_slug_for_dataset(fn);
    png_path = fullfile(out_dir, [slug '.png']);
    try
        export_png_like_b_data_plot(b_data, png_path);
    catch ME
        results(i).message = ME.message;
        fprintf('[FAIL] %s — PNG: %s\n', fn, ME.message);
        write_gray_stub_preview(png_path, fn);
        if stop_on_error
            return
        else
            continue
        end
    end

    results(i).ok = true;
    results(i).png = png_path;
    results(i).message = 'ok';
    fprintf('[ OK ] %s -> %s\n', fn, png_path);
    clear b_data
end

n_ok = sum([results.ok]);
fprintf('Finished: %d / %d beamformed preview(s); stubs used for the rest.\n', n_ok, n);
end

function s = normalize_dataset_base(u)
s = strtrim(u);
while endsWith(s, '/')
    s = s(1:end-1);
end
end

function C = dataset_url_bases(primary)
bases = {
    primary
    'https://www.ustb.no/datasets'
    'http://www.ustb.no/datasets'
    'https://ustb.no/datasets'
    'http://ustb.no/datasets'
    'https://www.ultrasoundtoolbox.com/datasets'
    };
C = {};
for k = 1:numel(bases)
    b = normalize_dataset_base(char(bases{k}));
    if isempty(b)
        continue
    end
    if ~any(strcmp(C, b))
        C{end+1} = b; %#ok<AGROW>
    end
end
end

function write_gray_stub_preview(path, label)
% Minimal 400x260 RGB PNG without Image Processing Toolbox.
% Neutral gray (R=G=B) — a green-only channel was used previously and looked
% like a bad beamformed image on the public datasets page.
w = 400; h = 260;
gray = uint8(218 * ones(h, w));
rgb = cat(3, gray, gray, gray);
if exist('imwrite', 'file') == 2 %#ok<EXIST>
    imwrite(rgb, path);
else
    error('imwrite not available; install Image Processing Toolbox or use Octave with imwrite.');
end
% Optional: could overlay text with getframe+text — keep file dependency-free
if nargin >= 2 && ~isempty(label)
    % label unused in minimal stub (filename is in page already)
end
end
Exporting 33 dataset preview(s) -> C:\Repositories\ustb\website\assets\images\datasets
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.03 seconds.
[ OK ] Verasonics_P2-4_parasternal_long_small.uff -> C:\Repositories\ustb\website\assets\images\datasets\Verasonics_P2-4_parasternal_long_small_349ea15ea0.png
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.16 seconds.
[ OK ] L7_FI_IUS2018.uff -> C:\Repositories\ustb\website\assets\images\datasets\L7_FI_IUS2018_6771227a20.png
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 1.25 seconds.
[ OK ] L7_CPWC_193328.uff -> C:\Repositories\ustb\website\assets\images\datasets\L7_CPWC_193328_3a69ce8261.png
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
Warning: You just deleted all frames except frames 1 to 1, I hope you meant to! 
USTB MEX C beamformer...Completed in 0.17 seconds.
[ OK ] L7_CPWC_TheGB.uff -> C:\Repositories\ustb\website\assets\images\datasets\L7_CPWC_TheGB_a678c24311.png
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.12 seconds.
[ OK ] Alpinion_L3-8_FI_hyperechoic_scatterers.uff -> C:\Repositories\ustb\website\assets\images\datasets\Alpinion_L3-8_FI_hyperechoic_scatterers_59ee310b06.png
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.76 seconds.
[ OK ] Alpinion_L3-8_FI_hypoechoic.uff -> C:\Repositories\ustb\website\assets\images\datasets\Alpinion_L3-8_FI_hypoechoic_60462b935d.png
USTB download tool
File:		Alpinion_L3-8_CPWC_hyperechoic_scatterers.uff
URL:		https://www.ustb.no/datasets/Alpinion_L3-8_CPWC_hy
			perechoic_scatterers.uff
Path:		C:\Repositories\ustb\data\
Downloading 48 / 48 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 1.68 seconds.
[ OK ] Alpinion_L3-8_CPWC_hyperechoic_scatterers.uff -> C:\Repositories\ustb\website\assets\images\datasets\Alpinion_L3-8_CPWC_hyperechoic_scatterer_4e132ff93e.png
USTB download tool
File:		FieldII_STAI_uniform_fov.uff
URL:		https://www.ustb.no/datasets/FieldII_STAI_uniform_
			fov.uff
Path:		C:\Repositories\ustb\data\
Downloading 488 / 488 MB...done!
UFF: reading channel_data_speckle [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
Warning: The modulation frequency is not specified. The estimated central
frequency will be used.  
Estimating power spectrum
Warning: The downsampling frequency is not specified. Using 2 *
modulation_frequency. 
Warning: The input sample frequency is not a multiple of the specified
downsample frequency. Rounding up the downsample frequency to the next higher
downsample frequency. 
Low-pass filtering
USTB MEX C beamformer...Completed in 5.39 seconds.
[ OK ] FieldII_STAI_uniform_fov.uff -> C:\Repositories\ustb\website\assets\images\datasets\FieldII_STAI_uniform_fov_57ca2ce70a.png
USTB download tool
File:		FieldII_STAI_dynamic_range.uff
URL:		https://www.ustb.no/datasets/FieldII_STAI_dynamic_
			range.uff
Path:		C:\Repositories\ustb\data\
Downloading 840 / 840 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 15.79 seconds.
[ OK ] FieldII_STAI_dynamic_range.uff -> C:\Repositories\ustb\website\assets\images\datasets\FieldII_STAI_dynamic_range_7defa896ae.png
USTB download tool
File:		ARFI_dataset.uff
URL:		https://www.ustb.no/datasets/ARFI_dataset.uff
Path:		C:\Repositories\ustb\data\
Downloading 171 / 171 MB...done!
UFF: reading channel_data [uff.channel_data]
USTB MEX C beamformer...Completed in 2.51 seconds.
[ OK ] ARFI_dataset.uff -> C:\Repositories\ustb\website\assets\images\datasets\ARFI_dataset_975d54224a.png
USTB download tool
File:		PICMUS_experiment_resolution_distortion.uff
URL:		https://www.ustb.no/datasets/PICMUS_experiment_res
			olution_distortion.uff
Path:		C:\Repositories\ustb\data\
Downloading 146 / 146 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 3.57 seconds.
[ OK ] PICMUS_experiment_resolution_distortion.uff -> C:\Repositories\ustb\website\assets\images\datasets\PICMUS_experiment_resolution_distortion_4a72668fec.png
USTB download tool
File:		PICMUS_simulation_resolution_distortion.uff
URL:		https://www.ustb.no/datasets/PICMUS_simulation_res
			olution_distortion.uff
Path:		C:\Repositories\ustb\data\
Downloading 76 / 76 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 3.38 seconds.
[ OK ] PICMUS_simulation_resolution_distortion.uff -> C:\Repositories\ustb\website\assets\images\datasets\PICMUS_simulation_resolution_distortion_c02d616c5a.png
USTB download tool
File:		PICMUS_experiment_contrast_speckle.uff
URL:		https://www.ustb.no/datasets/PICMUS_experiment_con
			trast_speckle.uff
Path:		C:\Repositories\ustb\data\
Downloading 146 / 146 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 3.53 seconds.
[ OK ] PICMUS_experiment_contrast_speckle.uff -> C:\Repositories\ustb\website\assets\images\datasets\PICMUS_experiment_contrast_speckle_a8b79c234f.png
USTB download tool
File:		PICMUS_simulation_contrast_speckle.uff
URL:		https://www.ustb.no/datasets/PICMUS_simulation_con
			trast_speckle.uff
Path:		C:\Repositories\ustb\data\
Downloading 90 / 90 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 3.23 seconds.
[ OK ] PICMUS_simulation_contrast_speckle.uff -> C:\Repositories\ustb\website\assets\images\datasets\PICMUS_simulation_contrast_speckle_5e1c201b01.png
USTB download tool
File:		PICMUS_carotid_cross.uff
URL:		https://www.ustb.no/datasets/PICMUS_carotid_cross.
			uff
Path:		C:\Repositories\ustb\data\
Downloading 77 / 77 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 3.60 seconds.
[ OK ] PICMUS_carotid_cross.uff -> C:\Repositories\ustb\website\assets\images\datasets\PICMUS_carotid_cross_63d28bc79c.png
USTB download tool
File:		Verasonics_P2-4_parasternal_long_subject_1.uff
URL:		https://www.ustb.no/datasets/Verasonics_P2-4_paras
			ternal_long_subject_1.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		Verasonics_P2-4_parasternal_long_subject_1.uff
URL:		http://www.ustb.no/datasets/Verasonics_P2-4_parast
			ernal_long_subject_1.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		Verasonics_P2-4_parasternal_long_subject_1.uff
URL:		https://ustb.no/datasets/Verasonics_P2-4_parastern
			al_long_subject_1.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		Verasonics_P2-4_parasternal_long_subject_1.uff
URL:		http://ustb.no/datasets/Verasonics_P2-4_parasterna
			l_long_subject_1.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		Verasonics_P2-4_parasternal_long_subject_1.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/Verason
			ics_P2-4_parasternal_long_subject_1.uff
Path:		C:\Repositories\ustb\data\
[FAIL] Verasonics_P2-4_parasternal_long_subject_1.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview Verasonics_P2-4_parasternal_long_subject_87796bb303.png)
USTB download tool
File:		FieldII_P4_point_scatterers.uff
URL:		https://www.ustb.no/datasets/FieldII_P4_point_scat
			terers.uff
Path:		C:\Repositories\ustb\data\
Downloading 489 / 489 MB...done!
UFF: reading ./channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.10 seconds.
[ OK ] FieldII_P4_point_scatterers.uff -> C:\Repositories\ustb\website\assets\images\datasets\FieldII_P4_point_scatterers_693678b549.png
USTB download tool
File:		experimental_STAI_dynamic_range.uff
URL:		https://www.ustb.no/datasets/experimental_STAI_dyn
			amic_range.uff
Path:		C:\Repositories\ustb\data\
Downloading 1137 / 1137 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
Warning: The downsampling frequency is not specified. Using 2 *
modulation_frequency. 
Warning: The input sample frequency is not a multiple of the specified
downsample frequency. Rounding up the downsample frequency to the next higher
downsample frequency. 
Band-pass filtering
Low-pass filtering
USTB MEX C beamformer...Completed in 11.95 seconds.
[ OK ] experimental_STAI_dynamic_range.uff -> C:\Repositories\ustb\website\assets\images\datasets\experimental_STAI_dynamic_range_25395edf60.png
USTB download tool
File:		FieldII_STAI_axial_gradient_v2.uff
URL:		https://www.ustb.no/datasets/FieldII_STAI_axial_gr
			adient_v2.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_axial_gradient_v2.uff
URL:		http://www.ustb.no/datasets/FieldII_STAI_axial_gra
			dient_v2.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_axial_gradient_v2.uff
URL:		https://ustb.no/datasets/FieldII_STAI_axial_gradie
			nt_v2.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_axial_gradient_v2.uff
URL:		http://ustb.no/datasets/FieldII_STAI_axial_gradien
			t_v2.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_axial_gradient_v2.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/FieldII
			_STAI_axial_gradient_v2.uff
Path:		C:\Repositories\ustb\data\
[FAIL] FieldII_STAI_axial_gradient_v2.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview FieldII_STAI_axial_gradient_v2_e9644d0377.png)
USTB download tool
File:		FieldII_STAI_gradient_full_field_100.uff
URL:		https://www.ustb.no/datasets/FieldII_STAI_gradient
			_full_field_100.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_gradient_full_field_100.uff
URL:		http://www.ustb.no/datasets/FieldII_STAI_gradient_
			full_field_100.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_gradient_full_field_100.uff
URL:		https://ustb.no/datasets/FieldII_STAI_gradient_ful
			l_field_100.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_gradient_full_field_100.uff
URL:		http://ustb.no/datasets/FieldII_STAI_gradient_full
			_field_100.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		FieldII_STAI_gradient_full_field_100.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/FieldII
			_STAI_gradient_full_field_100.uff
Path:		C:\Repositories\ustb\data\
[FAIL] FieldII_STAI_gradient_full_field_100.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview FieldII_STAI_gradient_full_field_100_79249f822d.png)
USTB download tool
File:		P4_FI_121444_45mm_focus.uff
URL:		https://www.ustb.no/datasets/P4_FI_121444_45mm_foc
			us.uff
Path:		C:\Repositories\ustb\data\
Downloading 269 / 269 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
Warning: You just deleted all frames except frames 1 to 1, I hope you meant to! 
USTB MEX C beamformer...Completed in 0.04 seconds.
[ OK ] P4_FI_121444_45mm_focus.uff -> C:\Repositories\ustb\website\assets\images\datasets\P4_FI_121444_45mm_focus_17da88fdcf.png
USTB download tool
File:		FieldII_speckle_simulation.uff
URL:		https://www.ustb.no/datasets/FieldII_speckle_simul
			ation.uff
Path:		C:\Repositories\ustb\data\
Downloading 523 / 523 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 6.42 seconds.
[ OK ] FieldII_speckle_simulation.uff -> C:\Repositories\ustb\website\assets\images\datasets\FieldII_speckle_simulation_acea0dc1a0.png
USTB download tool
File:		test02.uff
URL:		https://www.ustb.no/datasets/test02.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		test02.uff
URL:		http://www.ustb.no/datasets/test02.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		test02.uff
URL:		https://ustb.no/datasets/test02.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		test02.uff
URL:		http://ustb.no/datasets/test02.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		test02.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/test02.
			uff
Path:		C:\Repositories\ustb\data\
[FAIL] test02.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview test02_4d5e2a8855.png)
USTB download tool
File:		speckle_sim_FI_P4_probe_apod_3_speckle_long_many_a
			ngles.uff
URL:		https://www.ustb.no/datasets/speckle_sim_FI_P4_pro
			be_apod_3_speckle_long_many_angles.uff
Path:		C:\Repositories\ustb\data\
Downloading 608 / 608 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.63 seconds.
[ OK ] speckle_sim_FI_P4_probe_apod_3_speckle_long_many_angles.uff -> C:\Repositories\ustb\website\assets\images\datasets\speckle_sim_FI_P4_probe_apod_3_speckle_l_08480ca365.png
USTB download tool
File:		L7_FI_Verasonics_CIRS_points.uff
URL:		https://www.ustb.no/datasets/L7_FI_Verasonics_CIRS
			_points.uff
Path:		C:\Repositories\ustb\data\
Downloading 135 / 135 MB...done!
UFF: reading /channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.13 seconds.
[ OK ] L7_FI_Verasonics_CIRS_points.uff -> C:\Repositories\ustb\website\assets\images\datasets\L7_FI_Verasonics_CIRS_points_5e632ca6b5.png
USTB download tool
File:		L7_FI_carotid_cross_sub_2.uff
URL:		https://www.ustb.no/datasets/L7_FI_carotid_cross_s
			ub_2.uff
Path:		C:\Repositories\ustb\data\
Downloading 264 / 264 MB...done!
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 0.28 seconds.
[ OK ] L7_FI_carotid_cross_sub_2.uff -> C:\Repositories\ustb\website\assets\images\datasets\L7_FI_carotid_cross_sub_2_a120f2ea81.png
USTB download tool
File:		invitro_20.uff
URL:		https://www.ustb.no/datasets/invitro_20.uff
Path:		C:\Repositories\ustb\data\
Downloading 2015 / 2015 MB...done!
UFF: reading /mix [uff.channel_data]
UFF: reading sequence [uff.wave] [====================] 100%
USTB MEX C beamformer...Completed in 20.02 seconds.
[ OK ] invitro_20.uff -> C:\Repositories\ustb\website\assets\images\datasets\invitro_20_dd96cc8a68.png
USTB download tool
File:		insilico_side_100_M45.uff
URL:		https://www.ustb.no/datasets/insilico_side_100_M45
			.uff
Path:		C:\Repositories\ustb\data\
Downloading 6556 / 6556 MB...done!
USTB download tool
File:		insilico_side_100_M45.uff
URL:		http://www.ustb.no/datasets/insilico_side_100_M45.
			uff
Path:		C:\Repositories\ustb\data\
Downloading 6556 / 6556 MB...done!
USTB download tool
File:		insilico_side_100_M45.uff
URL:		https://ustb.no/datasets/insilico_side_100_M45.uff
Path:		C:\Repositories\ustb\data\
Downloading 6556 / 6556 MB...done!
USTB download tool
File:		insilico_side_100_M45.uff
URL:		http://ustb.no/datasets/insilico_side_100_M45.uff
Path:		C:\Repositories\ustb\data\
Downloading 6556 / 6556 MB...done!
USTB download tool
File:		insilico_side_100_M45.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/insilic
			o_side_100_M45.uff
Path:		C:\Repositories\ustb\data\
[FAIL] insilico_side_100_M45.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview insilico_side_100_M45_fe7dba6df7.png)
USTB download tool
File:		insilico_20.uff
URL:		https://www.ustb.no/datasets/insilico_20.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		insilico_20.uff
URL:		http://www.ustb.no/datasets/insilico_20.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		insilico_20.uff
URL:		https://ustb.no/datasets/insilico_20.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		insilico_20.uff
URL:		http://ustb.no/datasets/insilico_20.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		insilico_20.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/insilic
			o_20.uff
Path:		C:\Repositories\ustb\data\
[FAIL] insilico_20.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview insilico_20_56e78c99c2.png)
USTB download tool
File:		FieldII_CPWC_point_scatterers_res_v2.uff
URL:		https://www.ustb.no/datasets/FieldII_CPWC_point_sc
			atterers_res_v2.uff
Path:		C:\Repositories\ustb\data\
Downloading 91 / 91 MB...done!
UFF: reading channel_data [uff.channel_data]
USTB MEX C beamformer...Completed in 0.16 seconds.
[ OK ] FieldII_CPWC_point_scatterers_res_v2.uff -> C:\Repositories\ustb\website\assets\images\datasets\FieldII_CPWC_point_scatterers_res_v2_c479fef61e.png
USTB download tool
File:		P4_FI.uff
URL:		https://www.ustb.no/datasets/P4_FI.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		P4_FI.uff
URL:		http://www.ustb.no/datasets/P4_FI.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		P4_FI.uff
URL:		https://ustb.no/datasets/P4_FI.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		P4_FI.uff
URL:		http://ustb.no/datasets/P4_FI.uff
Path:		C:\Repositories\ustb\data\
USTB download tool
File:		P4_FI.uff
URL:		https://www.ultrasoundtoolbox.com/datasets/P4_FI.u
			ff
Path:		C:\Repositories\ustb\data\
[FAIL] P4_FI.uff — Download failed: Dot indexing is not supported for variables of this type.
       (wrote gray stub preview P4_FI_70a5875e17.png)
USTB download tool
File:		beamformed_simulated_data.uff
URL:		https://www.ustb.no/datasets/beamformed_simulated_
			data.uff
Path:		C:\Repositories\ustb\data\
Downloading 1244 / 1244 MB...done!
UFF: reading b_data_das [uff.beamformed_data]
[ OK ] beamformed_simulated_data.uff -> C:\Repositories\ustb\website\assets\images\datasets\beamformed_simulated_data_640b6a4360.png
USTB download tool
File:		beamformed_experimental_data.uff
URL:		https://www.ustb.no/datasets/beamformed_experiment
			al_data.uff
Path:		C:\Repositories\ustb\data\
Downloading 777 / 777 MB...done!
UFF: reading b_data_das [uff.beamformed_data]
[ OK ] beamformed_experimental_data.uff -> C:\Repositories\ustb\website\assets\images\datasets\beamformed_experimental_data_456dd17307.png
Finished: 26 / 33 beamformed preview(s); stubs used for the rest.

ans = 

  33×1 struct array with fields:

    filename
    ok
    message
    png