public int PaintGamma { get; set; }
@property (nonatomic, assign) NSUInteger paintGamma
public int getPaintGamma();
public void setPaintGamma(
int intValue
);
PaintGamma # get and set (RasterImage)
The current gamma correction value.
The paint gamma value can be any number greater than 0. The default value is 100.
Because this is an unsigned integer, it is 100 times the actual gamma value. For example, use 235 to set a gamma value of 2.35. Intensity values ideally follow a logarithmic progression, because the eye perceives changes in intensity as being equal when the ratio of change is equal. For example, we would see a change from 0.1 to 0.2 as being equal to a change from 0.2 to 0.4.
Gamma is a standard constant that is used to calculate the progression. For most CRTs the gamma constant is in the range of 2.2 to 2.5.
For more information, refer to Changing Brightness and Contrast.
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 IntensityExample()
{
IntensityForm f = new IntensityForm();
f.ShowDialog();
}
class IntensityForm : Form
{
ImageViewer viewer;
TrackBar gammaTrackBar;
TrackBar contrastTrackBar;
TrackBar intensityTrackBar;
public IntensityForm()
{
// Create the controls
Size = new Size(800, 600);
Panel controlsPanel = new Panel();
controlsPanel.Size = new Size(400, 0);
controlsPanel.BorderStyle = BorderStyle.Fixed3D;
controlsPanel.Dock = DockStyle.Left;
int labelLeft = 8;
int y = 16;
int trackBarLeft = 100;
Label gammaLabel = new Label();
gammaLabel.Text = "Gamma:";
gammaLabel.Location = new Point(labelLeft, y);
gammaLabel.AutoSize = true;
controlsPanel.Controls.Add(gammaLabel);
gammaTrackBar = new TrackBar();
gammaTrackBar.Minimum = 1;
gammaTrackBar.Maximum = 100;
gammaTrackBar.TickFrequency = (gammaTrackBar.Maximum - gammaTrackBar.Minimum) / 10;
gammaTrackBar.Location = new Point(trackBarLeft, y);
gammaTrackBar.Width = 200;
gammaTrackBar.Scroll += new EventHandler(gammaTrackBar_Scroll);
controlsPanel.Controls.Add(gammaTrackBar);
gammaLabel.Top = gammaTrackBar.Top + (gammaTrackBar.Height - gammaLabel.Height) / 2;
y = gammaTrackBar.Bottom + 8;
Label contrastLabel = new Label();
contrastLabel.Text = "Contrast:";
contrastLabel.Location = new Point(labelLeft, y);
contrastLabel.AutoSize = true;
controlsPanel.Controls.Add(contrastLabel);
contrastTrackBar = new TrackBar();
contrastTrackBar.Minimum = -1000;
contrastTrackBar.Maximum = 1000;
contrastTrackBar.TickFrequency = (contrastTrackBar.Maximum - contrastTrackBar.Minimum) / 10;
contrastTrackBar.Location = new Point(trackBarLeft, y);
contrastTrackBar.Width = 200;
contrastTrackBar.Scroll += new EventHandler(contrastTrackBar_Scroll);
controlsPanel.Controls.Add(contrastTrackBar);
contrastLabel.Top = contrastTrackBar.Top + (contrastTrackBar.Height - contrastLabel.Height) / 2;
y = contrastTrackBar.Bottom + 8;
Label intensityLabel = new Label();
intensityLabel.Text = "Intensity:";
intensityLabel.Location = new Point(labelLeft, y);
intensityLabel.AutoSize = true;
controlsPanel.Controls.Add(intensityLabel);
y = intensityLabel.Bottom + 8;
intensityTrackBar = new TrackBar();
intensityTrackBar.Minimum = -1000;
intensityTrackBar.Maximum = 1000;
intensityTrackBar.TickFrequency = (intensityTrackBar.Maximum - intensityTrackBar.Minimum) / 10;
intensityTrackBar.Location = new Point(trackBarLeft, y);
intensityTrackBar.Width = 200;
intensityTrackBar.Scroll += new EventHandler(intensityTrackBar_Scroll);
controlsPanel.Controls.Add(intensityTrackBar);
intensityLabel.Top = intensityTrackBar.Top + (intensityTrackBar.Height - intensityLabel.Height) / 2;
y = intensityTrackBar.Bottom + 8;
Button defaultButton = new Button();
defaultButton.Text = "Default";
defaultButton.Location = new Point(labelLeft, y);
defaultButton.Click += new EventHandler(defaultButton_Click);
controlsPanel.Controls.Add(defaultButton);
Controls.Add(controlsPanel);
viewer = new ImageViewer();
viewer.Dock = DockStyle.Fill;
Controls.Add(viewer);
viewer.BringToFront();
// Load the image
using (RasterCodecs codecs = new RasterCodecs())
{
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
viewer.Image = codecs.Load(srcFileName);
}
gammaTrackBar.Value = viewer.Image.PaintGamma;
contrastTrackBar.Value = viewer.Image.PaintContrast;
intensityTrackBar.Value = viewer.Image.PaintIntensity;
UpdateValues();
}
void UpdateValues()
{
string str = string.Format(
"Gamma = {0}, Contrast = {1}, Intensity = {2}",
viewer.Image.PaintGamma, viewer.Image.PaintContrast, viewer.Image.PaintIntensity);
Text = str;
}
void gammaTrackBar_Scroll(object sender, EventArgs e)
{
TrackBar tb = sender as TrackBar;
viewer.Image.PaintGamma = tb.Value;
UpdateValues();
}
void contrastTrackBar_Scroll(object sender, EventArgs e)
{
TrackBar tb = sender as TrackBar;
viewer.Image.PaintContrast = tb.Value;
UpdateValues();
}
void intensityTrackBar_Scroll(object sender, EventArgs e)
{
TrackBar tb = sender as TrackBar;
viewer.Image.PaintIntensity = tb.Value;
UpdateValues();
}
void defaultButton_Click(object sender, EventArgs e)
{
viewer.Image.PaintGamma = 100;
viewer.Image.PaintIntensity = 0;
viewer.Image.PaintContrast = 0;
gammaTrackBar.Value = viewer.Image.PaintGamma;
contrastTrackBar.Value = viewer.Image.PaintContrast;
intensityTrackBar.Value = viewer.Image.PaintIntensity;
UpdateValues();
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
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.core.*;
import leadtools.svg.*;
import leadtools.imageprocessing.CloneCommand;
import leadtools.imageprocessing.FillCommand;
import leadtools.imageprocessing.FlipCommand;
import leadtools.imageprocessing.GrayscaleCommand;
import leadtools.imageprocessing.color.InvertCommand;
import leadtools.imageprocessing.color.PosterizeCommand;
// public void IntensityExample()
// {
// IntensityForm f = new IntensityForm();
// f.showDialog();
// }
// class IntensityForm extends Form
// {
// ImageView viewer;
// Tracer gammaTrackBar;
// Tracer contrastTrackBar;
// Tracer intensityTrackBar;
// public IntensityForm()
// {
// // Create the controls
// Size = new Size(800, 600);
// Panel controlsPanel = new Panel();
// controlsPanel.Size = new Size(400, 0);
// controlsPanel.BorderStyle = BorderStyle.Fixed3D;
// controlsPanel.Dock = DockStyle.Left;
// int labelLeft = 8;
// int y = 16;
// int trackBarLeft = 100;
// Label gammaLabel = new Label();
// gammaLabel.Text = "Gamma:";
// gammaLabel.Location = new Point(labelLeft, y);
// gammaLabel.AutoSize = true;
// controlsPanel.Controls.Add(gammaLabel);
// gammaTrackBar = new TrackBar();
// gammaTrackBar.Minimum = 1;
// gammaTrackBar.Maximum = 100;
// gammaTrackBar.TickFrequency = (gammaTrackBar.Maximum - gammaTrackBar.Minimum)
// / 10;
// gammaTrackBar.Location = new Point(trackBarLeft, y);
// gammaTrackBar.Width = 200;
// gammaTrackBar.Scroll += new EventHandler(gammaTrackBar_Scroll);
// controlsPanel.Controls.Add(gammaTrackBar);
// gammaLabel.Top = gammaTrackBar.Top + (gammaTrackBar.Height -
// gammaLabel.Height) / 2;
// y = gammaTrackBar.Bottom + 8;
// Label contrastLabel = new Label();
// contrastLabel.Text = "Contrast:";
// contrastLabel.Location = new Point(labelLeft, y);
// contrastLabel.AutoSize = true;
// controlsPanel.Controls.Add(contrastLabel);
// contrastTrackBar = new TrackBar();
// contrastTrackBar.Minimum = -1000;
// contrastTrackBar.Maximum = 1000;
// contrastTrackBar.TickFrequency = (contrastTrackBar.Maximum -
// contrastTrackBar.Minimum) / 10;
// contrastTrackBar.Location = new Point(trackBarLeft, y);
// contrastTrackBar.Width = 200;
// contrastTrackBar.Scroll += new EventHandler(contrastTrackBar_Scroll);
// controlsPanel.Controls.Add(contrastTrackBar);
// contrastLabel.Top = contrastTrackBar.Top + (contrastTrackBar.Height -
// contrastLabel.Height) / 2;
// y = contrastTrackBar.Bottom + 8;
// Label intensityLabel = new Label();
// intensityLabel.Text = "Intensity:";
// intensityLabel.Location = new Point(labelLeft, y);
// intensityLabel.AutoSize = true;
// controlsPanel.Controls.Add(intensityLabel);
// y = intensityLabel.Bottom + 8;
// intensityTrackBar = new TrackBar();
// intensityTrackBar.Minimum = -1000;
// intensityTrackBar.Maximum = 1000;
// intensityTrackBar.TickFrequency = (intensityTrackBar.Maximum -
// intensityTrackBar.Minimum) / 10;
// intensityTrackBar.Location = new Point(trackBarLeft, y);
// intensityTrackBar.Width = 200;
// intensityTrackBar.Scroll += new EventHandler(intensityTrackBar_Scroll);
// controlsPanel.Controls.Add(intensityTrackBar);
// intensityLabel.Top = intensityTrackBar.Top + (intensityTrackBar.Height -
// intensityLabel.Height) / 2;
// y = intensityTrackBar.Bottom + 8;
// Button defaultButton = new Button();
// defaultButton.Text = "Default";
// defaultButton.Location = new Point(labelLeft, y);
// defaultButton.Click += new EventHandler(defaultButton_Click);
// controlsPanel.Controls.Add(defaultButton);
// Controls.Add(controlsPanel);
// viewer = new ImageViewer();
// viewer.Dock = DockStyle.Fill;
// Controls.Add(viewer);
// viewer.BringToFront();
// // Load the image
// using (RasterCodecs codecs = new RasterCodecs())
// {
// string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
// viewer.Image = codecs.Load(srcFileName);
// }
// gammaTrackBar.Value = viewer.Image.PaintGamma;
// contrastTrackBar.Value = viewer.Image.PaintContrast;
// intensityTrackBar.Value = viewer.Image.PaintIntensity;
// UpdateValues();
// }
// void UpdateValues()
// {
// string str = string.Format(
// "Gamma = {0}, Contrast = {1}, Intensity = {2}",
// viewer.Image.PaintGamma, viewer.Image.PaintContrast,
// viewer.Image.PaintIntensity);
// Text = str;
// }
// void gammaTrackBar_Scroll(object sender, EventArgs e)
// {
// TrackBar tb = sender as TrackBar;
// viewer.Image.PaintGamma = tb.Value;
// UpdateValues();
// }
// void contrastTrackBar_Scroll(object sender, EventArgs e)
// {
// TrackBar tb = sender as TrackBar;
// viewer.Image.PaintContrast = tb.Value;
// UpdateValues();
// }
// void intensityTrackBar_Scroll(object sender, EventArgs e)
// {
// TrackBar tb = sender as TrackBar;
// viewer.Image.PaintIntensity = tb.Value;
// UpdateValues();
// }
// void defaultButton_Click(object sender, EventArgs e)
// {
// viewer.Image.PaintGamma = 100;
// viewer.Image.PaintIntensity = 0;
// viewer.Image.PaintContrast = 0;
// gammaTrackBar.Value = viewer.Image.PaintGamma;
// contrastTrackBar.Value = viewer.Image.PaintContrast;
// intensityTrackBar.Value = viewer.Image.PaintIntensity;
// UpdateValues();
// }
// }
public class LEAD_VARS
{
public final static String ImagesDir = "C:\LEADTOOLS23\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