Available in LEADTOOLS Medical Imaging toolkits. |
L_DicomAnnCount
#include "ltdic.h"
L_LTDIC_API L_UINT16 L_DicomAnnCount(hDS, pFileIndices, pnPrivateCreatorTag)
HDICOMDS hDS; |
/* a DICOM handle */ |
L_INT *pFileIndices; |
/* pointer to an array */ |
L_UINT32 *pnPrivateCreatorTag; |
/* pointer to the private creator tag */ |
Gets information about the annotations stored in a DICOM data set.
Parameter |
Description |
hDS |
A DICOM handle. |
pFileIndices |
Pointer to an array of integers to be updated with the indices of the annotation files that exist in the DICOM data set. |
pnPrivateCreatorTag |
Pointer to a variable to be updated with the private creator tag. Pass NULL if you do not wish to retrieve this information. |
Returns
0 |
SUCCESS |
>0 |
An error occurred. Refer to Return Codes. |
Comments
LEAD Annotation files can be saved as private data in a DICOM data set (LEAD native format or binary encoded format). There can be up to 256 private data tags for LEAD annotation files. Specify one of the 256 possible files by setting the nIndex parameter to be a value from 0 to 255.
Before calling this function, you must declare an array of 256 integers (L_INT). Then, pass the address of the array for the pFileIndices parameter. This function will update the array to indicate which of the possible 256 annotation files exist.
For example, suppose that a Dicom data set contains three LEAD annotation files at indices 0,1, and 4.
Executing the following
HDICOMDS hDS;
L_INT FileIndices[256];
hDS = L_DicomCreateDS(NULL);
L_DicomLoadDS(hDS, "d:\\work\\images\\a.dic", 0);
L_DicomAnnCount(hDS, FileIndices, NULL);
L_DicomFreeDS(hDS);
will set the FileIndices as follows:
FileIndices[0] = 1
FileIndices[1] = 1
FileIndices[2] = 0
FileIndices[3] = 0
FileIndices[4] = 1
FileIndices[5..255] = 0
You can obtain the private creator tag used to allocate tags for the LEAD annotation files by declaring a variable of type L_UINT32 and passing the address for the pnPrivateCreatorTag argument. Pass NULL for this argument if you do not wish to retrieve this information.
Please note that both the DICOM capabilities and the DOCUMENT capabilities must be unlocked in order to work with DICOM annotations. For more information on unlocking these capabilities, refer to L_UnlockSupport.
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 |
Win32, x64
See Also
Functions: |
|
Topics: |
Example
this example 1. Opens a dataset with annotations. 2. Finds the location of one of the annotation files. 3. Loads the annotations. 4. Changes the foreground color of the annotations to blue. 5. Saves the annotations to position 250 through 255 in the array. 6. Deletes the annotation file from position 253.
L_INT DicomAnnCountExample(L_VOID) { L_UINT16 nRet; HDICOMDS hDS; L_INT FileIndices[256]; L_UINT32 nPrivateCreatorTag; int i; HANNOBJECT hAnnContainer; L_TCHAR szMsg[800]; L_TCHAR szTmp[100]; int nIndexAnn = -1; (L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT); (L_SUPPORT_DICOM, L_KEY_DICOM); // Open the dataset with annotations hDS = L_DicomCreateDS(NULL); nRet = L_DicomLoadDS(hDS, TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\DicomAnn.dcm"), 0); if (nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } // Find the location of one of the annotation files nRet = L_DicomAnnCount(hDS, FileIndices, &nPrivateCreatorTag); if (nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } wsprintf(szMsg, TEXT("Private Creator Tag: %x\n\nFiles:\n"), nPrivateCreatorTag); for (i=0; i<255; i++) { if (FileIndices[i]) { nIndexAnn = i; wsprintf(szTmp, TEXT("\t%d\n"), i); lstrcat(szMsg, szTmp); } } MessageBox(NULL, szMsg, TEXT(""), MB_OK); // Loads the annotations nRet = L_DicomAnnLoad( hDS, &hAnnContainer, nIndexAnn, NULL); if(nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } // Change the foreground color of the annotations to blue (hAnnContainer, RGB(0,0,0xFF), ANNFLAG_RECURSE); // Save the annotations to index to slots 250 through 255 for (i=250; i<=255; i++) { nRet = L_DicomAnnSave( hDS,hAnnContainer,ANNFMT_NATIVE,FALSE,NULL,i,NULL); if (nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } } // Delete the annotation files from slot 253 nRet = L_DicomAnnDelete(hDS, 253, -1); if(nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } // Display file info nRet = L_DicomAnnCount(hDS, FileIndices, &nPrivateCreatorTag); if (nRet != DICOM_SUCCESS) { L_DicomFreeDS(hDS); return nRet; } wsprintf(szMsg, TEXT("Private Creator Tag: %x\n\nFiles:\n"), nPrivateCreatorTag); for (i=0; i<255; i++) { if (FileIndices[i]) { wsprintf(szTmp, TEXT("\t%d\n"), i); lstrcat(szMsg, szTmp); } } MessageBox(NULL, szMsg, TEXT(""), MB_OK); // Save the data set nRet = L_DicomSaveDS( hDS, TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Dicom.dcm"), 0); L_DicomFreeDS(hDS); return nRet; }