[FlagsAttribute()]
public enum DicomSetImageFlags
public class DicomSetImageFlags
[FlagsAttribute()]
public enum class DicomSetImageFlags
Value | Member | Description |
---|---|---|
0x00000000 | None | None. |
0x00000001 | AutoSaveOverlays | The method will automatically insert the overlays associated with the input image into the dataset. |
0x00000002 | AutoSetVoiLut | The method will automatically add a VOI LUT to the dataset. |
0x00000004 | MinimizeJpegSize | and the nCompression parameter is IMAGE_COMPRESSION_JPEG_LOSSLESS or IMAGE_COMPRESSION_JPEG_LOSSY, the JPEG compression engine will use optimized Huffman tables, which results in better compression, but slower speed |
0x00000008 | MfgOverwriteShared | For SetImage and SetImageList: This flag is ignored. For all other methods: Existing elements under the Shared Functional Groups Sequence will be overwritten. If this flag is not included, Shared Functional Groups Sequence elements are unchanged. |
0x00000010 | MfgVoiLutPerFrame | For SetImage and SetImageList: The Frame VOI LUT Sequence is added under the Per-frame Functional Groups Sequence.
For all other methods: |
0x00000020 | MfgVoiLutShared | For SetImage and SetImageList: The Frame VOI LUT Sequence is added under the Shared Functional Groups Sequence.
For all other methods: |
0x00000040 | MfgModalityLutPerFrame | For SetImage and SetImageList: The Pixel Value Transformation Sequence is added under the Per-frame Functional Groups Sequence.
For all other methods: |
0x00000080 | MfgModalityLutShared | For SetImage and SetImageList: The Pixel Value Transformation Sequence is added under the Shared Functional Groups Sequence.
For all other methods: |
0x00000200 | OptimizedMemory | Enables the method to minimize memory usage by utilizing the disk. The method optimizes memory to the minimum possible. |
0x20000000 | KeepLutsIntact | For internal use by LEADTOOLS. |
For Android/Java users: The constant members of this class are defined using all capital letters with underscores between words.
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:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.