From 855c16d0a0608dee72911de3e54677deb43e139d Mon Sep 17 00:00:00 2001 From: Tor Wager Date: Fri, 19 Jun 2026 18:05:00 -0400 Subject: [PATCH] Fix two walkthroughs for current CanlabCore API Surfaced by the hardened CanlabCore walkthrough smoke tests: - canlab_help_3_voxelwise_t_test_walkthrough: write() no longer silently overwrites an existing file. The script wrote example_t_image.nii then re-wrote the same path with 'thresh', which now errors. Pass 'overwrite' on both writes so the section is also idempotent on re-run. - canlab_help_4b_3D_visualization: per-image metadata for the kragel18 dataset now lives in .metadata_table, not the (now-empty) .dat_descrip, so metadata(1:5,:) / metadata.Domain failed. Read from .metadata_table. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../canlab_help_3_voxelwise_t_test_walkthrough.m | 6 ++++-- example_help_files/canlab_help_4b_3D_visualization.m | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example_help_files/canlab_help_3_voxelwise_t_test_walkthrough.m b/example_help_files/canlab_help_3_voxelwise_t_test_walkthrough.m index 06002e4..c3658b4 100644 --- a/example_help_files/canlab_help_3_voxelwise_t_test_walkthrough.m +++ b/example_help_files/canlab_help_3_voxelwise_t_test_walkthrough.m @@ -137,10 +137,12 @@ % get t-statistics for all voxels. t.fullpath = fullfile(pwd, 'example_t_image.nii'); -write(t) +write(t, 'overwrite') % If we use the 'thresh' option, we'll write thresholded values: -write(t, 'thresh') +% (write() does not overwrite an existing file unless asked, and we just +% wrote this path above, so pass 'overwrite' here too.) +write(t, 'thresh', 'overwrite') t_reloaded = statistic_image(t.fullpath, 'type', 'generic'); orthviews(t_reloaded) diff --git a/example_help_files/canlab_help_4b_3D_visualization.m b/example_help_files/canlab_help_4b_3D_visualization.m index 26c8f5b..ad99f6b 100644 --- a/example_help_files/canlab_help_4b_3D_visualization.m +++ b/example_help_files/canlab_help_4b_3D_visualization.m @@ -27,7 +27,7 @@ [test_images, names] = load_image_set('kragel18_alldata', 'noverbose'); % This field contains a table object with metadata for each image: -metadata = test_images.dat_descrip; +metadata = test_images.metadata_table; metadata(1:5, :) % Show the first 5 rows % Here are the 3 domains: