|
@@ -74,6 +74,12 @@ public:
|
|
|
int CalledPort;
|
|
|
DcmSCU SCU;
|
|
|
DcmDataset* parameters;
|
|
|
+
|
|
|
+ // do the retrieve, handling both series and study retrieves
|
|
|
+ enum RetrieveType { RetrieveSeries, RetrieveStudy };
|
|
|
+ void retrieve ( QString UID, QDir directory, RetrieveType retriveType );
|
|
|
+
|
|
|
+
|
|
|
};
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
@@ -91,80 +97,7 @@ ctkDICOMRetrievePrivate::~ctkDICOMRetrievePrivate()
|
|
|
delete parameters;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// ctkDICOMRetrieve methods
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-ctkDICOMRetrieve::ctkDICOMRetrieve()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-ctkDICOMRetrieve::~ctkDICOMRetrieve()
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-/// Set methods for connectivity
|
|
|
-void ctkDICOMRetrieve::setCallingAETitle ( QString callingAETitle )
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- d->CallingAETitle = callingAETitle;
|
|
|
-}
|
|
|
-const QString& ctkDICOMRetrieve::callingAETitle()
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- return d->CallingAETitle;
|
|
|
-}
|
|
|
-void ctkDICOMRetrieve::setCalledAETitle ( QString calledAETitle )
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- d->CalledAETitle = calledAETitle;
|
|
|
-}
|
|
|
-const QString& ctkDICOMRetrieve::calledAETitle()
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- return d->CalledAETitle;
|
|
|
-}
|
|
|
-void ctkDICOMRetrieve::setHost ( QString host )
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- d->Host = host;
|
|
|
-}
|
|
|
-const QString& ctkDICOMRetrieve::host()
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- return d->Host;
|
|
|
-}
|
|
|
-void ctkDICOMRetrieve::setCallingPort ( int port )
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- d->CallingPort = port;
|
|
|
-}
|
|
|
-int ctkDICOMRetrieve::callingPort()
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- return d->CallingPort;
|
|
|
-}
|
|
|
-
|
|
|
-void ctkDICOMRetrieve::setCalledPort ( int port )
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- d->CalledPort = port;
|
|
|
-}
|
|
|
-int ctkDICOMRetrieve::calledPort()
|
|
|
-{
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- return d->CalledPort;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-void ctkDICOMRetrieve::retrieveSeries ( QString seriesInstanceUID, QDir directory ) {
|
|
|
- CTK_D(ctkDICOMRetrieve);
|
|
|
- logger.info ( "Starting retrieveSeries" );
|
|
|
+void ctkDICOMRetrievePrivate::retrieve ( QString UID, QDir directory, RetrieveType retriveType ) {
|
|
|
|
|
|
// Register the JPEG libraries in case we need them
|
|
|
// (registration only happens once, so it's okay to call repeatedly)
|
|
@@ -182,11 +115,11 @@ void ctkDICOMRetrieve::retrieveSeries ( QString seriesInstanceUID, QDir director
|
|
|
rootLogger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL);
|
|
|
|
|
|
DcmSCU scu;
|
|
|
- scu.setAETitle ( this->callingAETitle().toStdString() );
|
|
|
- scu.setPort ( this->callingPort() );
|
|
|
- scu.setPeerAETitle ( this->calledAETitle().toStdString() );
|
|
|
- scu.setPeerHostName ( this->host().toStdString() );
|
|
|
- scu.setPeerPort ( this->calledPort() );
|
|
|
+ scu.setAETitle ( CallingAETitle.toStdString() );
|
|
|
+ scu.setPort ( CallingPort );
|
|
|
+ scu.setPeerAETitle ( CalledAETitle.toStdString() );
|
|
|
+ scu.setPeerHostName ( Host.toStdString() );
|
|
|
+ scu.setPeerPort ( CalledPort );
|
|
|
|
|
|
logger.error ( "Setting Transfer Syntaxes" );
|
|
|
OFList<OFString> transferSyntaxes;
|
|
@@ -209,17 +142,25 @@ void ctkDICOMRetrieve::retrieveSeries ( QString seriesInstanceUID, QDir director
|
|
|
return;
|
|
|
}
|
|
|
// Clear the query
|
|
|
- unsigned long elements = d->parameters->card();
|
|
|
+ unsigned long elements = this->parameters->card();
|
|
|
// Clean it out
|
|
|
for ( unsigned long i = 0; i < elements; i++ )
|
|
|
{
|
|
|
- d->parameters->remove ( (unsigned long) 0 );
|
|
|
+ this->parameters->remove ( 0ul );
|
|
|
+ }
|
|
|
+ if ( retriveType == RetrieveSeries )
|
|
|
+ {
|
|
|
+ this->parameters->putAndInsertString ( DCM_QueryRetrieveLevel, "SERIES" );
|
|
|
+ this->parameters->putAndInsertString ( DCM_SeriesInstanceUID, UID.toStdString().c_str() );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this->parameters->putAndInsertString ( DCM_QueryRetrieveLevel, "STUDY" );
|
|
|
+ this->parameters->putAndInsertString ( DCM_StudyInstanceUID, UID.toStdString().c_str() );
|
|
|
}
|
|
|
- d->parameters->putAndInsertString ( DCM_QueryRetrieveLevel, "SERIES" );
|
|
|
- d->parameters->putAndInsertString ( DCM_SeriesInstanceUID, seriesInstanceUID.toStdString().c_str() );
|
|
|
|
|
|
MOVEResponses *responses = new MOVEResponses();
|
|
|
- OFCondition status = scu.sendMOVERequest ( 0, d->parameters, responses );
|
|
|
+ OFCondition status = scu.sendMOVERequest ( 0, this->parameters, responses );
|
|
|
if ( status.good() )
|
|
|
{
|
|
|
logger.debug ( "Find succeded" );
|
|
@@ -270,9 +211,91 @@ void ctkDICOMRetrieve::retrieveSeries ( QString seriesInstanceUID, QDir director
|
|
|
logger.error ( "MOVE Request failed: " + QString ( status.text() ) );
|
|
|
}
|
|
|
delete responses;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//------------------------------------------------------------------------------
|
|
|
+// ctkDICOMRetrieve methods
|
|
|
+
|
|
|
+//------------------------------------------------------------------------------
|
|
|
+ctkDICOMRetrieve::ctkDICOMRetrieve()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+//------------------------------------------------------------------------------
|
|
|
+ctkDICOMRetrieve::~ctkDICOMRetrieve()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+/// Set methods for connectivity
|
|
|
+void ctkDICOMRetrieve::setCallingAETitle ( QString callingAETitle )
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ d->CallingAETitle = callingAETitle;
|
|
|
+}
|
|
|
+const QString& ctkDICOMRetrieve::callingAETitle()
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ return d->CallingAETitle;
|
|
|
+}
|
|
|
+void ctkDICOMRetrieve::setCalledAETitle ( QString calledAETitle )
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ d->CalledAETitle = calledAETitle;
|
|
|
+}
|
|
|
+const QString& ctkDICOMRetrieve::calledAETitle()
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ return d->CalledAETitle;
|
|
|
+}
|
|
|
+void ctkDICOMRetrieve::setHost ( QString host )
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ d->Host = host;
|
|
|
+}
|
|
|
+const QString& ctkDICOMRetrieve::host()
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ return d->Host;
|
|
|
+}
|
|
|
+void ctkDICOMRetrieve::setCallingPort ( int port )
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ d->CallingPort = port;
|
|
|
+}
|
|
|
+int ctkDICOMRetrieve::callingPort()
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ return d->CallingPort;
|
|
|
+}
|
|
|
+
|
|
|
+void ctkDICOMRetrieve::setCalledPort ( int port )
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ d->CalledPort = port;
|
|
|
+}
|
|
|
+int ctkDICOMRetrieve::calledPort()
|
|
|
+{
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ return d->CalledPort;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//------------------------------------------------------------------------------
|
|
|
+void ctkDICOMRetrieve::retrieveSeries ( QString seriesInstanceUID, QDir directory ) {
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ logger.info ( "Starting retrieveSeries" );
|
|
|
+ d->retrieve ( seriesInstanceUID, directory, ctkDICOMRetrievePrivate::RetrieveSeries );
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
void ctkDICOMRetrieve::retrieveStudy ( QString studyInstanceUID, QDir directory ) {
|
|
|
+ CTK_D(ctkDICOMRetrieve);
|
|
|
+ logger.info ( "Starting retrieveStudy" );
|
|
|
+ d->retrieve ( studyInstanceUID, directory, ctkDICOMRetrievePrivate::RetrieveStudy );
|
|
|
+ return;
|
|
|
}
|
|
|
|