87 lines
2.8 KiB
C
87 lines
2.8 KiB
C
|
|
#ifndef _DCM_FIND_H_
|
||
|
|
#define _DCM_FIND_H_
|
||
|
|
|
||
|
|
#include "internal/dcm_global.h"
|
||
|
|
#include "internal/dcm_type.h"
|
||
|
|
#include "internal/dcmtk_headers.h"
|
||
|
|
#include <list>
|
||
|
|
|
||
|
|
|
||
|
|
// this class is awkward, since even it make you a little happy to do with DCMTK, but you still need to
|
||
|
|
// deal with DCMTK type.
|
||
|
|
// For a whole wrapper, really a big project.
|
||
|
|
|
||
|
|
// Inherit this class for custom callback handler
|
||
|
|
class _DCM_EXPORT dcm_cfind_callback : public DcmFindSCUCallback
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
dcm_cfind_callback();
|
||
|
|
dcm_cfind_callback(DcmFindSCUExtractMode extractResponse, int cancelAfterNResponse, const char *outputDirectory = NULL);
|
||
|
|
virtual ~dcm_cfind_callback() {};
|
||
|
|
virtual void callback(T_DIMSE_C_FindRQ *request, int &responseCount, T_DIMSE_C_FindRSP *rsp, DcmDataset *responseIdentifiers);
|
||
|
|
|
||
|
|
std::string get_outputdir();
|
||
|
|
// verify whether the dir exists and writable
|
||
|
|
bool verify();
|
||
|
|
|
||
|
|
private:
|
||
|
|
DcmFindSCUExtractMode extractResponse_;
|
||
|
|
int cancelAfterNReponses_;
|
||
|
|
std::string outputDirectory_;
|
||
|
|
};
|
||
|
|
|
||
|
|
//only support find filter passed in, not files.
|
||
|
|
class _DCM_EXPORT dcm_cfind
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
//dcm_cfind();
|
||
|
|
dcm_cfind(const char *peerIp, unsigned long peerPort, const char *peerTitle, const char *ourTile);
|
||
|
|
~dcm_cfind();
|
||
|
|
|
||
|
|
void set_asce_timeout(int timeout);
|
||
|
|
void set_dimse_timeout(int timeout);
|
||
|
|
void set_max_received_pdu_lenght(unsigned long length);
|
||
|
|
void set_find_callback(dcm_cfind_callback *callback);
|
||
|
|
|
||
|
|
// the query condition will contains as much as information, handle it in your custom callback
|
||
|
|
int find_by_patient_id(std::string patient_id);
|
||
|
|
int find_by_patient_id_and_date(std::string patient_id, std::string startdate, std::string enddate);
|
||
|
|
int find_by_patient_name(std::string patient_name);
|
||
|
|
int find_by_patient_name_and_date(std::string patient_name, std::string startdate, std::string enddate);
|
||
|
|
int find_by_accession_no(std::string accession_no);
|
||
|
|
int find_by_accession_no_and_date(std::string accession_no, std::string startdate, std::string enddate);
|
||
|
|
int find_by_study_uid(std::string study_uid);
|
||
|
|
int find_by_series_uid(std::string study_uid);
|
||
|
|
int find_by_series_uid(std::string study_uid, std::string series_uid);
|
||
|
|
|
||
|
|
// worklist related
|
||
|
|
int find_by_timeinterval(std::string startDate, std::string endDate);
|
||
|
|
|
||
|
|
private:
|
||
|
|
OFCondition docfind();
|
||
|
|
void initQueryInfo();
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::list<std::string> fileNameList;
|
||
|
|
bool abortAssociation;
|
||
|
|
const char * abstractSyntax;
|
||
|
|
int acse_timeout;
|
||
|
|
T_DIMSE_BlockingMode blockMode;
|
||
|
|
//signed long cancelAfterNResponse;
|
||
|
|
int dimse_timeout;
|
||
|
|
//DcmFindSCUExtractMode extractResponse;
|
||
|
|
//std::string extractXMLFileName;
|
||
|
|
//std::string outputDirectory;
|
||
|
|
unsigned long maxReceivePDULength;
|
||
|
|
E_TransferSyntax networkTransferSyntax;
|
||
|
|
const char * ourTitle_;
|
||
|
|
const char * peerIp_;
|
||
|
|
const char * peerTitle_;
|
||
|
|
unsigned long peerPort_;
|
||
|
|
unsigned long repeatCount;
|
||
|
|
std::list<std::string> overrideKeys;
|
||
|
|
|
||
|
|
dcm_cfind_callback *cfind_callback;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // _DCM_FIND_H_
|