Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, March 18, 2012 5:20:11 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,331

Was thanked: 1 time(s) in 1 post(s)

If a DICOM dataset contains invalid elements, the LDicomDS.CopyDS method returns error 5 (DICOM_ERROR_WRITE).
You can work around this if you use the overload of CopyDS that has a callback. In the callback, return FALSE when you get to the invalid element. This way, CopyDS will copy everything but the invalid element.

Here is sample code that shows how to do this:
L_BOOL EXT_CALLBACK pfnCopyDSCallBack(pDICOMELEMENT pElement, L_UINT16 nFlags, L_VOID *pUserData)

    //The condition in the following if statement depends on the dataset.
    //This is just an example for one dataset that had invalid Other Patient IDs Sequence item.
    if (pElement->nTag == TAG_OTHER_PATIENT_IDS_SEQUENCE)
        return FALSE;
    return TRUE;

void CDicomDlg::OnCopyDataset() 
    L_UINT32 nClass;
    L_UINT16 uFlags;
    L_TCHAR buf[180];

    LDicomDS lDS(NULL);
    LDicomDS lDSTmp(NULL);
    lDS.LoadDS(TEXT("D:\\X.dcm"), 0);

    int nRet = lDSTmp.CopyDS(NULL, &lDS, NULL, pfnCopyDSCallBack, NULL); 
    if (nRet == 0)
        lDSTmp.GetInfoDS(&nClass, &uFlags);
        wsprintf(buf, TEXT("Data Set #2\nClass = %d\nFlags = %d"), nClass, uFlags);
        ::MessageBox(NULL, buf, TEXT("Test"), MB_OK);

Edited by moderator Wednesday, March 21, 2018 10:19:05 AM(UTC)  | Reason: Formatted code


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2018, Yet Another Forum.NET
This page was generated in 0.113 seconds.