←Select platform

DicomGetImageFlags Enumeration

Summary
Represents the values that control the behavior of the GetImage and GetImages methods.
Syntax
C#
C++/CLI
Java
[FlagsAttribute()] 
public enum DicomGetImageFlags 
public class DicomGetImageFlags 
[FlagsAttribute()] 
public enum class DicomGetImageFlags   
Members
ValueMemberDescription
0x00000000None None.
0x00000001AutoLoadOverlays The method will automatically extract the overlays included in the dataset and add them to the loaded image.
0x00000002AutoApplyModalityLut The method will automatically apply the "Modality LUT" when loading the image.
0x00000004AutoApplyVoiLut The method will automatically apply the "VOI LUT" when loading the image.
0x00000008AllowRangeExpansion (Deprecated, do not use) The method will adjust the high bit and/or low bit (if possible) inside the RasterImage in order to hold the range of pixel values after applying the modality LUT.
0x00000010AutoScaleModalityLut The method will scale the resulting pixel data to fit within the range of 0 to 2^BitsPerPixel-1 if any of the values would exceed that range.
0x00000020AutoScaleVoiLut Only used in conjunction with AutoScaleModalityLut. The method will rescale the VOI LUT to match the rescale that was performed by AutoScaleModalityLut.
0x00000040AutoDetectInvalidRleCompression The method will automatically detect invalid RLE compression.
0x00000080RleSwapSegments Swaps the MSB and LSB segments when loading RLE compressed data. This flag can be used to load RLE compressed data that is stored incorrectly in this manner. Note that users should use this flag only in instances where it is known that the RLE compressed data is stored incorrectly. To automatically detect/correct incorrectly stored RLE compressed data, pass the AutoDetectInvalidRleCompression flag instead.
0x00000100LoadCorrupted Allow loading of corrupt JPEG images. For more information, refer to LoadCorrupted.
0x00000200VoiLutPaintOnly Automatically applies the "VOI LUT" when loading the image, but only for display purposes.
0x00000400UseDisk Allocates the memory for loading the image using hard disk space (if possible).
0x00010000KeepColorPalette When Photometric Interpretation is 'PALETTE COLOR', returns a grayscale image with a color palette. Without this flag, 'PALETTE COLOR' images are converted to 24-RGB.
Remarks

For Android/Java users: The constant members of this class are defined using all capital letters with underscores between words.

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.