LDicomDS::DeleteImage

#include "Ltdic.h"

L_UINT16 LDicomDS::DeleteImage(pElement, nIndex, nCount)

pDICOMELEMENT pElement;

/* pointer to a DICOMELEMENT structure */

L_UINT32 nIndex;

/* index value */

L_UINT32 nCount;

/* number of frames to delete */

Deletes one or more images from a Pixel Data element.

Parameter

Description

pElement

Pointer to a DICOMELEMENT structure within the Data Set.

nIndex

Position of the first frame to delete. Use zero-based indexing. For example, if there are 10 bitmaps in a list, the index of the last one is 9.

nCount

Number of frames to delete from the Pixel Data Element.

Returns

0

SUCCESS

>0

An error occurred. Refer to Return Codes.

Comments

As an example, if you wish to delete 50 images starting with the 50th frame in the Pixel Data, call this function with nIndex set to 49 (the 50th frame in a zero-based index) and nCount set to 50.

Most DICOM files will only have one Data Element of type TAG_PIXEL_DATA. Therefore, in most instances you can set pElement to NULL, since the function will automatically delete the image(s) from the only Pixel Data Element in the file. If pElement is not NULL, it must point to the Pixel Data Element itself.

If the DICOM file is CLASS_BASIC_DIRECTORY, the file may contain more than one Pixel Data Element. In this case you must specify in pElement the Pixel Data Element from to delete the image(s).

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::GetCountImage, LDicomDS::GetImage

Topics:

Working with Data Sets

Example

This example deletes all images from Data Set.

L_INT LDicomDS_DeleteImageExample() 
{
   L_INT       nRet;
   LDicomDS*   pDS;
   pDS = new LDicomDS(NULL);
   nRet = pDS->LoadDS(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.dic"), 0);
   if(nRet != DICOM_SUCCESS)
      return nRet;
   nRet = pDS->DeleteImage(NULL, 0, ELEMENT_INDEX_MAX);
   if(nRet != DICOM_SUCCESS)
      return nRet;
   delete pDS;
   return DICOM_SUCCESS;
}