public void SetVoiLut(
int index,
DicomVoiLutAttributes attributes,
int[] data
)
public void setVoiLut(int index, DicomVoiLutAttributes attributes, int[] data)
public:
void SetVoiLut(
int index,
DicomVoiLutAttributes^ attributes,
array<int>^ data
)
index
The zero-based index of the VOI LUT to set. According to the DICOM standard, one or more items could exist under one VOI LUT Sequence (0028,3010); use this index to specify which item to update.
attributes
The VOI LUT attributes to set.
data
Pointer to the buffer that holds the "LUT Data" (0028,3006) to set. This pointer cannot be null.
The size of the data buffer should at least equal the number of entries in the lookup table. According to the DICOM standard, NumberOfEntries should be set to 0 if the number of entries in the lookup table is 2^16; however, you should NOT do that when calling this method. This method will handle correctly setting the value inside the Data Set.
using Leadtools;
using Leadtools.Dicom;
public void TestVoiLut()
{
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())
{
int VoiLutSize = 65536;
//Load DICOM File
ds.Load(dicomFileName, DicomDataSetLoadFlags.None);
ds.DeleteVoiLut();
DicomVoiLutAttributes VoiLutAttributes = new DicomVoiLutAttributes();
VoiLutAttributes.FirstStoredPixelValueMapped = 0;
VoiLutAttributes.EntryBits = 16;
VoiLutAttributes.NumberOfEntries = VoiLutSize;
int[] LutData = new int[VoiLutSize];
for (int i = 0; i < VoiLutSize; i++)
{
LutData[i] = i;
}
ds.SetVoiLut(0, VoiLutAttributes, LutData);
Debug.Assert(ds.VoiLutCount == 1);
DicomVoiLutAttributes attributes = ds.GetVoiLut(0);
if (attributes != null)
{
Debug.Assert(attributes.FirstStoredPixelValueMapped == 0);
Debug.Assert(attributes.EntryBits == 16);
Debug.Assert(attributes.NumberOfEntries == VoiLutSize);
int[] data = ds.GetVoiLutData(0);
// Do something with the data
}
ds.Save(Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "VOILut.dcm"), DicomDataSetSaveFlags.None);
}
DicomEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\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