public int HighBit { get; set; }
@property (nonatomic, assign) NSInteger highBit
public int getHighBit();
public void setHighBit(
int intValue
);
HighBit # get and set (RasterImage)
Value indicating the high bit used for window leveling.
The LowBit value will be: 0 <= LowBit <= HighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale). A value of -1 will be treated as 0.
For more information, refer to Grayscale Images.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Dicom;
using Leadtools.Drawing;
using Leadtools.Controls;
using Leadtools.Svg;
public void WindowLevelExample()
{
RasterCodecs codecs = new RasterCodecs();
// Load an image that has BottomLeft ViewPerspective
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"));
// Change the image to 16-bit grayscale
GrayscaleCommand grayscaleCmd = new GrayscaleCommand(16);
grayscaleCmd.Run(image);
MinMaxBitsCommand minMaxBitsCmd = new MinMaxBitsCommand();
minMaxBitsCmd.Run(image);
MinMaxValuesCommand minMaxValuesCmd = new MinMaxValuesCommand();
minMaxValuesCmd.Run(image);
int lowBit = minMaxBitsCmd.MinimumBit;
int highBit = minMaxBitsCmd.MaximumBit;
int size = (1 << (image.HighBit - image.LowBit + 1));
RasterColor[] palette = new RasterColor[size];
// fill the first half of the LUT with RED
for (int x = 0; x < size / 2; x++)
{
palette[x].R = 255;
palette[x].G = 0;
palette[x].B = 0;
palette[x].Reserved = 0;
}
int minVal = minMaxValuesCmd.MinimumValue;
int maxVal = minMaxValuesCmd.MaximumValue;
// Fill the rest with gray values
for (int x = (size / 2); x < size; x++)
{
palette[x].R = Convert.ToByte(Math.Min(255, ((x - minVal) * 255 / (maxVal - minVal))));
palette[x].G = palette[x].R;
palette[x].B = palette[x].R;
palette[x].Reserved = 0;
}
image.WindowLevel(lowBit, highBit, palette, RasterWindowLevelMode.PaintAndProcessing);
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_WindowLevel.BMP"), RasterImageFormat.Bmp, 0);
image.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document