LDicomDS::SetModalityLUT
#include "ltdic.h"
L_UINT16 LDicomDS::SetModalityLUT(pModalityLUTAttributes, pLUTData, uDataSize, uFlags)
pDICOMMLUTATTRIBS pModalityLUTAttributes; |
/* pointer to a Modality LUT attributes structure */ |
L_UINT16 *pLUTData; |
/* pointer to the input buffer */ |
L_UINT uDataSize; |
/* size of the input buffer */ |
L_UINT uFlags; |
/* reserved for future use */ |
Sets the attributes that describe the Modality LUT.
Parameter |
Description |
pModalityLUTAttributes |
Pointer to a structure containing the Modality LUT attributes to set. |
pLUTData |
Pointer to the buffer that holds the "LUT Data" to set. Pass NULL if you are not trying to set the "LUT Data" (0028,3006) under the "Modality LUT Sequence" (0028,3000). |
uDataSize |
Size of the buffer pointed to by pLUTData. Pass 0 if pLUTData is set to NULL. |
uFlags |
Reserved for future use. Pass 0. |
Returns
0 |
The function was successful. |
> 0 |
An error occurred. Refer to Return Codes. |
Comments
This function will set the attributes of the "Modality LUT Module". Before calling this function, initialize pModalityLUTAttributes->uStructSize to be sizeof(DICOMMLUTATTRIBS) and initialize all the attributes which you are changing.
If you are trying to set the "Rescale Intercept" (0028,1052) and "Rescale Slope" (0028,1053), set pModalityLUTAttributes->bIsRescaleSlopeIntercept to TRUE and populate pModalityLUTAttributes->RescaleIntercept, pModalityLUTAttributes->RescaleSlope with the new values. You can also populate pModalityLUTAttributes->szRescaleType if you want to set "Rescale Type" (0028,1054).
If you are trying to set the elements under "Modality LUT Sequence", set pModalityLUTAttributes->bIsModalityLUTSequence to TRUE and populate
pModalityLUTAttributes->LUTDescriptor and pModalityLUTAttributes->szModalityLUTType .In this case pLUTData should point to the "LUT Data" (0028,3006) buffer.
This function will return an error if both pModalityLUTAttributes->bIsRescaleSlopeIntercept and pModalityLUTAttributes->bIsModalityLUTSequence are set to TRUE. It will also return an error if pModalityLUTAttributes->bIsModalityLUTSequence is set to TRUE and you pass NULL for pLUTData or 0 for uDataSize.
Required DLLs and Libraries
LTDIC For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
See Also
Functions: |
LDicomDS::GetModalityLUTAttributes, LDicomDS::GetModalityLUTData, LDicomDS::DeleteModalityLUT, Class Members |
Topics: |
|
|
Example
// This example will set Rescale Intercept (0028,1052)
// element to -128.0 and Rescale Slope (0028,1053)
// element to 1.0
L_UINT16 MySetRescaleSlopeIntercept
(
LDicomDS &DS//Input dataset
)
{
// Structure that will hold the new modality LUT attributes
DICOMMLUTATTRIBS ModalityLUTAttributes = {0};
L_UINT16 uRet;
//Remember to set the structure size
ModalityLUTAttributes.uStructSize= sizeof(DICOMMLUTATTRIBS);
//No Modality LUT Sequence (0028,3000)
ModalityLUTAttributes.bIsModalityLUTSequence = FALSE;
//Yes there is a rescale slope and intercept
ModalityLUTAttributes.bIsRescaleSlopeIntercept = TRUE;
ModalityLUTAttributes.fRescaleIntercept = -128.0;
ModalityLUTAttributes.fRescaleSlope = 1.0;
strcpy(ModalityLUTAttributes.szRescaleType,"UNSPECIFIED");
// Delete the existing modality LUT,
// although we don't have to !
DS.DeleteModalityLUT (0);
//Set rescale slope and intercept
return DS.SetModalityLUT ( &ModalityLUTAttributes ,// new attributes
NULL ,// no LUT Data
0,0);
}