←Select platform

DicomJpeg2000Options Structure

The DicomJpeg2000Options structure provides information for JPEG 2000 compression options.
public struct DicomJpeg2000Options 
public value class DicomJpeg2000Options : public System.ValueType  
  • The resulting stream size / compression ratio can be determined in several ways. Depending on the value set in the CompressionControl property, the user can set the size of the target JPEG 2000 stream, the actual compression ratio to use during compression or the quality factor to use during compression. If CompressionControl is set to Ratio, then the compression to use is based on the compression ratio in the CompressionRatio property. If CompressionControl is set to TargetSize, the compression to use is based on the desired target stream size in the TargetFileSize property. If CompressionControl is set to QualityFactor, then compression is used based on the quality factor passed to any of the methods which can be used to replace or insert image(s) in the Pixel Data Element.
  • The UseSopMarker and the UseEphMarker indicate whether to include markers at the "Start of Packet" and "End of Packet Header". These markers help detect file corruption during transmission.
  • There are two types of quantization for lossy compression, Scalar Derived Quantization and Scalar Expounded Quantization. In Scalar Derived Quantization mantissa and exponent values for the LL Subband only are signaled. The mantissa and exponent for the other subbands are derived from the mantissa and exponent signaled for the LL subband.
  • In Scalar Expounded Quantization, the mantissa and exponent values for each subband are signaled.
  • The quantization step size for a subband is determined based on the following equation, where R = bpp for the subband: Quantization Step = (2 (R - Exponent) ) * [1 + (Mantissa / 2048)]
  • The values of the ImageAreaHorizontalOffset , ImageAreaVerticalOffset, ReferenceTileWidth, ReferenceTileHeight, TileHorizontalOffset and TileVerticalOffset class properties are used to create tiles within the image. Arbitrary tile sizes are allowed. All tiles are the same size, except for the border tiles. Each tile can be compressed individually. This can decrease memory usage while the program is running, but can also generate artifacts at the edges of the tiles. Artifacts generally increase as the size of the tile decreases. By default, there is one tile that contains the entire image.
using Leadtools; 
using Leadtools.Dicom; 
public void TestChangeTransferSyntax() 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "image3.dcm"); 
   //Make sure to initialize the DICOM engine, this needs to be done only once  
   //In the whole application 
   using (DicomDataSet ds = new DicomDataSet()) 
      //Load DICOM File 
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      DicomJpeg2000Options options = ds.DefaultJpeg2000Options; 
      Console.WriteLine("JPEG 2000 Options:"); 
      Console.WriteLine("DicomJpeg2000Options.UseColorTransform            is : {0}", options.UseColorTransform); 
      Console.WriteLine("DicomJpeg2000Options.DerivedQuantization          is : {0}", options.DerivedQuantization); 
      Console.WriteLine("DicomJpeg2000Options.TargetFileSize               is : {0}", options.TargetFileSize); 
      Console.WriteLine("DicomJpeg2000Options.ImageAreaHorizontalOffset    is : {0}", options.ImageAreaHorizontalOffset); 
      Console.WriteLine("DicomJpeg2000Options.ImageAreaVerticalOffset      is : {0}", options.ImageAreaVerticalOffset); 
      Console.WriteLine("DicomJpeg2000Options.ReferenceTileWidth           is : {0}", options.ReferenceTileWidth); 
      Console.WriteLine("DicomJpeg2000Options.ReferenceTileHeight          is : {0}", options.ReferenceTileHeight); 
      Console.WriteLine("DicomJpeg2000Options.TileHorizontalOffset         is : {0}", options.TileHorizontalOffset); 
      Console.WriteLine("DicomJpeg2000Options.TileVerticalOffset           is : {0}", options.TileVerticalOffset); 
      Console.WriteLine("DicomJpeg2000Options.DecompositionLevels          is : {0}", options.DecompositionLevels); 
      Console.WriteLine("DicomJpeg2000Options.ProgressingOrder             is : {0}", options.ProgressingOrder); 
      Console.WriteLine("DicomJpeg2000Options.UseSopMarker                 is : {0}", options.UseSopMarker); 
      Console.WriteLine("DicomJpeg2000Options.UseEphMarker                 is : {0}", options.UseEphMarker); 
      Console.WriteLine("DicomJpeg2000Options.RegionOfInterest             is : {0}", options.RegionOfInterest); 
      Console.WriteLine("DicomJpeg2000Options.UseRegionOfInterest          is : {0}", options.UseRegionOfInterest); 
      Console.WriteLine("DicomJpeg2000Options.RegionOfInterestWeight       is : {0}", options.RegionOfInterestWeight); 
      Console.WriteLine("DicomJpeg2000Options.RegionOfInterestRectangle    is : {0}", options.RegionOfInterestRectangle); 
      options.CompressionControl = DicomJpeg2000CompressionControl.Ratio; 
      options.CompressionRatio = 50; 
      Console.WriteLine("Changed CompressionControl to DicomJpeg2000CompressionControl.Ratio and DicomJpeg2000CompressionControl.CompressionRatio to 50"); 
      ds.Jpeg2000Options = options; 
      ds.ChangeTransferSyntax(DicomUidType.JPEG2000, 2, ChangeTransferSyntaxFlags.None); 
      ds.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "DicomJ2K.dcm"), DicomDataSetSaveFlags.None); 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly