Skip to content

Development - #1

Open
hruth wants to merge 44 commits into
masterfrom
development
Open

hruth wants to merge 44 commits into
masterfrom
development

Conversation

@hruth

@hruth hruth commented Oct 1, 2026

Copy link
Copy Markdown
Member

No description provided.

hruth and others added 30 commits June 9, 2026 09:25
…here lamino angle wasn't being updated properly in the autorunner system. I also moved @handle_checkpoint(Checkpoints.AFTER_LOADING) to the combined function _load_data_and_create_task; this should be fine but I want to record this in case there are unexpected bugs
…r when both phase and complex projections are present
Link self.data directly as ASTRA's output buffer via astra.data3d.link,
eliminating the separate copy that previously brought peak CPU memory to
3x the volume size. self.data is now pre-allocated before the ASTRA config
is created and ASTRA writes the reconstruction result directly into it.

Also remove the temporary array in apply_circular_window by using
np.multiply(..., out=self.data).

FIX: in regularize_reconstruction (projection_matching.py), change
`volume.data = volume_array` to an in-place `[:]` assignment to preserve
the ASTRA link to self.data across alignment iterations.
CuPy's default pinned memory pool over-allocates physical RAM. Switch pin_memory,
create_empty_pinned_array, and create_empty_pinned_array_like to use
cp.cuda.PinnedMemory directly (cudaHostAlloc), which allocates exactly
array.nbytes. GPU-CPU transfer speed is unaffected since memory remains
page-locked.
…ma_object after running get_projection_matching_shift. Also, added explicit garbage collection before and after get_projection_matching_shift which releases unused memory that previously was not being released.
…a_sequence snapshot for initial_shift/angles and guard pma_object.gui access; show placeholder label in Detailed Results tab when low_memory_mode is enabled
…ned-memory leak in loading_bar_wrapper

CrossCorrelationMasterWidget: replace inline pre/post ArrayViewers with a
"View pre- and post-alignment projections" button (disabled until alignment
runs) that opens a separate _ProjectionComparisonWindow. Shifting is
performed when the window opens; the pinned array and viewer reference are
cleared on close.

loading_bar_wrapper: clear Worker.args/kwargs and result_container after
loop.exec_() completes so that large arrays (e.g. pinned GPU memory) are not
held alive by PyQt5's deferred QObject cleanup.
- ThresholdSelector._finish(): remove loading_bar_wrapper from clip_masks
  (thread held extra refs to self.masks, delaying GC); always replace
  projections.masks instead of copying in-place (avoids a duplicate live
  copy on repeated calls); set self.masks = None so the widget releases
  the large float array immediately after finishing
- ProjectionViewer: add _close_mask_gui() with try/except RuntimeError to
  handle WA_DeleteOnClose race; connect destroyed signal to auto-clear
  mask_gui; initialise mask_gui = None in __init__
- place_patches_fourier_batch: precompute fft_patch once before the loop
  (saves N-1 FFT2s, frees padded_patch GPU memory earlier, fixes latent
  double-fftshift bug on iterations > 0)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Add selection mode dropdown: individual scans, scan number range, angle range
- Range mode: start/end inputs stage ranges resolved to scan numbers on removal
- Replace mark-for-removal checkbox with light-blue Add/Remove buttons;
  Remove button enables only when staging table rows are selected (multi-select)
- Prevent duplicate entries in both individual and range staging tables
- Clear range inputs when switching between range modes
- Red "Permanently Remove Scans" button moved above previously-removed table
- Horizontal separator divides interactive staging area from history section
- Fix vertical stretch on index selector in individual mode (Fixed size policy)
- Save PMA sequence volumes when using "Save Current Task" button
- Add AutorunnerConfig.load_pma_sequence_volumes (True by default) and
  pass it through to load_task on checkpoint resume
- Add "Delete Volume Array" button to PMA Sequence Viewer (volume view only)
- Preserve fractional slice index when switching snapshots
- Adjust zoom to preserve apparent feature size across different scales
- Map view center through physical coordinates when switching snapshots,
  accounting for both scale and volume_crop offsets
…ke_case

Introduces an interactive two-tab GUI for running and inspecting fill_missing_cone
results, including a run-configuration panel, 3D crop selector, volume viewer with
axis cycling and saving, and a history tab with per-run options display.

Also adds FillMissingConeOptions dataclass and renames all camelCase identifiers in
missing_cone.py to snake_case.
hruth and others added 14 commits October 2, 2026 09:09
Add pull_request trigger alongside push, and use skip-duplicate-actions
to avoid re-testing identical content (e.g. a fast-forward PR after an
already-tested push).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Hardcoded version in pyproject.toml had already drifted from the
actual git tag (pip reported 1.0.0 while pyproject.toml said 1.2.0).
setuptools_scm now computes the version from the latest tag at
install/build time, exposed as pyxalign.__version__, so the two can't
diverge again.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
concurrent_skipping was unset, so push and pull_request(synchronize)
runs for the same commit raced instead of being deduped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds pyxalign.io.loaders.mimid, following the pear/xrf loader structure,
and registers it in the ExperimentType enum, maps, load_any, and the
loading GUI.

Points at the top-level orchestrator output folder so the laminography
angle is available even when loading reconstructions; a data_source
option selects reconstructions or ground-truth projections. Files are
read directly with h5py/PyYAML, since importing mimid pulls in PyTorch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ume comparison plot

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The orientation of a reconstructed volume is fixed by the measured
projection angles, which shouldn't be edited, so there was no way to
rotate the volume about the laminographic axis to the orientation the
user actually wants to view or export.

Add ReconstructOptions.geometry.angle_offset (degrees, default 0.0),
which is added to the projection angles when the astra geometry is
built. The projections themselves are untouched. Both of Volume's
geometry construction sites -- back-projection/FBP (and therefore the
forward projections PMA reuses) and SART -- go through the new
Volume.reconstruction_angles property, so forward and back projection
stay consistent and PMA still works with a nonzero offset.

The offset is recorded in the PMA snapshot with no serialization
changes, since PMASnapshot already deep-copies the whole
ReconstructOptions, and it is surfaced in the snapshot info panel and
in the reconstruction parameter tuner.

"Apply Alignment Shift from File" also picks up the offset from the
reference file, so an orientation dialed in at one resolution carries
over. A zero or absent offset in the file is treated as "not set" and
never overwrites an offset already configured on the current
projections, which also keeps files written before this change working.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Running projection-matching alignment with keep_on_gpu=True on a GPU other
than index 0 crashed with a cupy stream/device mismatch. set_all_device_options
replaces every nested DeviceOptions in projection_options, but the subsequent
assignment of projection_options.reconstruct overwrote that subtree, leaving
reconstruct.filter.device.gpu.gpu_indices at its default (0,). The sinogram
filter then created its streams on GPU 0 while the projection data lived on
the GPU selected for the alignment.

Assign the reconstruct options (and the dependent geometry copy, which holds
no device options) before propagating the device options so the nested device
options are included.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Masks for projection-matching alignment have been taken from the probe
positions, which marks the illuminated region rather than the region
that is meaningful for the alignment. What matters is which detector
rays pass entirely through the reconstructed volume: near the edges a
ray only clips the volume, so the forward projection fades there and
biases the comparison with the measured projection.

The volume width and thickness already determine that region. Forward
projecting a volume of ones through the existing astra geometry gives
the path length of each ray, which is at its maximum exactly where the
ray passes fully through the volume, so thresholding the normalized
path length gives the mask. Going through astra keeps the masks
consistent with the center of rotation and the laminography, tilt,
skew and angle offset used for reconstruction.

The volume shape can be the inscribed cylinder, matching the circular
window applied to reconstructions, or the full reconstruction box. The
thickness and width are stored in the new mask options rather than
written back to the experiment options, so building masks never changes
the parameters used for reconstruction.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The volume width options, enum and tuner UI already offered a choice
between a multiplier and a physical width, but the size calculation
always applied the multiplier, so selecting 'meters' silently did
nothing and width_meters was dead state.

Dispatch on width_type when computing the custom lateral width, and
raise a clear error when a meters width is selected without a positive
value instead of building a zero-width volume. The tuner's meters
spinbox now starts at the projection width rather than an invalid zero.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Forward projecting the volume window to get the path lengths costs
roughly the cube of the linear array size, which made mask building slow
for large projections and painful to iterate on in the interactive
builder. The masks do not need that precision: they mark which rays pass
entirely through the volume, and the alignment is insensitive to the
mask edge moving by a few pixels.

The astra geometry carries no physical scale, so shrinking the
projections, the volume and the center of rotation offset by the same
factor samples the same scene on a coarser grid. Interpolating the
normalized path lengths back onto the full resolution grid then gives
masks at the projection size. The center of rotation is scaled as an
offset from the detector center rather than as an absolute position,
since the coarse detector is rounded up and is not exactly a fraction of
the full one.

The factor defaults to the largest power of two that keeps the coarse
projections and volume above a minimum size. Coarse voxelization of a
thin volume is what pulls the mask edges inward, so the volume minimum
bounds that shift to a few pixels. Measured on 2048 x 2048 projections
with 64 angles, the automatic factor of 16 is 6.9x faster and moves the
mask edge inward by 9 pixels out of a radius of 353.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The masks are built by thresholding the path length of each ray through
the volume, normalized by its maximum. That quantity is already a
natural weight: it is 1 where the ray passes entirely through the volume
and falls off smoothly to 0 over the fading edges, so thresholding
discards information that may be useful for the alignment.

Add a binarize option, on by default, that keeps the normalized path
lengths instead. The gui disables the threshold spinbox when it is
cleared, and toggling it does not recompute the masks, since the stored
path lengths do not depend on it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… size

Adds automatic generation of projection masks derived from the
reconstructed volume size, with configurable downsampling, optional
binarization, and support for the 'meters' reconstruction width type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ariant

The "projections - forward projections" label was verbose, and there was no
way to view the residual alongside the projection masks to check whether the
residual signal falls inside the masked region.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant