applyRegistrationTformOnFolder

applyRegistrationTformOnFolder


Apply the registration transform stored in a Save Folder (by createRegistrationTform) to all image data in that folder.

Destructive and done only once
This function rewrites every image .dat and image .umt file. Interpolation and pixels moved outside the frame cannot be recovered, and no backup copy is made. A folder can be aligned only once: afterwards estimate and apply are refused (Umitoolbox:ImageRegistration:alreadyAligned), and only a fresh import of the raw data allows a new alignment. Keep a copy of the folder if you may need the unaligned data, and inspect the quality-control image before continuing.

Description


The function uses the same apply engine as the Image Alignment Tool, so both give the same folder state. It checks the folder first: the stored transform must have been estimated against the reference recorded in the folder (otherwise Umitoolbox:ImageRegistration:estimateReferenceMismatch; estimate again), and every target must be supported and of the expected size. Then every transformed file is written next to its original; only when all are ready are the originals replaced and DataParams.mat updated. If any step fails, every original is restored and nothing is changed; a report ImageAlignmentFailedReport_*.txt names the failed stage.

The transform is 2-D, so it is applied to every Y-X plane of data whose first two axes are Y and X, whatever follows them, with linear interpolation. The output frame has the size of the reference image. NaN pixels (for example outside the field of view or the padding of short trials) are excluded from the interpolation and restored as NaN after warping.

Files modified


File typeEffect
Every .dat file whose first two axes are Y and X (Y-X, Y-X-T, Y-X-E, Y-X-F, Y-X-T-E)Every Y-X plane is geometrically transformed and the file is replaced. A .dat whose first two axes are not Y and X stops the operation before any file is changed.
Every image .umt fileEvery entry whose dimensions start with Y, X is transformed; an entry of another frame size stops the operation.
Current-format .roi filesROI vertices and masks are transformed and their geometric statistics recomputed.
DataParams.matThe mask and view are transformed, and DataParams.registration records the applied state (time, confirmation mode) for the reference the transform was estimated against.
AcqInfos.mat, events.mat, processing history/logs, and project informationNot modified.

A manualAlignmentReport_*.mat report is written on success.

Input


SaveFolder must contain a valid DataParams.mat with a stored transform, and at least one image file (a .dat with Y and X as its first two axes, or an image .umt).

Output


There is no normal data output. The modified image filenames and updated DataParams path are printed to the MATLAB command window.

Parameters


When true, the function asks the user to continue. Disabling it records a forced-no-confirmation mode and should be reserved for controlled automation.

If a QC figure path is stored and the file exists, the figure opens before the confirmation dialog.

The former parameters AllowReapply and DataParamsFile no longer exist; passing them is an error.


Back to top

Copyright © LabeoTech 2026. This work is licensed under the GNU General Public License, Version 3.0.