←Select platform

DicomImageCompressionType Enumeration

Summary
Represents the values that indicates the type of compression.
Syntax
C#
Objective-C
C++/CLI
Java
public enum DicomImageCompressionType   
typedef NS_ENUM(NSInteger, LTDicomImageCompressionType) { 
	LTDicomImageCompressionTypeNone,  
	LTDicomImageCompressionTypeRle,  
	LTDicomImageCompressionTypeJpegLossless,  
	LTDicomImageCompressionTypeJpegLossy,  
	LTDicomImageCompressionTypeJpegLsLossless,  
	LTDicomImageCompressionTypeJpegLsLossy,  
	LTDicomImageCompressionTypeJ2kLossless,  
	LTDicomImageCompressionTypeJ2kLossy,  
	LTDicomImageCompressionTypeMpeg2,  
	LTDicomImageCompressionTypeMpeg2Hd,  
	LTDicomImageCompressionTypeH265,  
	LTDicomImageCompressionTypeUnknown,  
	LTDicomImageCompressionTypeJpxLossless,  
	LTDicomImageCompressionTypeJpxLossy,  
}; 
public enum DicomImageCompressionType 
public enum class DicomImageCompressionType   
Members
ValueMemberDescription
0None No compression.
1Rle RLE compression.
2JpegLossless JPEG lossLess compression.
3JpegLossy JPEG lossy compression.
4JpegLsLossless JPEG-LS lossLess.
5JpegLsLossy JPEG-LS lossy.
6J2kLossless JPEG 2000 lossless compression.
7J2kLossy JPEG 2000 lossy compression.
8Mpeg2 MPEG2 video compression. Internally used to read/write DICOM files with the LEADTOOLS Medical Module. For more information on these filters, refer to LEAD DICOM Reader and LEAD DICOM Writer.
9Mpeg2Hd MPEG2 HD video compression. Internally used to read/write DICOM files with the LEADTOOLS Medical Module. For more information on these filters, refer to LEAD DICOM Reader and LEAD DICOM Writer.
10H265 H265
11Unknown Unknown compression.
12JpxLossless JPEG 2000 Part 2 lossless compression.
13JpxLossy JPEG 2000 Part 2 lossy compression.
Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
public void TestDicomImage() 
{ 
   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); 
 
      DicomElement pixelDataElement = ds.FindFirstElement(null, DicomTag.PixelData, true); 
      if (pixelDataElement == null) 
      { 
         Console.WriteLine("This dataset is missing the pixel data element", "Sample"); 
         return; 
      } 
 
      if (ds.GetImageCount(pixelDataElement) == 0) 
      { 
         Console.WriteLine("Sample: This dataset has no images"); 
         return; 
      } 
 
      DicomImageInformation imageInformation = ds.GetImageInformation(pixelDataElement, 0); 
      if (imageInformation == null) 
      { 
         Console.WriteLine("Sample: Can't retrieve image information"); 
         return; 
      } 
      // Over here we can access the different properties of the DicomImageInformation class to get some 
      // of the image attributes such as bits allocated (DicomImageInformation. BitsAllocated) 
      RasterImage image = ds.GetImage(pixelDataElement, 
         0, 
         0, 
         RasterByteOrder.Gray, 
         DicomGetImageFlags.AllowRangeExpansion | DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut); 
 
      if (image == null) 
      { 
         Console.WriteLine("Sample: Can't retrieve image"); 
         return; 
      } 
 
      //If the image has more than one frame then we can call DicomDataSet.GetImages to get all the frames 
      using (DicomDataSet ds1 = new DicomDataSet()) 
      { 
         ds1.Initialize(DicomClassType.DXImageStoragePresentation, DicomDataSetInitializeType.ExplicitVRLittleEndian); 
         DicomElement pixelDataElement1 = ds1.FindFirstElement(null, DicomTag.PixelData, true); 
         if (pixelDataElement1 != null) 
         { 
            ds1.SetImage(pixelDataElement1, 
               image, 
               DicomImageCompressionType.None, 
               DicomImagePhotometricInterpretationType.Monochrome2, 
               16, 
               2, 
               DicomSetImageFlags.AutoSetVoiLut); 
            //If we have more than one frame then we can call DicomDataSet.SetImages 
 
            //This is an alternative way to set the image, I will first delete the 
            //existing image and then call DicomDataSet.InsertImage 
            ds1.DeleteElement(pixelDataElement1); 
            pixelDataElement1 = ds1.InsertElement(null, false, DicomTag.PixelData, DicomVRType.UN, false, 0); 
            ds1.InsertImage(pixelDataElement1, 
               image, 
               0, 
               DicomImageCompressionType.None, 
               DicomImagePhotometricInterpretationType.Monochrome2, 
               16, 
               2, 
               DicomSetImageFlags.AutoSetVoiLut); 
            //If we have more than one frame then we can call DicomDataSet.InsertImages 
 
            ds1.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "Test.dcm"), DicomDataSetSaveFlags.None); 
 
         } 
      } 
      //Load DICOM File 
      ds.Load(dicomFileName, DicomDataSetLoadFlags.None); 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Dicom Namespace

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

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.