Disable unreasonable logic branch.
This commit is contained in:
@@ -1036,7 +1036,10 @@ void QDicomViewer::openAndDrawDICOM(const std::string& dicomName, SeriesOpenMode
|
||||
AddDicomType type = helper->getAddDicomType();
|
||||
|
||||
DicomImageView* curV = nullptr;
|
||||
if (type == AddDicomType::OVERRIDE_LEVEL)
|
||||
//
|
||||
// if (type == AddDicomType::OVERRIDE_LEVEL)
|
||||
// disable override first
|
||||
if (false)
|
||||
{
|
||||
/************************************************************************/
|
||||
/* 1.Get multiple relevant windows
|
||||
@@ -1049,8 +1052,6 @@ void QDicomViewer::openAndDrawDICOM(const std::string& dicomName, SeriesOpenMode
|
||||
//only the first conducts raw mode
|
||||
//the following conducts copy mode
|
||||
bool copy = false;
|
||||
//UniqueIDInfo_t *d_unique;
|
||||
//DicomTagInfo_t*d_tag_info;
|
||||
|
||||
for (DicomImageView* v : view_list)
|
||||
{
|
||||
|
||||
@@ -121,56 +121,7 @@ DicomLoader::~DicomLoader() {
|
||||
|
||||
bool DicomLoader::IsDuplicate(UniqueIDInfo_t* unique)
|
||||
{
|
||||
|
||||
if (m_patients.count(unique->patient_name) == 0)
|
||||
{
|
||||
//new patient
|
||||
m_addType = AddDicomType::PATINET_LEVEL;
|
||||
return false;
|
||||
}
|
||||
|
||||
PatientsMapType::iterator cur_patient_iter = m_patients.find(unique->patient_name);
|
||||
StudiesMapType *studies = cur_patient_iter->second->studies;
|
||||
|
||||
if (studies->count(unique->study_uid) == 0)
|
||||
{
|
||||
//new study
|
||||
m_addType = AddDicomType::STUDY_LEVEL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
StudiesMapType::iterator cur_study_iter = studies->find(unique->study_uid);
|
||||
SeriesMapType *series = cur_study_iter->second->series;
|
||||
if (series->count(unique->series_uid) == 0)
|
||||
{
|
||||
//new series
|
||||
m_addType = AddDicomType::SERIES_LEVEL;
|
||||
return false;
|
||||
}
|
||||
|
||||
SeriesMapType::iterator cur_series_iter = series->find(unique->series_uid);
|
||||
|
||||
//if (cur_series_iter->second->getSerirsOpenMode()== FILE_OPEN_MODE &&
|
||||
if (cur_series_iter->second->open_mode == FILE_OPEN_MODE &&
|
||||
unique->open_mode == DIR_OPEN_MODE)
|
||||
{
|
||||
m_addType = AddDicomType::OVERRIDE_LEVEL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cur_series_iter->second->open_mode == FILE_OPEN_MODE &&
|
||||
unique->open_mode == FILE_OPEN_MODE)
|
||||
{
|
||||
if (cur_series_iter->second->instance_num != unique->instance_num)
|
||||
{
|
||||
m_addType = AddDicomType::OVERRIDE_LEVEL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_addType = AddDicomType::DUPLICATE_TYPE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,8 +163,7 @@ void DicomLoader::InitFromRead(SeriesInstance* instance)//, DicomTagInfo_t* tag_
|
||||
reader = nullptr;
|
||||
}
|
||||
|
||||
//You may not use const & cause intance may be deleted during this func
|
||||
//delete all the instances assotiated with this series UID
|
||||
// 无用函数
|
||||
void DicomLoader::deleteInstanceFromMap(UniqueIDInfo uniqueID)
|
||||
{
|
||||
//const UniqueIDInfo & uniqueID = instance->getUniqueID();
|
||||
@@ -255,6 +205,8 @@ void DicomLoader::deleteInstanceFromMap(UniqueIDInfo uniqueID)
|
||||
//cause you need uniqueID, therefore you have to delete series at last
|
||||
//delete cur_series;
|
||||
}
|
||||
|
||||
//无用函数2
|
||||
InstancesVecType* DicomLoader::getInstancesVec(const UniqueIDInfo &uniqueID)
|
||||
{
|
||||
PatientsMapType::iterator cur_patient_iter = m_patients.find(uniqueID.patient_name);
|
||||
@@ -380,173 +332,7 @@ bool DicomLoader::deleteSeriesInstance(SeriesInstance* old)
|
||||
|
||||
SeriesInstance* DicomLoader::addSeriesInstance(SeriesInstance* instance,bool copy)
|
||||
{
|
||||
DicomTagInfo_t* seriesInfo = instance->getDicomTagInfo();
|
||||
UniqueIDInfo_t* unique = instance->getUniqueID();
|
||||
|
||||
InstancesVecType* all_instances = nullptr;
|
||||
SeriesMapType* all_series = nullptr;
|
||||
StudiesMapType* all_studies = nullptr;
|
||||
|
||||
SeriesInfo_t* series = nullptr;
|
||||
StudyInfo_t* study = nullptr;
|
||||
PatientInfo_t *patient = nullptr;
|
||||
PatientsMapType::iterator cur_patient_iter;
|
||||
StudiesMapType::iterator cur_study_iter;
|
||||
SeriesMapType::iterator cur_series_iter;
|
||||
|
||||
|
||||
if (copy)
|
||||
{
|
||||
//just push back
|
||||
cur_patient_iter = m_patients.find(unique->patient_name);
|
||||
all_studies = cur_patient_iter->second->studies;
|
||||
cur_study_iter = all_studies->find(unique->study_uid);
|
||||
cur_series_iter = cur_study_iter->second->series->find(unique->series_uid);
|
||||
all_instances = cur_series_iter->second->instances;
|
||||
all_instances->push_back(instance);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (m_addType)
|
||||
{
|
||||
case DUPLICATE_TYPE:
|
||||
break;
|
||||
case PATINET_LEVEL:
|
||||
all_instances = new InstancesVecType();
|
||||
all_instances->push_back(instance);
|
||||
|
||||
series = new SeriesInfo_t();
|
||||
series->open_mode = unique->open_mode;
|
||||
if (unique->open_mode == FILE_OPEN_MODE)
|
||||
{
|
||||
series->instance_num = unique->instance_num;
|
||||
}
|
||||
//EEROR CODE HERE,YOU CAN NOT DEPEND ON SINGLE INSTANCE!!
|
||||
series->tag_info = instance->getDicomTagInfo();
|
||||
series->unique_info = instance->getUniqueID();
|
||||
series->series_pixmap = instance->GetPixmap();
|
||||
series->instances = all_instances;
|
||||
|
||||
all_series = new SeriesMapType();
|
||||
all_series->insert(std::pair<std::string, SeriesInfo_t*>(unique->series_uid, series));
|
||||
|
||||
//patient
|
||||
all_studies = new StudiesMapType();
|
||||
study = new StudyInfo_t();
|
||||
study->study_description = seriesInfo->m_StudyDescription;
|
||||
study->study_date = seriesInfo->m_StudyDate;
|
||||
study->study_time = seriesInfo->m_StudyTime;
|
||||
study->series = all_series;
|
||||
all_studies->insert(std::pair<std::string, StudyInfo_t*>(unique->study_uid, study));
|
||||
|
||||
//patient level
|
||||
patient = new PatientInfo_t();
|
||||
patient->patient_name = seriesInfo->m_PatientName;
|
||||
patient->birth_date = seriesInfo->m_PatientBirth;
|
||||
patient->studies = all_studies;
|
||||
m_patients.insert(std::pair<std::string, PatientInfo_t*>(unique->patient_name, patient));
|
||||
break;
|
||||
case STUDY_LEVEL:
|
||||
all_instances = new InstancesVecType();
|
||||
all_instances->push_back(instance);
|
||||
|
||||
series = new SeriesInfo_t();
|
||||
series->open_mode = unique->open_mode;
|
||||
if (unique->open_mode == FILE_OPEN_MODE)
|
||||
{
|
||||
series->instance_num = unique->instance_num;
|
||||
}
|
||||
series->tag_info = instance->getDicomTagInfo();
|
||||
series->unique_info = instance->getUniqueID();
|
||||
series->series_pixmap = instance->GetPixmap();
|
||||
series->instances = all_instances;
|
||||
|
||||
//study
|
||||
all_series = new SeriesMapType();
|
||||
all_series->insert(std::pair<std::string, SeriesInfo_t*>(unique->series_uid, series));
|
||||
|
||||
study = new StudyInfo_t();
|
||||
study->study_description = seriesInfo->m_StudyDescription;
|
||||
study->study_date = seriesInfo->m_StudyDate;
|
||||
study->study_time = seriesInfo->m_StudyTime;
|
||||
study->series = all_series;
|
||||
|
||||
cur_patient_iter = m_patients.find(unique->patient_name);
|
||||
all_studies = cur_patient_iter->second->studies;
|
||||
all_studies->insert(std::pair<std::string, StudyInfo_t*>(unique->study_uid, study));
|
||||
|
||||
break;
|
||||
case SERIES_LEVEL:
|
||||
all_instances = new InstancesVecType();
|
||||
all_instances->push_back(instance);
|
||||
|
||||
series = new SeriesInfo_t();
|
||||
series->open_mode = unique->open_mode;
|
||||
if (unique->open_mode == FILE_OPEN_MODE)
|
||||
{
|
||||
series->instance_num = unique->instance_num;
|
||||
}
|
||||
series->tag_info = instance->getDicomTagInfo();
|
||||
series->unique_info = instance->getUniqueID();
|
||||
series->series_pixmap = instance->GetPixmap();
|
||||
series->instances = all_instances;
|
||||
|
||||
cur_patient_iter = m_patients.find(unique->patient_name);
|
||||
all_studies = cur_patient_iter->second->studies;
|
||||
cur_study_iter = all_studies->find(unique->study_uid);
|
||||
//all_series = new SeriesMapType();
|
||||
all_series = cur_study_iter->second->series;
|
||||
all_series->insert(std::pair<std::string, SeriesInfo_t*>(unique->series_uid, series));
|
||||
|
||||
break;
|
||||
|
||||
//combine two situationas, both image and series
|
||||
case OVERRIDE_LEVEL:
|
||||
cur_patient_iter = m_patients.find(unique->patient_name);
|
||||
all_studies = cur_patient_iter->second->studies;
|
||||
cur_study_iter = all_studies->find(unique->study_uid);
|
||||
|
||||
cur_series_iter = cur_study_iter->second->series->find(unique->series_uid);
|
||||
|
||||
cur_series_iter->second->open_mode = unique->open_mode;
|
||||
if (unique->open_mode == FILE_OPEN_MODE)
|
||||
{
|
||||
cur_series_iter->second->instance_num = unique->instance_num;
|
||||
}
|
||||
//need to delete
|
||||
cur_series_iter->second->tag_info = instance->getDicomTagInfo();
|
||||
cur_series_iter->second->unique_info = instance->getUniqueID();
|
||||
|
||||
cur_series_iter->second->series_pixmap = instance->GetPixmap();
|
||||
//wait for thumbnail update to delete it...
|
||||
cur_series_iter->second->pixmap_valid = false;
|
||||
all_instances = cur_series_iter->second->instances;
|
||||
|
||||
for (int i = 0; i < all_instances->size(); i++)
|
||||
{
|
||||
//check if it is newly created or old to delete
|
||||
SeriesInstance *cur_series = all_instances->at(i);
|
||||
if (cur_series->getUniqueID() != instance->getUniqueID())
|
||||
{
|
||||
//return the replaced pointer
|
||||
all_instances->at(i) = instance;
|
||||
return cur_series;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*what if the images is shown*/
|
||||
//remove the duplicate series, replace it with new.
|
||||
//do this in delete stage
|
||||
//last = cur_study_iter->second->series->at(unique->series_uid);
|
||||
//delete last;
|
||||
//cur_study_iter->second->series->erase(unique->series_uid);
|
||||
|
||||
//cur_study_iter->second->series->insert(std::pair<std::string, SeriesInstance*>(m_uniqueID.series_uid, instance));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -713,9 +499,9 @@ SeriesInstance* DicomLoader::createSeries(UniqueIDInfo_t* uniqueID, DicomTagInfo
|
||||
{
|
||||
|
||||
SeriesInstance* series = new SeriesInstance(uniqueID, tag_info, gl_rewin);
|
||||
//DicomLoader *helper = DicomLoader::GetInstance();
|
||||
/******in order*******/
|
||||
//whether create or copy from existing one
|
||||
//暂时不走该分支!!!
|
||||
if (copy)
|
||||
{
|
||||
instance->InitFromCopy(series);
|
||||
|
||||
Reference in New Issue
Block a user