L_DicomDeleteImage

Summary

Deletes one or more images from a Pixel Data element.

Syntax

#include "Ltdic.h"

L_LTDIC_API L_UINT16 L_DicomDeleteImage(hDS, pElement, nIndex, nCount)

Parameters

HDICOMDS hDS

A DICOM handle.

pDICOMELEMENT pElement

Pointer to a DICOMELEMENT structure within the Data Set.

L_UINT32 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. You can delete the last image in the Pixel Data Element by setting this to ELEMENT_INDEX_MAX.

L_UINT32 nCount

Number of frames to delete from the Pixel Data Element.

Returns

Value Meaning
DICOM_SUCCESS The function was successful.
>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).

If the DICOM dataset has a Multi-frame Functional Groups module that contains an item that has a Per-frame Functional Groups Sequenceitem, the corresponding item is removed from the dataset. If there is a Shared Functional Groups Sequence item, it will not be removed.

For a detailed discussion on Multi-frame Functional Groups and how the DICOM_SET_IMAGE_MFG flags are used, see the topic Multi-frame Functional Groups.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example deletes all images from Data Set

L_INT DicomDeleteImageExample(L_VOID) 
{ 
   HDICOMDS hDS; 
   L_UINT16 uRet; 
 
   hDS = L_DicomCreateDS(NULL); 
 
   uRet = L_DicomLoadDS(hDS,MAKE_IMAGE_PATH(TEXT("Image1.dcm")), 0); 
   if (uRet != DICOM_SUCCESS) 
   { 
      L_DicomFreeDS(hDS); 
      return uRet; 
   } 
 
   uRet = L_DicomDeleteImage(hDS, NULL, 0, ELEMENT_INDEX_MAX); 
 
   L_DicomFreeDS(hDS); 
   return uRet; 
} 

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.