←Select platform

Jpeg2000Options Property

Summary
Gets or sets the JPEG 2000 compression options.
Syntax
C#
VB
C++
public DicomJpeg2000Options Jpeg2000Options { get; set; } 
Public Property Jpeg2000Options As DicomJpeg2000Options 
public: 
property DicomJpeg2000Options Jpeg2000Options { 
   DicomJpeg2000Options get(); 
   void set (    DicomJpeg2000Options value); 
} 

Property Value

The JPEG 2000 compression options to use when compressing the image(s) in a Pixel Data element using the JPEG 2000 compression.

Example

This example will read a DICOM dataset, change its transfer syntax to JPEG-2000 and then save it back.

C#
VB
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 
   DicomEngine.Startup(); 
   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); 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Dicom 
 
Public Sub TestChangeTransferSyntax() 
   Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "IMAGE3.dcm") 
   'Make sure to initialize the DICOM engine, this needs to be done only once  
   'In the whole application 
   DicomEngine.Startup() 
 
   Dim ds As DicomDataSet = New DicomDataSet() 
   Using (ds) 
 
      'Load DICOM File 
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None) 
 
      Dim options As DicomJpeg2000Options = 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, "DicomJ2K.dcm"), DicomDataSetSaveFlags.None) 
   End Using 
 
   DicomEngine.Shutdown() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

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

Leadtools.Dicom Assembly