Setting modality LUT data and attributes Example for Delphi
// This example will set Rescale Intercept (0028,1052)
// element to -128.0 and Rescale Slope (0028,1053)
// element to 1.0
var
// Object that will hold modality LUT attributes
ModalityLUTAttributes: LModalityLUTAttributes;
nRet: Integer;
Data: OleVariant;
begin
ModalityLUTAttributes:= LEADDicomDS1.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 !
LEADDicomDS1.DeleteModalityLUT (0);
//Set rescale slope and intercept
nRet:= LEADDicomDS1.SetModalityLUT (Data, 0);
ShowMessage(IntToStr(nRet));
end;