112 lines
3.7 KiB
C
112 lines
3.7 KiB
C
|
|
#ifndef _DCM_STORE_H_
|
||
|
|
#define _DCM_STORE_H_
|
||
|
|
|
||
|
|
#include "internal/dcm_global.h"
|
||
|
|
#include "internal/dcm_type.h"
|
||
|
|
#include "internal/dcmtk_headers.h"
|
||
|
|
|
||
|
|
// Inherit this abstract class for custom callback handler
|
||
|
|
class _DCM_EXPORT dcm_cstore_callback
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
dcm_cstore_callback();
|
||
|
|
virtual ~dcm_cstore_callback();
|
||
|
|
virtual void callback(T_DIMSE_StoreProgress * progress, T_DIMSE_C_StoreRQ * req) = 0;
|
||
|
|
|
||
|
|
private:
|
||
|
|
////dcm_cstore_callback(const dcm_cstore_callback& other);
|
||
|
|
////dcm_cstore_callback& operator=(const dcm_cstore_callback& other);
|
||
|
|
};
|
||
|
|
|
||
|
|
class _DCM_EXPORT dcm_cstore
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
dcm_cstore(const char *peerIp, unsigned long peerPort, const char *peerTitle, const char *ourTitle);
|
||
|
|
~dcm_cstore();
|
||
|
|
|
||
|
|
void set_dimse_tiemout(int timeout);
|
||
|
|
void set_acse_tiemout(int timeout);
|
||
|
|
void set_ma_received_pdu_length(unsigned long length);
|
||
|
|
void set_max_send_pdu_length(unsigned long length);
|
||
|
|
void set_store_callback(dcm_cstore_callback *callback);
|
||
|
|
|
||
|
|
// a directory of the files need to transfer
|
||
|
|
int docstore(std::string dir);
|
||
|
|
|
||
|
|
private:
|
||
|
|
int secondsSince1970();
|
||
|
|
std::string intToString(int i);
|
||
|
|
std::string makeUID(std::string basePrefix, int counter);
|
||
|
|
bool updateStringAttributeValue(DcmItem *dataset, const DcmTagKey &key, std::string &value);
|
||
|
|
void replaceSOPInstanceInformation(DcmDataset *dataset);
|
||
|
|
OFCondition addStoragePresentationContexts(T_ASC_Parameters *params, std::list<std::string> &sopClasses);
|
||
|
|
bool findSOPClassAndInstanceInFile(const char *fname, char *sopClass, size_t sopClassSize, char *sopInstance, size_t sopInstanceSize);
|
||
|
|
OFCondition configureUserIdentityRequest(T_ASC_Parameters *params);
|
||
|
|
OFCondition checkUserIdentityResponse(T_ASC_Parameters *params);
|
||
|
|
bool isaListMember(std::list<std::string> &lst, std::string &s);
|
||
|
|
OFCondition addPresentationContext(T_ASC_Parameters *params, int presentationContextId, const std::string &abstractSyntax, const std::string &transferSyntax, T_ASC_SC_ROLE proposedRole = ASC_SC_ROLE_DEFAULT);
|
||
|
|
OFCondition addPresentationContext(T_ASC_Parameters *params, int presentationContextId, const std::string &abstracySyntax, const std::list<std::string> &transferSyntaxList, T_ASC_SC_ROLE proposedRole = ASC_SC_ROLE_DEFAULT);
|
||
|
|
|
||
|
|
OFCondition storeSCU(T_ASC_Association *assoc, const char *fname);
|
||
|
|
OFCondition cstore(T_ASC_Association *assoc, const std::string &fname);
|
||
|
|
|
||
|
|
private:
|
||
|
|
const char * peerIp_;
|
||
|
|
unsigned long peerPort_;
|
||
|
|
const char * peerTitle_;
|
||
|
|
const char * ourTitle_;
|
||
|
|
|
||
|
|
dcm_cstore_callback * cstore_callback;
|
||
|
|
|
||
|
|
unsigned long patientCounter;
|
||
|
|
unsigned long studyCounter;
|
||
|
|
unsigned long seriesCounter;
|
||
|
|
unsigned long imageCounter;
|
||
|
|
|
||
|
|
private:
|
||
|
|
bool abortAssociation;
|
||
|
|
unsigned long maxReceivedPDULength;
|
||
|
|
unsigned long maxSendPDULength;
|
||
|
|
E_TransferSyntax networkTransferSyntax;
|
||
|
|
E_FileReadMode readMode;
|
||
|
|
bool scanDir;
|
||
|
|
bool recurse; // depends on scanDir
|
||
|
|
const char * scanPattern;
|
||
|
|
|
||
|
|
bool haltOnUnsuccessfulStore;
|
||
|
|
bool unsuccessfulStoreEncountered;
|
||
|
|
int lastStatusCode;
|
||
|
|
|
||
|
|
bool proposeOnlyRequiredPresentationContexts;
|
||
|
|
bool combineProposedTransferSyntaxes;
|
||
|
|
|
||
|
|
unsigned long repeatCount;
|
||
|
|
unsigned long inventPatientCount;
|
||
|
|
unsigned long inventStudyCount;
|
||
|
|
unsigned long inventSeriesCount;
|
||
|
|
// set true will cause invent new SOP instance information for the current data set
|
||
|
|
// donot used
|
||
|
|
bool inventSOPInstanceInformation;
|
||
|
|
bool correctUIDPadding;
|
||
|
|
std::string patientNamePrefix;
|
||
|
|
std::string patientIDPrefix;
|
||
|
|
std::string studyIDPrefix;
|
||
|
|
std::string accessionNumberPrefix;
|
||
|
|
const char * configFile;
|
||
|
|
const char * profileName;
|
||
|
|
T_DIMSE_BlockingMode blockMode;
|
||
|
|
int dimse_tiemout;
|
||
|
|
int acse_tiemout;
|
||
|
|
unsigned long socket_tiemout;
|
||
|
|
|
||
|
|
// identify user may be not used
|
||
|
|
T_ASC_UserIdentityNegotiationMode identMode;
|
||
|
|
std::string user;
|
||
|
|
std::string password;
|
||
|
|
std::string identFile_;
|
||
|
|
bool identResponse;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // !_DCM_STORE_H_
|
||
|
|
|