Setting modality LUT data and attributes Example for C#
//LEADDICOM1 is a DICOM Dataset defined outside this method
public void TestSettingModalityLUTDataAndAttributes()
{
// This example will set Rescale Intercept (0028,1052)
// element to -128.0 and Rescale Slope (0028,1053)
// element to 1.0
// Object that will hold modality LUT attributes
LTDICLib.LModalityLUTAttributes ModalityLUTAttributes = null;
short iRet = 0;
object Data = null;
ModalityLUTAttributes = LEADDICOM1.ModalityLUTAttributes;
//No Modality LUT Sequence (0028,3000)
ModalityLUTAttributes.IsModalityLUTSequence = false;
//Yes there is a rescale slope and intercept
ModalityLUTAttributes.IsRescaleSlopeIntercept = true;
ModalityLUTAttributes.RescaleIntercept = -128;
ModalityLUTAttributes.RescaleSlope = 1;
ModalityLUTAttributes.RescaleType = "UNSPECIFIED";
// Delete the existing modality LUT,
// although we don't have to !
LEADDICOM1.DeleteModalityLUT(0);
//Set rescale slope and intercept
iRet = LEADDICOM1.SetModalityLUT(Data,
0);
}