Add weighted artery profile analysis and optimize cross-section processing - #44
Open
micatlan wants to merge 84 commits into
Open
Add weighted artery profile analysis and optimize cross-section processing#44micatlan wants to merge 84 commits into
micatlan wants to merge 84 commits into
Conversation
… is from h5. some results not outputed anymore but kept in a tmp work h5 for figure and png creation. Fixed raw arterial signal being filtered. now two fully separate outputs. Augmented segment ring count from 10 to 16.
…or now since didn't work well with profiles
…form_shape_metrics and updated wsm with the optimizations done in ae
…d_segments H5 output Change + Fixes to cycle and bpm + integrated hemifield analysis to waveform_shape_metrics
Pipeline splitting
…ne. First draft of correcting optic disk layer
Log and fixes
…tween each. Added constant to decide whether to use M2 or calculate M2ff
reverted to circle annuli and use segment length frac for distance be…
Longitudinal profiles
…cured. Small optimizations in profiles
Fix UI columns
Unify radius units, retain sparse segment payloads, cache geometry, bound concurrent scratch memory with temporal batching, and preserve missing data. Keep GPU calculations resident through profile reduction and fix unsupported CuPy divide(where=...) calls. Include RTX 4090 parity tests and benchmarks.
…averaged profile outputs
…ntal dilation applied to mask by 10 pixels
# Conflicts: # src/calculations/blood_flow_velocity/cross_section/generate_cross_section_signals.py # src/calculations/blood_flow_velocity/cross_section/reusable_cross_section_signals.py # src/calculations/blood_flow_velocity/cross_section/segment_velocity_signals.py # src/input_output/schema/eyeflow_output.py # src/pipelines/waveform_velocity/profiles.py # src/pipelines/waveform_velocity/runner.py # test/test_waveform_shape_metrics_segment_geometry.py
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 artery velocity-profile analysis pipeline now fits one quadratic per (time, beat, branch, radius) from
/Processing/VelocityProfiles/Artery/TransverseVelocityProfileMasked/value. Weighted least squares assigns weight 0.5 to the outer 25% at each border and 1.0 to the center, using the complete zero-based input domain even when samples are missing.Float64 centered/scaled solves run in bounded time blocks and reuse solves for shared finite-sample masks. The existing writer publishes 16 arrays under
/Processing/VelocityProfileAnalysis/Artery/<name>/value: coefficients, weighted and unweighted fit diagnostics, sample counts, fractional vertex and roots, andQv_fit/Qv. Both areas are unweighted signed sums over identical finite observed integer indexes between the roots, clipped to the input domain. Invalid geometry and empty support produce NaNs while preserving counts. Scheduling analysis automatically enables the required upstream computation and profile publication. Fitting is CPU-only; serialized outputs retain float32/int32 conventions. The schema and edge-case behavior are documented indocs/velocity_profile_analysis.md.Cross-section calculations allocate full movies for absent ring–branch intersections, eagerly prepare temporal windows, and mix radius units when estimating mask orientation. This change stores only measured segment payloads, extracts windows lazily, caches geometry, and uses one half-diagonal radius convention.
A configurable estimated scratch-memory budget (512 MiB by default) bounds workers and batches long temporal windows with one global angle and integration limits. Missing frames remain NaN, empty results have zero branches, centroids use the largest component, and quadratic fits reject unsuitable roots.
GPU arrays stay on-device through resize, rotation and profile reduction. RTX 4090 testing exposed unsupported
cupy.divide(..., where=...)calls; these are fixed in the new GPU path and existing helpers. Automatic fallback warns; explicit CuPy mode raises on failure.Validation
CPU/GPU signals and profiles agree at
rtol=1e-5, atol=1e-5on the benchmark cases. Script, raw timings and methodology are included inbenchmarks/anddocs/cross_section_gpu_benchmark.md. These are single-segment synthetic timings, excluding branch labeling, final profile postprocessing and export.Compatibility
Large payloads use
SegmentArraywith the existing logical axes. Integer segment indexing stays sparse; general slicing andnp.asarraymaterialize dense data. Small metadata and rectangular exports remain dense. The scratch budget excludes retained input/output arrays and is not a total-RSS limit. Radius, missing-data and fit corrections intentionally change affected numerical results. The orientation search strategy is unchanged.