Selects a specific number of bits from an 8, 12 or 16-bit grayscale image to create a mask and places the mask in a new 8, 12 or 16-bit grayscale image. This command is available in the
Medical toolkits.
Syntax
Example
Run the ShiftDataCommand on an image.
Visual Basic | Copy Code |
---|
Public Sub ShiftDataCommandExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Beauty16.jpg")
Dim command As ShiftDataCommand = New ShiftDataCommand
command.DestinationBitsPerPixel = 8
command.DestinationLowBit = 3
command.SourceLowBit = 2
command.SourceHighBit = 6
command.Run(leadImage)
codecs.Save(command.DestinationImage, LeadtoolsExamples.Common.ImagesPath.Path + "ShiftDataResult.Bmp", RasterImageFormat.Bmp, 24)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void ShiftDataCommandExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Beauty16.jpg"); // Prepare the command ShiftDataCommand command = new ShiftDataCommand(); command.DestinationBitsPerPixel = 8; command.DestinationLowBit = 3; command.SourceLowBit = 2; command.SourceHighBit = 6; // Move 5 bits starting from bit 2 into the high bits of the affected image. command.Run(image); codecs.Save(command.DestinationImage, LeadtoolsExamples.Common.ImagesPath.Path + "ShiftDataResult.bmp", RasterImageFormat.Bmp, 24); RasterCodecs.Shutdown(); } |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also