Syntax
IS=imadjustwhite(IS)
Input Parameter
IS : | | original intensity matrix |
Output Parameter
IS : | | modified intensity matrix |
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 function, imadjustwhite
, is designed to adjust the contrast of an image stack by modifying the white and black levels based on histogram analysis. It is part of the SolidGeometry library and was introduced in version 5.1.
Input Parameters
- IS: The image stack to be processed. It is expected to be in the format of a multi-dimensional array, typically representing a series of images.
Output
- IS: The adjusted image stack with modified white and black levels.
Algorithm Steps
- Calculate the number of elements in the image stack using
numel(IS)
.
- Set the maximum number of gray values to 256, which is typical for 8-bit images.
- Compute the histogram of the image stack using
histcounts
with 256 bins.
- Normalize the histogram by dividing by the total number of elements.
- Identify the histogram bins where the normalized count is greater than 0.001, indicating significant pixel intensity.
- Determine the white level by selecting the second-to-last significant bin and adding 2 to its index, ensuring it does not exceed the maximum number of gray values.
- Determine the black level by selecting the first significant bin.
- Adjust the image stack by setting all pixel values greater than the white level to the white level and all pixel values less than the black level to the black level.
- Recalculate the minimum and maximum values of the adjusted image stack using
minmaxall
.
- If no output is requested, display the image stack using
SGfigure
and VMmontage
, applying a grayscale colormap and setting the color limits to the recalculated minimum and maximum values.
Algorithm explaination created using ChatGPT on 2025-08-19 07:05. (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