feat: Add real progress to down loading image from PACS
This commit is contained in:
@@ -14,6 +14,7 @@ struct PACSStudyInfo {
|
||||
QString studyInstanceUID;
|
||||
QString studyID;
|
||||
QString requestingPhysician;
|
||||
QString relatedInstanceNumber;
|
||||
};
|
||||
|
||||
struct PACSSeriesInfo {
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
#include "MoveStoreScp.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int USCT_IMAGE_COUNT = 270 + 73 + 73;
|
||||
}
|
||||
|
||||
MoveStoreScp::MoveStoreScp()
|
||||
: QObject()
|
||||
, DcmStorageSCP()
|
||||
, mCount(0)
|
||||
, mImageTotalCount(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -21,7 +17,7 @@ bool MoveStoreScp::stopAfterCurrentAssociation()
|
||||
OFCondition MoveStoreScp::handleIncomingCommand(T_DIMSE_Message *incomingMsg, const DcmPresentationContextInfo &presInfo)
|
||||
{
|
||||
mCount++;
|
||||
double progress = (double)mCount / (double)USCT_IMAGE_COUNT;
|
||||
double progress = (double)mCount / (double)mImageTotalCount;
|
||||
emit movePorgress(progress);
|
||||
return DcmStorageSCP::handleIncomingCommand(incomingMsg, presInfo);
|
||||
}
|
||||
@@ -30,3 +26,8 @@ void MoveStoreScp::clearCount()
|
||||
{
|
||||
mCount = 0;
|
||||
}
|
||||
|
||||
void MoveStoreScp::SetImageTotalCount(int aValue)
|
||||
{
|
||||
mImageTotalCount = aValue;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@ public:
|
||||
bool stopAfterCurrentAssociation();
|
||||
virtual OFCondition handleIncomingCommand(T_DIMSE_Message *incomingMsg, const DcmPresentationContextInfo &presInfo);
|
||||
void clearCount();
|
||||
void SetImageTotalCount(int aValue);
|
||||
|
||||
signals:
|
||||
void movePorgress(double aPorgress);
|
||||
|
||||
private:
|
||||
int mCount;
|
||||
int mImageTotalCount;
|
||||
};
|
||||
|
||||
#endif // MOVESTORESCP_H
|
||||
|
||||
@@ -6,6 +6,7 @@ MoveStoreThread::MoveStoreThread(const std::string aAETitle, unsigned short aPor
|
||||
, mAETitle(aAETitle)
|
||||
, mPort(aPort)
|
||||
, mScp(new MoveStoreScp())
|
||||
, mImageTotalCount(0)
|
||||
{
|
||||
mScp->setVerbosePCMode(false);
|
||||
OFList<OFString> syntaxes;
|
||||
@@ -24,6 +25,7 @@ MoveStoreThread::~MoveStoreThread()
|
||||
void MoveStoreThread::run()
|
||||
{
|
||||
mScp->clearCount();
|
||||
mScp->SetImageTotalCount(mImageTotalCount);
|
||||
mScp->setAETitle(mAETitle);
|
||||
mScp->setPort(mPort);
|
||||
mScp->setOutputDirectory(mOutputPath);
|
||||
@@ -40,3 +42,7 @@ void MoveStoreThread::setOutputPath(const std::string& aOutputPath)
|
||||
{
|
||||
mOutputPath = aOutputPath;
|
||||
}
|
||||
|
||||
void MoveStoreThread::setImageTotalCount(int aValue){
|
||||
mImageTotalCount = aValue;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
void run();
|
||||
void setScpConfig(const std::string aAETitle, unsigned short aPort);
|
||||
void setOutputPath(const std::string& aOutputPath);
|
||||
void setImageTotalCount(int aValue);
|
||||
|
||||
signals:
|
||||
void moveProgress(double aPorgress);
|
||||
@@ -23,6 +24,7 @@ private:
|
||||
unsigned short mPort;
|
||||
std::string mOutputPath;
|
||||
MoveStoreScp* mScp;
|
||||
int mImageTotalCount;
|
||||
};
|
||||
|
||||
#endif // MOVESTORETHREAD_H
|
||||
|
||||
@@ -47,6 +47,11 @@ void MoveWorker::setPacsInfo(const std::string& peerIP, unsigned long peerPort,
|
||||
mStrPeerTitle = peerTitle;
|
||||
}
|
||||
|
||||
void MoveWorker::setImageTotalCount(int aValue)
|
||||
{
|
||||
mMoveStoreThread->setImageTotalCount(aValue);
|
||||
}
|
||||
|
||||
bool MoveWorker::initDcmSCU()
|
||||
{
|
||||
mScu = new DcmSCU();
|
||||
|
||||
@@ -15,6 +15,8 @@ public:
|
||||
~MoveWorker();
|
||||
void setOutputDirectory(const QString& outputDir);
|
||||
void setPacsInfo(const std::string& peerIP, unsigned long peerPort, const std::string& peerTitle);
|
||||
void setImageTotalCount(int aValue);
|
||||
|
||||
void setListenInfo(const std::string& aOurTitle, unsigned long aOurPort);
|
||||
Q_INVOKABLE void moveByStudyInstanceUID(const QString& studyInstanceUID);
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ void QueryWorker::initQueryDataSet()
|
||||
m_QueryDataSet->putAndInsertOFStringArray(DCM_SeriesInstanceUID,"");
|
||||
m_QueryDataSet->putAndInsertOFStringArray(DCM_Modality,"");
|
||||
m_QueryDataSet->putAndInsertOFStringArray(DCM_SeriesNumber,"");
|
||||
m_QueryDataSet->putAndInsertOFStringArray(DCM_NumberOfStudyRelatedInstances,"");
|
||||
|
||||
}
|
||||
|
||||
void QueryWorker::executeCFind(DcmDataset* aQueryKeys)
|
||||
@@ -217,7 +219,8 @@ void QueryWorker::onFoundResult(int index, DcmDataset *response)
|
||||
{
|
||||
std::string studyDate_, patientName_, patientID_, accessionNumber_,
|
||||
patientBirthDate_, patientSex_, studyInstanceUID_,
|
||||
studyID_, requestingPhysician_, seriesUid_, modality_, seriesNumber_;
|
||||
studyID_, requestingPhysician_, seriesUid_, modality_, seriesNumber_,
|
||||
instanceNumber_;
|
||||
response->findAndGetOFString(DCM_StudyDate, studyDate_);
|
||||
response->findAndGetOFString(DCM_PatientName, patientName_);
|
||||
response->findAndGetOFString(DCM_PatientID, patientID_);
|
||||
@@ -230,6 +233,8 @@ void QueryWorker::onFoundResult(int index, DcmDataset *response)
|
||||
response->findAndGetOFString(DCM_SeriesInstanceUID, seriesUid_);
|
||||
response->findAndGetOFString(DCM_Modality, modality_);
|
||||
response->findAndGetOFString(DCM_SeriesNumber, seriesNumber_);
|
||||
response->findAndGetOFString(DCM_NumberOfStudyRelatedInstances, instanceNumber_);
|
||||
|
||||
|
||||
if (m_iQueryLevel == 0)
|
||||
{
|
||||
@@ -243,6 +248,8 @@ void QueryWorker::onFoundResult(int index, DcmDataset *response)
|
||||
study.studyInstanceUID = QString::fromStdString(studyInstanceUID_);
|
||||
study.studyID = QString::fromStdString(studyID_);
|
||||
study.requestingPhysician = QString::fromStdString(requestingPhysician_);
|
||||
study.relatedInstanceNumber = QString::fromStdString(instanceNumber_);
|
||||
|
||||
emit sendStudyItemFound(study);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -509,7 +509,7 @@ void ImportWidget::updateStudyView()
|
||||
QStandardItem* performPhy = new QStandardItem(""); performPhy->setEditable(false);
|
||||
QStandardItem* readingPhysician = new QStandardItem(itr->requestingPhysician); readingPhysician->setEditable(false);
|
||||
QStandardItem* inst = new QStandardItem(""); inst->setEditable(false);
|
||||
QStandardItem* image = new QStandardItem(""); image->setEditable(false);
|
||||
QStandardItem* image = new QStandardItem(itr->relatedInstanceNumber); image->setEditable(false);
|
||||
QStandardItem* source = new QStandardItem(m_pPacsComboBox->currentText()); source->setEditable(false);
|
||||
|
||||
QList<QStandardItem*> list;
|
||||
@@ -620,8 +620,9 @@ void ImportWidget::executeCMove(const QModelIndex ¤t)
|
||||
{
|
||||
m_pProgressBar->setValue(0);
|
||||
}
|
||||
|
||||
//std::string seriesNumber = m_pSeriesModel->index(row, 1).data().toString().toStdString();
|
||||
bool toIntFlag = false;
|
||||
int imageCount = m_pStudyModel->index(row, 12).data().toInt(&toIntFlag);
|
||||
if (!toIntFlag) imageCount = 0;
|
||||
std::string studyInstanceUID = m_pStudyModel->index(row, 6).data().toString().toStdString();
|
||||
std::string studyID = m_pStudyModel->index(row, 5).data().toString().toStdString();
|
||||
//std::string seriesUID = m_pSeriesModel->index(row, 6).data().toString().toStdString();
|
||||
@@ -645,6 +646,7 @@ void ImportWidget::executeCMove(const QModelIndex ¤t)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mMoveWorker->setImageTotalCount(imageCount);
|
||||
mMoveWorker->setPacsInfo(peerIP,peerPort,peerTitle);
|
||||
mMoveWorker->setListenInfo(ourTitle, ourPort);
|
||||
mMoveWorker->setOutputDirectory(QString::fromStdString(outDirectory));
|
||||
|
||||
Reference in New Issue
Block a user