L_DicomSetModalityLUT
#include "ltdic.h"
L_LTDIC_API L_UINT16 L_DicomSetModalityLUT(hDS, pModalityLUTAttributes, pLUTData, uDataSize, uFlags)
HDICOMDS hDS; |
/* a DICOM handle */ |
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 |
hDS |
A DICOM handle. |
pModalityLUTAttributes |
Pointer to a structure containing the Modality LUT attributes to set. |
pLUTData |
Pointer to the buffer that holds the "LUT Data". 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: |
L_DicomGetModalityLUTAttributes, L_DicomGetModalityLUTData, L_DicomDeleteModalityLUT |
Topics: |
|
|
Example
This example will set Rescale Intercept (0028,1052) element to -128.0 and Rescale Slope (0028,1053) element to 1.0
L_INT DicomSetModalityLUTExample(HDICOMDS hDicomDS) { L_UINT16 nRet; // Structure that will hold the new modality LUT attributes DICOMMLUTATTRIBS ModalityLUTAttributes = {0}; //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; lstrcpy(ModalityLUTAttributes.szRescaleType,TEXT("UNSPECIFIED")); // Delete the existing modality LUT, // although we don't have to ! nRet = L_DicomDeleteModalityLUT(hDicomDS,0); if (nRet != DICOM_SUCCESS) return nRet; //Set rescale slope and intercept return L_DicomSetModalityLUT(hDicomDS, &ModalityLUTAttributes, NULL, 0, 0); }