#include "ltdic.h"
L_LTDIC_API L_INT L_DicomSendCStoreRequest(hNet, nPresentationID, nMessageID, pszClass, pszInstance, nPriority, pszMoveAE, nMoveMessageID, hDS)
Sends a C-STORE-REQ message to a peer member of a connection.
A DICOM Network handle to the peer member of the connection.
Presentation ID. The presentation ID provides information about both the class type of the data and the transfer syntax to use when transferring the data.
Message ID. Each message sent by a member of a connection should have a unique ID. Since a member of a connection may send several messages, this ID allows that member to identify when a specific request has been completed.
Class affected by the request. This will be an SOP Class or an SOP MetaClass.
The instance of the class. A server may, for example, have three instances of the Nuclear Medicine Class. This value identifies the data with a specific instance.
The priority level of the message. The Service Class Provider may or may not support priority. Therefore, setting this parameter may or may not have any effect. Possible values are:
Value | Meaning |
---|---|
COMMAND_PRIORITY_LOW | [0x0002] Low priority message. |
COMMAND_PRIORITY_MEDIUM | [0x0000] Medium priority message. |
COMMAND_PRIORITY_HIGH | [0x0001] High priority message. |
Character string that contains the name of the application entity that originally requested the move. For a simple storage request from a client to a server, this should be ". When the request is a sub-operation of a C-MOVE, this will contain the name of the AE that requested the move.
The ID of the original move request message. For a simple storage request from a client to a server, this should be 0. When the request is a sub-operation of a C-MOVE, this will contain the original message ID of the C-MOVE request.
Pointer to the data set to be stored.
Value | Meaning |
---|---|
DICOM_SUCCESS | The function was successful. |
>0 | An error occurred. Refer to Return Codes. |
When an SCU requests a Move (C-MOVE-REQ), the SCP may have to call this function to request one or more C-STORE-REQ sub-operations to complete the storage. The series of calls and information transfer in a C-MOVE-REQ is complicated. For more information, refer to Moving Composite Data.
Calling this function generates a call to RECEIVECSTOREREQUESTCALLBACK on the SCP. The SCP should respond by calling L_DicomSendCStoreResponse which will generate a call to RECEIVECSTORERESPONSECALLBACK.
Required DLLs and Libraries
Win32, x64, Linux.
#include <memory.h>
L_INT DicomSendCStoreRequestExample(HDICOMNET hNet, HWND hWnd)
{
L_TCHAR * pszClass=NULL;
L_TCHAR * pszInstance=NULL;
L_TCHAR szMsg[200];
L_TCHAR szFilter[100]= TEXT("AllFiles (*.*)\0*.*\0Dicom Files (*.dcm)\0*.dcm\0\0");
L_UCHAR nID;
HDICOMPDU hPDU;
OPENFILENAME OpenFileName;
L_TCHAR szFile[MAX_PATH] = TEXT("\0");
L_INT nRet;
HDICOMDS hDS=NULL;
pDICOMELEMENT pElement=NULL;
OPENDLGPARAMS DlgParams;
/* send a store request to the server */
hPDU = L_DicomGetAssociate(hNet);
/* pick the data set to send */
lstrcpy( szFile, TEXT(""));
memset ( &OpenFileName, 0, sizeof ( OPENFILENAME ) ) ;
memset ( &DlgParams, 0, sizeof ( OPENDLGPARAMS ) ) ;
OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hWnd;
OpenFileName.lpstrFilter = szFilter;
OpenFileName.lpstrCustomFilter = NULL;
OpenFileName.nMaxCustFilter = 0;
OpenFileName.nFilterIndex = 0;
OpenFileName.lpstrFile = szFile;
OpenFileName.nMaxFile = sizeof(szFile);
OpenFileName.lpstrFileTitle = NULL;
OpenFileName.nMaxFileTitle = 0;
OpenFileName.lpstrInitialDir = NULL;
OpenFileName.lpstrTitle = TEXT("Pick a Dicom Data Set");
OpenFileName.nFileOffset = 0;
OpenFileName.nFileExtension = 0;
OpenFileName.lpstrDefExt = NULL;
OpenFileName.lpfnHook = NULL;
OpenFileName.Flags = 0;
DlgParams.uStructSize = sizeof ( OPENDLGPARAMS ) ;
DlgParams.pfnFileLoadCallback = NULL ;
DlgParams.uDlgFlags = DLG_OPEN_SHOW_PROGRESSIVE |
DLG_OPEN_SHOW_FILEINFO |
DLG_OPEN_SHOW_PREVIEW |
DLG_OPEN_SHOW_DELPAGE |
DLG_OPEN_SHOW_LOADOPTIONS |
DLG_OPEN_LOADBITMAP ;
nRet = L_DlgOpen (hWnd, &OpenFileName, &DlgParams);
if( SUCCESS_DLG_OK == nRet )
{
/* load the data set */
hDS = L_DicomCreateDS(NULL);
nRet = L_DicomLoadDS(hDS, szFile, 0);
if(nRet != DICOM_SUCCESS)
{
MessageBox(NULL, TEXT("Error Loading Data Set!"), TEXT("Error"), MB_OK);
L_DicomFreeDS(hDS);
return nRet;
}
pElement = L_DicomFindFirstElement(hDS, NULL, TAG_SOP_INSTANCE_UID, FALSE);
pszInstance = L_DicomGetStringValue(hDS, pElement, 0, 1);
pElement = L_DicomFindFirstElement(hDS, NULL, TAG_SOP_CLASS_UID, FALSE);
pszClass = L_DicomGetStringValue(hDS, pElement, 0, 1);
/* send the command set */
nID = L_DicomFindAbstract(hPDU, pszClass);
if(nID == 0)
{
wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), pszClass);
MessageBox(NULL, szMsg, TEXT("Error"), MB_OK);
}
else
{
/* now, use the high-level method to send the command set */
nRet = L_DicomSendCStoreRequest(hNet, nID, 1, pszClass, pszInstance, COMMAND_PRIORITY_MEDIUM, TEXT(""), 0, hDS);
if (nRet != DICOM_SUCCESS)
{
L_DicomFreeDS(hDS);
return nRet;
}
}
L_DicomFreeDS(hDS);
}
return DICOM_SUCCESS;
}