Merge current development version (pre-v0.5) - #111
Merged
Conversation
…djusted in other instances as well
[fix & enhancement] localite_path fallback, slurm submission formate error, padding makeBowl, transducer position plot error, wrong parameter passing to recompute Oneil and nii_image gpuArray/cpuArray issue
…o RAS mm, reformat txt
…ases phase_optimization_annulus_full_curve: rename i_axial_oneil/p_axial_oneil to i_axial/p_axial throughout. perform_global_search: add opt_use_initial_phases parameter. When true, seeds all three precession_mode branches (linear, monotonic, default) from transducer.annular.elem_phase_rad instead of random initialization. For linear mode a least-squares fit extracts phase_start and phase_step from the existing phases; for monotonic mode finite differences yield initial increments; for the default mode the phases are used directly.
doc_calibration: steps renumbered; Step 2 is now analytical bootstrap (not free-water sim); opt_use_initial_phases documented; geometric correction mode section added; forward model selection table added; Step 11 cache cleanup noted. doc_advanced: sequential_configs field-naming clarified; parameter table expanded with adopted_cem43_iso and sequential_cleanup_intermediate; async duty-cycle description corrected; staggered firing section added. doc_parameters: adopted_cem43_iso added; smooth_method documents off; opt_use_initial_phases added to calibration table. doc_preproc: parameter names updated to current API; off smoothing method documented; csf_expansion units clarified; smooth_properties reference updated. doc_telemetry: prestus_ver clarified as version string; prestus_hash added as separate field; dashboard query updated.
SimNIBS subject2mni has no cval parameter; out-of-FOV voxels are always written as 0. Adds options.FillValues (scalar or per-volume vector) that post-hoc replaces 0-valued voxels with the requested fill value. nifti_thermal passes mni_fills (water baseline for heating volumes, 0 for others) as FillValues, restoring the per-volume fill correction that was dropped when the MNI call was batched.
Add six drop-in replacement functions in functions/transform/ that remove
the dependency on the Image Processing Toolbox across all of PRESTUS:
affine_resample_3d — replaces tformarray / maketform / makeresampler
affine_bounds — replaces findbounds(maketform(...))
affine_apply_pts — replaces tformfwd(pts, maketform(...))
bwconncomp_3d — replaces bwconncomp
imfill_holes_3d — replaces imfill(..., 'holes')
nearest_fill_nan — replaces bwdist-based nearest-fill pattern
All call sites in head/, nifti/, helper/, plot/, source/, thermal/,
acoustic/, group/, and transducer/ are updated accordingly.
convert_final_to_MNI_simnibs gains a 'native' method that applies the
nonlinear warp (MNI2Conform_nonl.nii.gz) directly via griddedInterpolant,
replacing the SimNIBS subject2mni CLI call. The method is controlled by
parameters.analysis.mni_warp_method ('simnibs' default); all callers
propagate this setting inline.
convert_final_to_MNI_matlab is updated to use affine_resample_3d in place
of tformarray. Its docstring clarifies the distinction from the simnibs
native mode: the matlab function applies the 12-DOF affine on an in-memory
array and returns the composite affine; the simnibs function (either method)
applies the nonlinear warp and writes NIfTIs to disk.
bwconncomp_3d, imfill_holes_3d, and nearest_fill_nan are image processing utilities (connectivity, hole-filling, nearest-fill), not spatial transforms. transform/ should contain coordinate/affine operations only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…k guard - compute_phases: flip aim_wrt_natural_focus sign (focus_wrt_mid_bowl - curv_radius) - calibration_setup: drop NaN-padded columns from ragged CSVs read by readmatrix - calibrate_transducer: seed global search from geometric phases at reference depth - perform_global_search: use phase_start0 from seeded path in monotonic initial guess - fit_velocity_to_intensity: guard skip_front_peak_mm field existence before access
MATLAB pass-by-value means caller's temp_0 stays 2D after thermal_simulation calls radialExpand2DTo3D internally; detect size mismatch and re-expand here.
…ainty bands - uncertainty_pipeline: chain sequential_configs runs on matlab/slurm/qsub platforms; prefix job names with r1-/r2- when sequential configs are present - generate_sequential_report: add uncertainty_variant_params arg for liberal/conservative shaded-band overlay on thermal timeseries plots - generate_uncertainty_report: add per-layer and global uncertainty band timeseries plots to the thermal section (temperature and CEM43 with liberal/conservative envelope)
Adds six new fields to the telemetry payload: - os_version, cpu_model, n_cpu_cores, ram_gb via platform-specific system calls (mac/linux/windows), all wrapped in try/catch - gpu_model via gpuDevice(); returns 'no_pct' when PCT is unlicensed, 'none' when no GPU is found, otherwise the device name - toolboxes as a cell array of installed toolbox names (MATLAB excluded) Companion Supabase migration adds matching columns to the events table.
…lid simulated_analytical_scaling In global search mode, the correction simulation was run with initial phases while Stage 5s analytical comparison used the optimised phases, making simulated_analytical_scaling a ratio of two different acoustic fields rather than a clean model-vs-simulation ratio. - Inject optimised phases into sim_param before the correction sim (global search mode only; geo correction mode cannot do this because combined phases are not known until after the sim resolves steering) - When run_free_water_sim=false, re-evaluate profile_sim analytically with optimised phases so scaling=1 as documented in extract_analytical_profile - Update plot_opt_sim_results labels to reflect actual profile contents: Original (Analytical) -> Phase-optimised (Analytical) Optimized (Analytical) -> Amplitude-calibrated (Analytical) Original (Simulated) -> Correction sim (Simulated)
…nter grid grid_axisymmetry now saves the bilateral dims and transducer/focus positions before halving the grid, and splits at the actual transducer column (r=0) instead of floor(dims/2), preventing a one-voxel radial shift. convert_axisymmetric_to_2d/3d restore the original bilateral dimensions from the snapshot instead of naively doubling Nr, so the output always matches what a full bilateral simulation would have produced. radialExpand2DTo3D accepts optional output_size and center arguments to support exact-dimension expansion. source_create fixes the focus direction for the single-element axisymmetric arc and blocks multi-element axisym arrays with an explicit error.
Moves acoustic matrix save and cache-load logic out of acoustic_wrapper and prestus_pipeline into a dedicated cache_acoustic function. The load path also removes the post-load axisymmetric coord-fixup block that is now handled correctly by the axisymmetric pipeline itself.
Introduces resolve_io_dirs to fill missing io path fields (dir_output, dir_cache, dir_nii, dir_img, etc.) from path.sim without side effects. Replaces the ad-hoc fallback logic scattered across generate_sequential_report with a single resolve_io_dirs call at the top of each report generator.
Prepends the default/liberal/conservative base-run params to the sequential report param lists so the base run appears as run 1 rather than being omitted from the combined report.
grid_tissue_setup reads voxel size from the phantom NIfTI header and overrides resolution_mm when there is a mismatch; stores phantom_header in planimg for downstream use. grid_transducer_location adds support for trans_pos_mm / focus_pos_mm so configs can specify resolution-independent coordinates. nifti_to_t1w reuses the phantom input NIfTI transform so outputs share the same world-space orientation; extracts the central xz-slice for axisymmetric 3D outputs before writing. nifti_thermal routes phantom outputs through nifti_to_t1w for consistent world-space handling. nifti_medium skips NIfTI export in axisymmetric mode. createPhantom removes the PML padding from phantom dimensions.
- doc_uncertainty: note sequential+uncertainty combination; link to doc_advanced for details; add uncertainty-band timeseries plots to report contents description - doc_advanced: add sequential simulations with uncertainty mode section (example, run numbering, HPC job naming, report output) - doc_calibration: correct phase seeding description (geometric phases, not random); fix opt_use_initial_phases table entry; document actual plot legend labels in Step 10 - doc_telemetry: add System resources table (os_version, cpu_model, n_cpu_cores, ram_gb, gpu_model, toolboxes) - doc_placement: add phantom/water trans_pos_mm/focus_pos_mm fields at end of page - doc_placement_heuristic: note automatic T1 overlay plot after placement - doc_placement_plantus: note automatic T1 overlay plot after placement
…sync bootstrap outputs_folder calibration_setup: coerce focal_depths_wrt_exit_plane and desired_intensities to match N combinations when only one entry is provided. calibration_transducer: propagate parameters.io.outputs_folder to bootstrap_params before saving free-water calibration.
…To3D Ensures temp_0 and absorption_fraction are expanded using the correct bilateral grid dimensions from axisym_bilateral_dims rather than defaults.
Relaxes the argument validator from (:,:,:) to generic numeric/logical, enabling use with axisymmetric (2D) segmentation volumes.
…lateral_dims note
…ss-rate-by-medium chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current
mainbranch is currently very outdated.I think we should still wait to release a new formal version, but the development branch seems stable enough that I would not recommend the current
maincode and suggest to integrate.