Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS DICOM C DLL Help

L_DicomCopyDS

Show in webframe

#include "ltdic.h"

L_LTDIC_API L_UINT16 L_DicomCopyDS(hDstDS, pDstParent, hSrcDS, pSrcParent)

HDICOMDS hDstDS;

/* a DICOM handle */

pDICOMELEMENT pDstParent;

/* pointer to a DICOMELEMENT structure */

HDICOMDS hSrcDS;

/* a DICOM handle */

pDICOMELEMENT pSrcParent;

/* pointer to a DICOMELEMENT structure */

Copies the data elements from one data set to another.

Parameter

Description

hDstDS

A DICOM handle to the data set to receive the copied data set (the destination data set).

pDstParent

A pointer to a DICOMELEMENT structure that contains a Data element within the destination data set. A copy of the source data set will be inserted as the child of this data element.

hSrcDS

A DICOM handle to the data set to be copied (the source data set).

pSrcParent

A pointer to a DICOMELEMENT structure that contains a Data element within the source data set. All children, grandchildren, etc. of this element will be added to the destination data set.

Returns

DICOM_SUCCESS

The function was successful.

>0

An error occurred. Refer to Return Codes.

Comments

If both pSrcParent and pDstParent are NULL, the source data set will be inserted at the root level of the destination data set. Therefore the highest level elements of the source data set will be added as siblings to the highest level elements of the destination data set. This can be seen in the diagram below.

image\CopyNN.gif

If pSrcParent is not NULL and pDstParent is NULL, the children of pSrcParent will be added at the root level of the destination data set (i.e. as siblings to elements at the highest level). This can be seen in the diagram below. Note that the source elements to be added are in blue.

image\CopySN.gif

If pScrParent is NULL and pDstParent is not NULL, the entire source data set will be added as children to pDstParent. This can be seen in the diagram below.

image\CopyND.gif

If pSrcParent and pDstParent are both not NULL, then the children of pSrcParent are added as the children of pDstParent. This can be seen in the diagram below. The original children of pDstParent are in red and the source elements to be added are in blue.

image\CopySD.gif

If an inserted element has the same tag value as a destination element at the same level and with the same parent, then the value from the source element is copied into the destination element and any child elements are added accordingly. For example, the diagram below shows the result of a call to L_DicomCopyDS. If the two elements indicated by the arrows have the same tag value, the value from the source element is copied into the destination element and the structure on the right results. This is shown by the red outline of the destination element with the blue center of the source element.

image\CopySDA.gif

To make the destination data set an exact copy of the source data set, instead of inserting it within the destination data set, you must call L_DicomResetDS with the destination data set as the parameter, before calling L_DicomCopyDS.

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

Platforms

Win32, x64, Linux.

See Also

Functions:

L_DicomCreateDS, L_DicomInitDS, L_DicomGetInfoDS

Topics:

Working with Command Sets

 

Working with Data Sets

 

Data Sets: Creating, Initializing, Loading, and Saving Data Sets

 

Data Sets: Inserting and Deleting Data Set Members

Example

This example copies the elements from a Data Set to another Data Set

L_INT DicomCopyDSExample(L_VOID)
{
   L_UINT32 nClass;
   L_UINT16 uFlags;
   L_TCHAR   buf[180];
   HDICOMDS hDS1;
   HDICOMDS hDS2;
   L_UINT16 nRet;
   hDS1 = L_DicomCreateDS(NULL);
   hDS2 = L_DicomCreateDS(NULL);
   L_DicomInitDS(hDS1, CLASS_CR_IMAGE_STORAGE, DS_LITTLE_ENDIAN | DS_IMPLICIT_VR);
   L_DicomGetInfoDS(hDS1, &nClass, &uFlags);
   wsprintf(buf, TEXT("Data Set #1\nClass = %d\nFlags = %d"), nClass, uFlags);
   MessageBox(NULL, buf, TEXT("Test"), MB_OK);
   nRet = L_DicomCopyDS(hDS2, NULL, hDS1, NULL);
   if (nRet != DICOM_SUCCESS)
   {
      L_DicomFreeDS(hDS1);
      L_DicomFreeDS(hDS2);
      return nRet;
   }
   L_DicomGetInfoDS(hDS2, &nClass, &uFlags);
   wsprintf(buf, TEXT("Data Set #2\nClass = %d\nFlags = %d"), nClass, uFlags);
   MessageBox(NULL, buf, TEXT("Test"), MB_OK);
   L_DicomFreeDS(hDS1);
   L_DicomFreeDS(hDS2);
   return DICOM_SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.