public int HighBit { get; set; }
@property (nonatomic, assign) NSInteger highBit;
public int getHighBit();
public void setHighBit(
int intValue
);
HighBit # get and set (WindowLevelCommand)
Value indicating the high bit used for leveling. 0 <= LowBit <= HighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale).
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
public void WindowLevelCommandExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm"));
// Prepare the command
int x;
byte y;
int Size;
RasterColor[] LookupTable;
//Change the image to 16-bit grayscale
GrayscaleCommand graycommand = new GrayscaleCommand(16);
MinMaxBitsCommand MinMaxBits = new MinMaxBitsCommand();
MinMaxValuesCommand MinMaxValues = new MinMaxValuesCommand();
WindowLevelCommand command = new WindowLevelCommand();
graycommand.Run(image);
MinMaxBits.Run(image);
MinMaxValues.Run(image);
Size = (1 << (MinMaxBits.MaximumBit - MinMaxBits.MinimumBit + 1));
LookupTable = new Leadtools.RasterColor[Size];
// fill the first half of the LookupTable with RED.
for (x = 0; x < Size / 2; x++)
LookupTable[x] = new Leadtools.RasterColor(255, 0, 0);
// fill the rest with gray values.
for (x = Size / 2; x < Size; x++)
{
y = (byte)((x - MinMaxValues.MinimumValue) * 255 / (MinMaxValues.MaximumValue - MinMaxValues.MinimumValue));
LookupTable[x] = new Leadtools.RasterColor(y, y, y);
}
command.HighBit = MinMaxBits.MaximumBit;
command.LowBit = MinMaxBits.MinimumBit;
command.LookupTable = LookupTable;
command.Order = Leadtools.RasterByteOrder.Bgr;
command.Run(image);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.*;
import leadtools.imageprocessing.core.*;
public void windowLevelCommandExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.setThrowExceptionsOnInvalidImages(true);
RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "DICOM\\IMAGE3.dcm"));
// Prepare the command
int x;
byte y;
int size;
RasterColor[] lookupTable;
// Change the image to 16-bit grayscale
GrayscaleCommand grayCommand = new GrayscaleCommand(16);
MinMaxBitsCommand minMaxBits = new MinMaxBitsCommand();
MinMaxValuesCommand minMaxValues = new MinMaxValuesCommand();
WindowLevelCommand command = new WindowLevelCommand();
grayCommand.run(image);
minMaxBits.run(image);
minMaxValues.run(image);
size = (1 << (minMaxBits.getMaximumBit() - minMaxBits.getMinimumBit() + 1));
lookupTable = new leadtools.RasterColor[size];
// fill the first half of the LookupTable with RED.
for (x = 0; x < size / 2; x++)
lookupTable[x] = new leadtools.RasterColor(255, 0, 0);
// fill the rest with gray values.
for (x = size / 2; x < size; x++) {
y = (byte) ((x - minMaxValues.getMinimumValue()) * 255
/ (minMaxValues.getMaximumValue() - minMaxValues.getMinimumValue()));
lookupTable[x] = new leadtools.RasterColor(y, y, y);
}
command.setHighBit(minMaxBits.getMaximumBit());
command.setLowBit(minMaxBits.getMinimumBit());
command.setLookupTable(lookupTable);
command.setOrder(RasterByteOrder.BGR);
int change = command.run(image);
assertTrue(change != RasterImageChangedFlags.NONE);
codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"), RasterImageFormat.JPEG, 24);
System.out.println("Command run, image saved to " + combine(LEAD_VARS_IMAGES_DIR, "Result.jpg"));
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.