LDicomDS::AnnCount
#include "ltdic.h"
L_UINT16 LDicomDS::AnnCount(pFileIndices, pnPrivateCreatorTag)
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. This function is available in the Medical Toolkits.
Parameter |
Description |
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
LDicomDS DicomDS;
L_INT FileIndices[256];
DicomDS.LoadDS("d:\\work\\images\\a.dic", 0);
DicomDS.AnnCount(FileIndices, NULL);
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 LSettings::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 |
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 index to slots 250 through 255
// 6. Deletes the annotation files from slot 253
void ClassLibDicomAnnotationExample()
{
L_UINT16 nRet;
L_INT FileIndices[256];
L_UINT32 nPrivateCreatorTag;
int i;
HANNOBJECT hAnnContainer;
char szMsg[800];
char szTmp[100];
int nIndexAnn = -1;
LAnnotation AnnContainer;
LSettings::UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
LSettings::UnlockSupport (L_SUPPORT_DICOM, L_KEY_DICOM);
// Open the dataset with annotations
LDicomDS DicomDS;
nRet = DicomDS.LoadDS("d:\\work\\images\\DicomAnn.dic", 0);
if (nRet != DICOM_SUCCESS) return;
// Find the location of one of the annotation files
nRet = DicomDS.AnnCount(FileIndices, &nPrivateCreatorTag);
if (nRet != DICOM_SUCCESS) return;
wsprintf(szMsg, "Private Creator Tag: %x\n\nFiles:\n", nPrivateCreatorTag);
for (i=0; i<255; i++)
{
if (FileIndices[i])
{
nIndexAnn = i;
wsprintf(szTmp, "\t%d\n", i);
strcat(szMsg, szTmp);
}
}
MessageBox(NULL, szMsg, "", MB_OK);
// Loads the annotations
DicomDS.AnnLoad(&hAnnContainer, nIndexAnn, NULL);
// Change the foreground color of the annotations to blue
AnnContainer. SetHandle(hAnnContainer);
AnnContainer. SetForeColor(RGB(0,0,0xFF), ANNFLAG_RECURSE);
// Save the annotations to index to slots 250 through 255
for (i=250; i<=255; i++)
nRet = DicomDS.AnnSave(hAnnContainer,ANNFMT_NATIVE,FALSE,NULL,i,NULL);
// Delete the annotation files from slot 253
DicomDS.AnnDelete(253, -1);
// Display file info
nRet = DicomDS.AnnCount(FileIndices, &nPrivateCreatorTag);
if (nRet != DICOM_SUCCESS) return;
wsprintf(szMsg, "Private Creator Tag: %x\n\nFiles:\n",
nPrivateCreatorTag);
for (i=0; i<255; i++)
{
if (FileIndices[i])
{
wsprintf(szTmp, "\t%d\n", i);
strcat(szMsg, szTmp);
}
}
MessageBox(NULL, szMsg, "", MB_OK);
// Save the data set
DicomDS.SaveDS("d:\\erase\\dicom.dic", 0);
}