applyRegistrationTformOnFolder

applyRegistrationTformOnFolder


Apply the registration transform stored in a Save Folder to all image data in that folder: every image .dat file and every image .umt file.

Destructive and effectively irreversible
This function rewrites every image .dat and image .umt file in place. Interpolation and pixels moved outside the frame cannot be recovered reliably. Back up the folder and inspect the quality-control image before continuing.

Description


The function loads DataParams.registration.tform, streams each image plane through the transform, writes a temporary file, and then replaces the original. It updates registration status in DataParams.mat after all files have been replaced. Reapplication is blocked by default when the folder is already marked registered.

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. Every target is validated before any file is rewritten; if one image file is unsupported or does not match the size of the stored transform, the whole operation stops and nothing is modified. NaN pixels (for example outside the field of view or the padding of short trials) are handled per plane: they 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 original binary file is replaced. Planes are the flattened trailing axes. A .dat whose first two axes are not Y and X is rejected and stops the operation before any file is changed.
Every image .umt fileEvery entry whose dimensions start with Y, X is transformed in place; other entries of the file are left as they are.
DataParams.matDataParams.registration is updated with the applied status, time, confirmation mode, transform information, and application note.
AcqInfos.matNot modified by this function.
.umt files of other kinds (for example roi) and .roi filesNot modified. Their masks or coordinates are not automatically brought into the transformed space.
events.mat, processing history/logs, and project resourcesNot modified.

Input


SaveFolder must contain a valid DataParams file, a stored transform, the acquisition metadata required to read the images, and at least one image file (a .dat with Y and X as its first two axes, or an image .umt). Each image must have the frame size of the reference used to estimate the transform.

Output


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

Parameters


Selects the MAT-file containing the scalar DataParams structure.

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

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

The default prevents accidental interpolation of already registered data. Set true only when the repeated operation is intentional and reviewed.

Planned interface cleanup
DataParamsFile currently exists for compatibility, but the supported recording metadata filename is DataParams.mat. Removing that parameter and hard-coding the standard filename is tracked in PLANNED_IMPLEMENTATIONS.md.


Back to top

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