Leadtools.ImageProcessing.Core Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
DigitalSubtractCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Core Namespace : DigitalSubtractCommand Class



Subtracts the live image from the mask image to show the differences between the two images. This method is available in the Medical and above.

Syntax

Visual Basic (Declaration) 
Public Class DigitalSubtractCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As DigitalSubtractCommand
C# 
public class DigitalSubtractCommand : RasterCommand, IRasterCommand  
C++/CLI 
public ref class DigitalSubtractCommand : public RasterCommand, IRasterCommand  

Example

Run the DigitalSubtractCommand on an image.

Visual BasicCopy Code
Public Sub DigitalSubtractCommandExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   ' Prepare the command
   Dim MaskImage As RasterImage
   MaskImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image3.cmp", 4, CodecsLoadByteOrder.Bgr, 1, 1)

   Dim command As DigitalSubtractCommand = New DigitalSubtractCommand
   command.Flags = DigitalSubtractCommandFlags.ContrastEnhancement
   command.MaskImage = MaskImage
   command.Run(leadImage)

   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void DigitalSubtractCommandExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); 
 
   // Prepare the command 
   RasterImage MaskImage; 
   MaskImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg", 4, CodecsLoadByteOrder.Bgr, 1, 1); 
 
   DigitalSubtractCommand command = new DigitalSubtractCommand(); 
   command.Flags = DigitalSubtractCommandFlags.ContrastEnhancement; 
   command.MaskImage = MaskImage; 
   command.Run(image); 
 
   RasterCodecs.Shutdown(); 
}

Remarks

  • Performs a digital subtraction between two images. The resulting image may be enhanced using the Flags options. Digital subtraction is mainly used to show the differences or the changes between two images. For the process to be meaningful both images should be related to each other. Digital Subtraction Angiography (DSA) is a practical example of digital subtraction.
  • Digital Subtraction Angiography (DSA) and Quality Control (QC) are both major fields that use image subtraction. An example of DSA is explained below.
  • DSA is a technology used for the visualization of blood vessels in the human body. A mask image is obtained using X-ray film of the body part of interest. Then vessels of that part are injected using a contrast medium. A sequence of images is taken after the injection. These are called live images. After applying subtraction between the mask and live images the resulting images are images that show the passage of the contrast medium in the vessels.
  • Both the affected image and MaskImage should have the same bits per pixel, number of channels and image dimensions; otherwise the method will return an error code.
  • If the DigitalSubtractCommandFlags.ContrastEnhancement flag is set then the contrast of the subtracted image will be enhanced.
  • If the DigitalSubtractCommandFlags.OptimizeRange flag is set then the tonal range of the subtracted image will be optimized. That is, the image intensity will be distributed among the full image intensity range.
  • This class supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
  • This command does not support 32-bit grayscale images.
  • All images must be signed or unsigned.
For more information, refer to Introduction to Image Processing With LEADTOOLS.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Core.DigitalSubtractCommand

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