Dicom Reset and left tool bar reset, for load data(more than once).
This commit is contained in:
@@ -392,6 +392,12 @@ typedef struct StudyInfo
|
|||||||
QPushButton *study_label;
|
QPushButton *study_label;
|
||||||
SeriesMapType *series;
|
SeriesMapType *series;
|
||||||
StudyInfo():study_label(nullptr), series(nullptr) {}
|
StudyInfo():study_label(nullptr), series(nullptr) {}
|
||||||
|
~StudyInfo(){
|
||||||
|
for(auto item: *series){
|
||||||
|
delete item.second;
|
||||||
|
}
|
||||||
|
delete series;
|
||||||
|
}
|
||||||
}StudyInfo_t;
|
}StudyInfo_t;
|
||||||
typedef std::map<std::string, StudyInfo_t*> StudiesMapType;
|
typedef std::map<std::string, StudyInfo_t*> StudiesMapType;
|
||||||
|
|
||||||
@@ -402,7 +408,13 @@ typedef struct PatientInfo
|
|||||||
QPushButton *patient_label;
|
QPushButton *patient_label;
|
||||||
StudiesMapType *studies;
|
StudiesMapType *studies;
|
||||||
PatientInfo():patient_label(nullptr), studies(nullptr){
|
PatientInfo():patient_label(nullptr), studies(nullptr){
|
||||||
printf("constr PatientInfo \r\n");
|
|
||||||
|
}
|
||||||
|
~PatientInfo(){
|
||||||
|
for(auto item: *studies){
|
||||||
|
delete item.second;
|
||||||
|
}
|
||||||
|
delete studies;
|
||||||
}
|
}
|
||||||
}PatientInfo_t;
|
}PatientInfo_t;
|
||||||
typedef std::map<std::string, PatientInfo_t*> PatientsMapType;
|
typedef std::map<std::string, PatientInfo_t*> PatientsMapType;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "QDicomViewer.h"
|
#include "QDicomViewer.h"
|
||||||
#include "global/include_all.h"
|
#include "global/include_all.h"
|
||||||
#include "base/SeriesImageSet.h"
|
#include "base/SeriesImageSet.h"
|
||||||
#include "view/subview/gridpopwidget.h"
|
#include "view/subview/gridpopwidget.h"
|
||||||
@@ -1008,7 +1008,7 @@ void QDicomViewer::openAndDrawDICOM(const std::string& dicomName, SeriesOpenMode
|
|||||||
|
|
||||||
|
|
||||||
DicomLoader *helper = DicomLoader::GetInstance();
|
DicomLoader *helper = DicomLoader::GetInstance();
|
||||||
|
helper->reset();
|
||||||
//load image and tag
|
//load image and tag
|
||||||
helper->readTags(dicomName, openMode);
|
helper->readTags(dicomName, openMode);
|
||||||
auto unique = helper->getDefaultUniqueID();
|
auto unique = helper->getDefaultUniqueID();
|
||||||
|
|||||||
@@ -112,94 +112,74 @@ ThumbnailBarWidget::~ThumbnailBarWidget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
//TODO: need to remove relevant to the button create in DicomLoader
|
||||||
void ThumbnailBarWidget::updateThumbnailBar()
|
void ThumbnailBarWidget::updateThumbnailBar()
|
||||||
{
|
{
|
||||||
foreach(QWidget *l, LabelList) {
|
foreach(QWidget *l, LabelList) {
|
||||||
seriesPanel->layout()->removeWidget(l);
|
seriesPanel->layout()->removeWidget(l);
|
||||||
LabelList.removeOne(l);
|
LabelList.removeOne(l);
|
||||||
//delete l;
|
delete l;
|
||||||
}
|
}
|
||||||
|
|
||||||
DicomLoader *helper = DicomLoader::GetInstance();
|
DicomLoader *helper = DicomLoader::GetInstance();
|
||||||
//获取Patient
|
//获取Patient
|
||||||
const PatientsMapType & all_patients = helper->getPatientsList();
|
const PatientsMapType & all_patients = helper->getPatientsList();
|
||||||
for (PatientsMapType::const_iterator it_pa = all_patients.cbegin(); it_pa != all_patients.cend(); it_pa++)
|
for (PatientsMapType::const_iterator it_pa = all_patients.cbegin(); it_pa != all_patients.cend(); it_pa++) {
|
||||||
{
|
//构建Patient panel
|
||||||
//构建Patient panel
|
QPushButton *patient_lbl = new QPushButton(seriesPanel);
|
||||||
QPushButton *patient_lbl = it_pa->second->patient_label;
|
patient_lbl->setObjectName("patient");
|
||||||
if (!patient_lbl)
|
std::string text_pa = ThumbMessages::Format(it_pa->second);
|
||||||
{
|
QString qtext = QString::fromStdString(text_pa);
|
||||||
patient_lbl = new QPushButton(seriesPanel);
|
qtext.replace("^", "\n");
|
||||||
patient_lbl->setObjectName("patient");
|
patient_lbl->setText(qtext);
|
||||||
std::string text_pa = ThumbMessages::Format(it_pa->second);
|
patient_lbl->setEnabled(false);
|
||||||
QString qtext = QString::fromStdString(text_pa);
|
seriesPanel->layout()->addWidget(patient_lbl);
|
||||||
qtext.replace("^", "\n");
|
LabelList << patient_lbl;
|
||||||
patient_lbl->setText(qtext);
|
|
||||||
patient_lbl->setEnabled(false);
|
|
||||||
}
|
|
||||||
seriesPanel->layout()->addWidget(patient_lbl);
|
|
||||||
LabelList << patient_lbl;
|
|
||||||
|
|
||||||
|
|
||||||
StudiesMapType *studies = it_pa->second->studies;
|
StudiesMapType *studies = it_pa->second->studies;
|
||||||
for (StudiesMapType::const_iterator it_st = studies->cbegin(); it_st != studies->cend(); it_st++)
|
for (StudiesMapType::const_iterator it_st = studies->cbegin(); it_st != studies->cend(); it_st++) {
|
||||||
{
|
QPushButton *study_lbl = new QPushButton(seriesPanel);
|
||||||
QPushButton *study_lbl = it_st->second->study_label;
|
study_lbl->setObjectName("study");
|
||||||
if (!study_lbl)
|
std::string text_st = ThumbMessages::Format(it_st->second);
|
||||||
{
|
//study_lbl->setGeometry(0, 0, 100, 100);
|
||||||
study_lbl = new QPushButton(seriesPanel);
|
study_lbl->setText(QString::fromStdString(text_st));
|
||||||
study_lbl->setObjectName("study");
|
study_lbl->setEnabled(false);
|
||||||
std::string text_st = ThumbMessages::Format(it_st->second);
|
|
||||||
//study_lbl->setGeometry(0, 0, 100, 100);
|
seriesPanel->layout()->addWidget(study_lbl);
|
||||||
study_lbl->setText(QString::fromStdString(text_st));
|
//layout->addWidget(study_lbl);
|
||||||
study_lbl->setEnabled(false);
|
LabelList << study_lbl;
|
||||||
//QFont font;
|
|
||||||
//font.setFamily(QString::fromUtf8("Britannic Bold"));
|
|
||||||
//study_lbl->setFont(font);
|
|
||||||
//study_lbl->setWordWrap(true);
|
|
||||||
//study_lbl->setFrameShape(QFrame::NoFrame);
|
|
||||||
}
|
|
||||||
seriesPanel->layout()->addWidget(study_lbl);
|
|
||||||
//layout->addWidget(study_lbl);
|
|
||||||
LabelList << study_lbl;
|
|
||||||
|
|
||||||
|
|
||||||
SeriesMapType *series = it_st->second->series;
|
SeriesMapType *series = it_st->second->series;
|
||||||
for (SeriesMapType::const_iterator it_se = series->cbegin(); it_se != series->cend(); it_se++)
|
for (SeriesMapType::const_iterator it_se = series->cbegin(); it_se != series->cend(); it_se++) {
|
||||||
{
|
thumbnailImage *thumbnail = it_se->second->thumb_nail;
|
||||||
thumbnailImage *thumbnail = it_se->second->thumb_nail;
|
if (it_se->second->pixmap_valid == false) {
|
||||||
if (it_se->second->pixmap_valid==false)
|
//OVERRIDE_LEVEL
|
||||||
{
|
if (thumbnail) {
|
||||||
//OVERRIDE_LEVEL
|
//if thumbnail is currentImageLabel,set nullptr, or crash
|
||||||
if (thumbnail)
|
if (currentImageLabel == thumbnail) {
|
||||||
{
|
currentImageLabel = nullptr;
|
||||||
//if thumbnail is currentImageLabel,set nullptr, or crash
|
}
|
||||||
if (currentImageLabel == thumbnail)
|
delete thumbnail;
|
||||||
{
|
thumbnail = nullptr;
|
||||||
currentImageLabel = nullptr;
|
}
|
||||||
}
|
//wait for update
|
||||||
delete thumbnail;
|
//thumbnail = new thumbnailImage(this, it_se->second);
|
||||||
thumbnail = nullptr;
|
thumbnail = createThumbnailImage(seriesPanel, it_se->second);
|
||||||
}
|
|
||||||
//wait for update
|
|
||||||
//thumbnail = new thumbnailImage(this, it_se->second);
|
|
||||||
thumbnail = createThumbnailImage(seriesPanel, it_se->second);
|
|
||||||
|
|
||||||
//update pointer point to new thumbnail
|
//update pointer point to new thumbnail
|
||||||
it_se->second->thumb_nail = thumbnail;
|
it_se->second->thumb_nail = thumbnail;
|
||||||
it_se->second->pixmap_valid = true;
|
it_se->second->pixmap_valid = true;
|
||||||
}
|
}
|
||||||
seriesPanel->layout()->addWidget(thumbnail);
|
seriesPanel->layout()->addWidget(thumbnail);
|
||||||
//save all thumbnail in one list
|
//save all thumbnail in one list
|
||||||
LabelList << thumbnail;
|
LabelList << thumbnail;
|
||||||
//imageLabelList << thumbnail;
|
//imageLabelList << thumbnail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
thumbnailImage* ThumbnailBarWidget::createThumbnailImage(QWidget *parent, SeriesInfo_t* series_info)
|
thumbnailImage* ThumbnailBarWidget::createThumbnailImage(QWidget *parent, SeriesInfo_t* series_info)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user