spreadmax
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Images
Introduced first in SolidGeometry 5.1, Creation date: 2021-11-27, Last change: 2025-09-15
spreads the values of a matrix for a desired intervall min to max
Description
used in imstackofSGprojection
See Also: imadjustwhite
, imstackofSGprojection
Example Illustration
Syntax
ISN=spreadmax(IS,[mm])
Input Parameter
IS: | | matrix |
mm: | | [min max]; defualt is [0 255] |
Output Parameter
Copyright 2021-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is designed to spread the values of a matrix to fit within a specified interval, typically used for image processing tasks.
Input Parameters
- IS: A matrix whose values need to be spread.
- mm: A two-element vector [min max] specifying the desired range for the output matrix. The default is [0 255].
Output
- ISN: The new matrix with values spread to the specified range.
Algorithm Steps
- Retrieve the desired range
mm using the function getfuncparams. If not provided, default to [0 255].
- Determine the minimum and maximum values of the input matrix
IS using minmaxall, storing them in vc.
- Normalize the matrix
IS by subtracting the minimum value vc(1) and dividing by the range (vc(2) - vc(1)).
- Scale the normalized values to the desired range
mm by multiplying by (mm(2) - mm(1)) and adding mm(1).
- If no output is requested (
nargout == 0), calculate the new min and max of ISN using minmaxall and print the original and spreaded matrix value ranges using dbprintf.
Algorithm explaination created using ChatGPT on 2025-08-18 22:51. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21