Replace UniqueIDInfo_t with std::string
This commit is contained in:
@@ -39,15 +39,13 @@ public:
|
|||||||
* @param openMode
|
* @param openMode
|
||||||
*/
|
*/
|
||||||
void preReadNewFile(const std::string &dir, SeriesOpenMode openMode);
|
void preReadNewFile(const std::string &dir, SeriesOpenMode openMode);
|
||||||
UniqueIDInfo_t* createUniqueID(const std::string &dicomName, SeriesOpenMode openMode);
|
|
||||||
bool IsDuplicate(UniqueIDInfo_t* unique);
|
|
||||||
|
|
||||||
|
|
||||||
SeriesImageSet *createSeries(UniqueIDInfo_t *uniqueID);
|
const std::string& getDefaultUniqueID(){
|
||||||
AddDicomType getAddDicomType()const
|
return defaultUniqueID;
|
||||||
{
|
|
||||||
return m_addType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SeriesImageSet *createSeries(const std::string& uniqueID);
|
||||||
const PatientsMapType &getPatientsList()
|
const PatientsMapType &getPatientsList()
|
||||||
{
|
{
|
||||||
return m_patients;
|
return m_patients;
|
||||||
@@ -55,17 +53,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SeriesImageSet* getSeriesImageSet(const UniqueIDInfo &uniqueID);
|
SeriesImageSet* getSeriesImageSet(const std::string& uniqueID);
|
||||||
|
|
||||||
SeriesInfo_t* getSerieInfo(const UniqueIDInfo &uniqueID);
|
SeriesInfo_t* getSerieInfo(const std::string& seriesUnique);
|
||||||
SeriesImageSet* getFirstInstance(const UniqueIDInfo &uniqueID);
|
|
||||||
InstancesVecType* getInstancesVec(const UniqueIDInfo &uniqueID);
|
//for export use
|
||||||
//for export use
|
|
||||||
void getOpenedInstancesVec(InstancesVecType& retVec);
|
void getOpenedInstancesVec(InstancesVecType& retVec);
|
||||||
|
|
||||||
//void deleteSeriesInstance(SeriesImageSet* instance,bool from_map = true);
|
|
||||||
void deleteInstanceFromMap(UniqueIDInfo uniqueID);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DicomLoader();
|
explicit DicomLoader();
|
||||||
~DicomLoader();
|
~DicomLoader();
|
||||||
@@ -86,7 +80,7 @@ private:
|
|||||||
std::vector<ExtendMedicalImageProperties*> imageProperties;
|
std::vector<ExtendMedicalImageProperties*> imageProperties;
|
||||||
vtkDICOMImageReader2 * reader = nullptr;
|
vtkDICOMImageReader2 * reader = nullptr;
|
||||||
ImageSetStore store;
|
ImageSetStore store;
|
||||||
AddDicomType m_addType;
|
std::string defaultUniqueID;
|
||||||
PatientsMapType m_patients;
|
PatientsMapType m_patients;
|
||||||
vtkObject* placeHolder;
|
vtkObject* placeHolder;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ class SeriesImageSet : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SeriesImageSet::SeriesImageSet(const UniqueIDInfo_t& uniqueID,ExtendMedicalImageProperties* property, vtkImageData* imagedata);
|
SeriesImageSet::SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata);
|
||||||
~SeriesImageSet() override;
|
~SeriesImageSet() override;
|
||||||
|
|
||||||
|
|
||||||
void setUpSeriesInstance();
|
void setUpSeriesInstance();
|
||||||
|
|
||||||
//UniqueID
|
//UniqueID
|
||||||
UniqueIDInfo_t* getUniqueID() {
|
std::string const & getUniqueID() {
|
||||||
return &m_pUniqueID;
|
return m_pUniqueID;
|
||||||
};
|
};
|
||||||
const char* getCurImageName()const;
|
const char* getCurImageName()const;
|
||||||
const char* getCurSeriesName() const;
|
const char* getCurSeriesName() const;
|
||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//camera config
|
//camera config
|
||||||
double GetExtent()
|
double GetExtent()
|
||||||
{
|
{
|
||||||
@@ -76,7 +77,7 @@ private:
|
|||||||
vtkSmartPointer <vtkImageData> m_image;
|
vtkSmartPointer <vtkImageData> m_image;
|
||||||
ExtendMedicalImageProperties* m_property = nullptr;
|
ExtendMedicalImageProperties* m_property = nullptr;
|
||||||
|
|
||||||
UniqueIDInfo_t m_pUniqueID;
|
std::string m_pUniqueID;
|
||||||
|
|
||||||
|
|
||||||
static qint32 image_label_size;
|
static qint32 image_label_size;
|
||||||
|
|||||||
@@ -200,32 +200,13 @@ enum SeriesOpenMode {
|
|||||||
DIR_OPEN_MODE
|
DIR_OPEN_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct UniqueIDInfo
|
|
||||||
{
|
|
||||||
std::string patient_name;
|
|
||||||
std::string study_uid;
|
|
||||||
std::string series_uid;
|
|
||||||
SeriesOpenMode open_mode;
|
|
||||||
std::string instance_num;
|
|
||||||
std::string dicom_name;
|
|
||||||
//std::string series_modality;
|
|
||||||
}UniqueIDInfo_t;
|
|
||||||
|
|
||||||
//typedef std::shared_ptr<DicomTagInfo_t> DicomTagInfo_t*;
|
//typedef std::shared_ptr<DicomTagInfo_t> DicomTagInfo_t*;
|
||||||
//typedef std::shared_ptr<UniqueIDInfo_t> UniqueIDInfo_t*;
|
//typedef std::shared_ptr<UniqueIDInfo_t> UniqueIDInfo_t*;
|
||||||
|
|
||||||
namespace DicomUtil
|
namespace DicomUtil
|
||||||
{
|
{
|
||||||
//not include open_mode
|
|
||||||
static bool EqualsUnique(const UniqueIDInfo &uid1, const UniqueIDInfo & uid2)
|
|
||||||
{
|
|
||||||
if (uid1.patient_name == uid2.patient_name &&
|
|
||||||
uid1.study_uid == uid2.study_uid &&
|
|
||||||
uid1.series_uid == uid2.series_uid) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FlipExportHelper
|
class FlipExportHelper
|
||||||
@@ -390,11 +371,11 @@ typedef struct SeriesInfo
|
|||||||
std::string instance_num;
|
std::string instance_num;
|
||||||
bool pixmap_valid;
|
bool pixmap_valid;
|
||||||
QPixmap series_pixmap;
|
QPixmap series_pixmap;
|
||||||
UniqueIDInfo_t* unique_info;
|
std::string unique_id;
|
||||||
DicomTagInfo_t* tag_info;
|
DicomTagInfo_t* tag_info;
|
||||||
thumbnailImage* thumb_nail;
|
thumbnailImage* thumb_nail;
|
||||||
InstancesVecType* instances;
|
InstancesVecType* instances;
|
||||||
SeriesInfo() :pixmap_valid(false), unique_info(nullptr),tag_info(nullptr),thumb_nail(nullptr), instances(nullptr) {}
|
SeriesInfo() : pixmap_valid(false), unique_id(""), tag_info(nullptr), thumb_nail(nullptr), instances(nullptr) {}
|
||||||
}SeriesInfo_t;
|
}SeriesInfo_t;
|
||||||
typedef std::map<std::string, SeriesInfo_t*> SeriesMapType;
|
typedef std::map<std::string, SeriesInfo_t*> SeriesMapType;
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ public:
|
|||||||
DicomImageView* getCurrentView() const;
|
DicomImageView* getCurrentView() const;
|
||||||
DicomImageView* getNextView() const;
|
DicomImageView* getNextView() const;
|
||||||
QList<DicomImageView*> getViewList() const;
|
QList<DicomImageView*> getViewList() const;
|
||||||
void getRelevantViewList(const UniqueIDInfo& unique, QList<DicomImageView*> & viewList);
|
|
||||||
|
|
||||||
|
|
||||||
void setCurrentView(DicomImageView *view);
|
void setCurrentView(DicomImageView *view);
|
||||||
void emptyCurrentView();
|
void emptyCurrentView();
|
||||||
|
|
||||||
void replaceViewWithSerie(UniqueIDInfo_t* unique_info,
|
void replaceViewWithSerie(const std::string& unique_info,
|
||||||
DicomImageView* curV = nullptr);
|
DicomImageView* curV = nullptr);
|
||||||
|
|
||||||
//fusion
|
//fusion
|
||||||
|
|||||||
@@ -1010,28 +1010,7 @@ void QDicomViewer::openAndDrawDICOM(const std::string& dicomName, SeriesOpenMode
|
|||||||
|
|
||||||
//load image and tag
|
//load image and tag
|
||||||
helper->preReadNewFile(dicomName, openMode);
|
helper->preReadNewFile(dicomName, openMode);
|
||||||
|
auto unique = helper->getDefaultUniqueID();
|
||||||
|
|
||||||
UniqueIDInfo_t *unique = helper->createUniqueID(dicomName, openMode);
|
|
||||||
if (!unique) {
|
|
||||||
this->statusBar()->showMessage(tr("Error unique data!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//判断是否重复,并设置AddDicomType
|
|
||||||
if (helper->IsDuplicate(unique)) {
|
|
||||||
this->statusBar()->showMessage(tr("Already Exists!"));
|
|
||||||
|
|
||||||
//need to delete UniqueID first
|
|
||||||
//delete unique;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//read tag of first series
|
|
||||||
DicomTagInfo_t *tag_info = helper->createDicomTagsInfo();
|
|
||||||
|
|
||||||
//You have to judge AddDicomType first!
|
|
||||||
AddDicomType type = helper->getAddDicomType();
|
|
||||||
|
|
||||||
|
|
||||||
ui->viewContainer->replaceViewWithSerie(unique);
|
ui->viewContainer->replaceViewWithSerie(unique);
|
||||||
//view clicked will notify thumbnailbar update
|
//view clicked will notify thumbnailbar update
|
||||||
|
|||||||
@@ -103,14 +103,6 @@ void copyDicomTasInfo(DicomTagInfo_t* dicom, ExtendMedicalImageProperties* prope
|
|||||||
dicom->m_SliceNumber = itoa(properties->GetFileNames()->size(),buffer,10);
|
dicom->m_SliceNumber = itoa(properties->GetFileNames()->size(),buffer,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyUniqueInfo(UniqueIDInfo_t* unique, ExtendMedicalImageProperties* properties){
|
|
||||||
unique->series_uid = properties->GetSeriesUID();
|
|
||||||
unique->patient_name = properties->GetPatientName();
|
|
||||||
unique->study_uid = properties->GetStudyUID();
|
|
||||||
char buffer[16]={};
|
|
||||||
unique->instance_num=itoa(properties->GetFileNames()->size(),buffer,10);
|
|
||||||
}
|
|
||||||
|
|
||||||
DicomLoader* DicomLoader::instance = new DicomLoader();
|
DicomLoader* DicomLoader::instance = new DicomLoader();
|
||||||
DicomLoader* DicomLoader::GetInstance() {
|
DicomLoader* DicomLoader::GetInstance() {
|
||||||
//lazy man
|
//lazy man
|
||||||
@@ -121,7 +113,7 @@ DicomLoader* DicomLoader::GetInstance() {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
DicomLoader::DicomLoader():m_addType(AddDicomType::DUPLICATE_TYPE) {
|
DicomLoader::DicomLoader(){
|
||||||
|
|
||||||
// m_itkSeriesReader = SeriesReaderType::New();
|
// m_itkSeriesReader = SeriesReaderType::New();
|
||||||
// m_itkConnector = ConnectorType::New();
|
// m_itkConnector = ConnectorType::New();
|
||||||
@@ -132,6 +124,7 @@ DicomLoader::DicomLoader():m_addType(AddDicomType::DUPLICATE_TYPE) {
|
|||||||
//transfer to series after!
|
//transfer to series after!
|
||||||
m_patients.clear();
|
m_patients.clear();
|
||||||
placeHolder = vtkObject::New();
|
placeHolder = vtkObject::New();
|
||||||
|
defaultUniqueID = "";
|
||||||
}
|
}
|
||||||
DicomLoader::~DicomLoader() {
|
DicomLoader::~DicomLoader() {
|
||||||
|
|
||||||
@@ -145,103 +138,38 @@ DicomLoader::~DicomLoader() {
|
|||||||
imageProperties.clear();
|
imageProperties.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 废止该函数, 因为overridde也好,add模式也好,实际上都不需要判定一下内容
|
|
||||||
// 其中的相关逻辑移动到readSeries中去
|
|
||||||
bool DicomLoader::IsDuplicate(UniqueIDInfo_t* unique)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
SeriesImageSet* DicomLoader::getSeriesImageSet(const std::string& uniqueID)//, DicomTagInfo_t* tag_info)
|
||||||
|
|
||||||
SeriesImageSet* DicomLoader::getSeriesImageSet(const UniqueIDInfo &uniqueID)//, DicomTagInfo_t* tag_info)
|
|
||||||
{
|
{
|
||||||
//only user key to the series level
|
//only user key to the series level
|
||||||
auto key = uniqueID.patient_name+uniqueID.study_uid+uniqueID.series_uid;
|
if (store.count(uniqueID)>0)
|
||||||
if (store.count(key)>0)
|
|
||||||
{
|
{
|
||||||
//use cache instead load
|
//use cache instead load
|
||||||
return store[key];
|
return store[uniqueID];
|
||||||
}
|
}
|
||||||
if (reader) reader->Delete();
|
if (reader) reader->Delete();
|
||||||
reader = vtkDICOMImageReader2::New();
|
reader = vtkDICOMImageReader2::New();
|
||||||
reader->SetFileNames(*(currentImageProperty->GetFileNames()));
|
auto iter = std::find_if(imageProperties.begin(), imageProperties.end(),[&uniqueID](auto property){
|
||||||
|
std::string id;
|
||||||
|
id.append(property->GetPatientName());
|
||||||
|
id.append("_");
|
||||||
|
id.append(property->GetStudyUID());
|
||||||
|
id.append("_");
|
||||||
|
id.append(property->GetSeriesUID());
|
||||||
|
return id == uniqueID;
|
||||||
|
});
|
||||||
|
if (iter==imageProperties.end()) return nullptr;
|
||||||
|
|
||||||
|
reader->SetFileNames(*(*iter)->GetFileNames());
|
||||||
reader->Update();
|
reader->Update();
|
||||||
SeriesImageSet* result = new SeriesImageSet(uniqueID,currentImageProperty,reader->GetOutput());
|
|
||||||
|
SeriesImageSet* result = new SeriesImageSet((*iter),reader->GetOutput());
|
||||||
reader->Delete();
|
reader->Delete();
|
||||||
reader = nullptr;
|
reader = nullptr;
|
||||||
store[key] = result;
|
store[uniqueID] = result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无用函数
|
|
||||||
void DicomLoader::deleteInstanceFromMap(UniqueIDInfo uniqueID)
|
|
||||||
{
|
|
||||||
//const UniqueIDInfo & uniqueID = instance->getUniqueID();
|
|
||||||
|
|
||||||
PatientsMapType::iterator cur_patient_iter = m_patients.find(uniqueID.patient_name);
|
|
||||||
|
|
||||||
StudiesMapType::iterator cur_study_iter = cur_patient_iter->second->studies->find(uniqueID.study_uid);
|
|
||||||
|
|
||||||
//in order
|
|
||||||
SeriesInfo_t* the_series = cur_study_iter->second->series->at(uniqueID.series_uid);
|
|
||||||
//SeriesImageSet *cur_series = cur_study_iter->second->series->at(uniqueID.series_uid);
|
|
||||||
|
|
||||||
|
|
||||||
//delete all the instances assotiated with this series UID
|
|
||||||
for (int i = 0; i < the_series->instances->size(); i++)
|
|
||||||
{
|
|
||||||
delete the_series->instances->at(i);
|
|
||||||
}
|
|
||||||
the_series->instances->clear();
|
|
||||||
|
|
||||||
|
|
||||||
//erase series from study
|
|
||||||
cur_study_iter->second->series->erase(uniqueID.series_uid);
|
|
||||||
|
|
||||||
//Recursively Delete
|
|
||||||
|
|
||||||
//if the study has no series
|
|
||||||
if (cur_study_iter->second->series->empty())
|
|
||||||
{
|
|
||||||
cur_patient_iter->second->studies->erase(uniqueID.study_uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if the patient has no study
|
|
||||||
if (cur_patient_iter->second->studies->empty())
|
|
||||||
{
|
|
||||||
m_patients.erase(uniqueID.patient_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//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);
|
|
||||||
if (cur_patient_iter == m_patients.end())
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
StudiesMapType::iterator cur_study_iter = cur_patient_iter->second->studies->find(uniqueID.study_uid);
|
|
||||||
if (cur_study_iter == cur_patient_iter->second->studies->end())
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SeriesMapType::iterator the_series = cur_study_iter->second->series->find(uniqueID.series_uid);
|
|
||||||
if (the_series == cur_study_iter->second->series->end())
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return the_series->second->instances;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DicomLoader::getOpenedInstancesVec(InstancesVecType& retVec)
|
void DicomLoader::getOpenedInstancesVec(InstancesVecType& retVec)
|
||||||
{
|
{
|
||||||
for (PatientsMapType::const_iterator cur_patient_iter = m_patients.begin(); cur_patient_iter !=
|
for (PatientsMapType::const_iterator cur_patient_iter = m_patients.begin(); cur_patient_iter !=
|
||||||
@@ -267,44 +195,27 @@ void DicomLoader::getOpenedInstancesVec(InstancesVecType& retVec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SeriesImageSet* DicomLoader::getFirstInstance(const UniqueIDInfo &uniqueID)
|
SeriesInfo_t* DicomLoader::getSerieInfo(const std::string& seriesUnique)
|
||||||
{
|
{
|
||||||
PatientsMapType::iterator cur_patient_iter = m_patients.find(uniqueID.patient_name);
|
auto idx = seriesUnique.find('_');
|
||||||
|
std::string patient_name= seriesUnique.substr(0,idx);
|
||||||
|
PatientsMapType::iterator cur_patient_iter = m_patients.find(patient_name);
|
||||||
if (cur_patient_iter == m_patients.end())
|
if (cur_patient_iter == m_patients.end())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
auto begin = idx;
|
||||||
StudiesMapType::iterator cur_study_iter = cur_patient_iter->second->studies->find(uniqueID.study_uid);
|
idx = seriesUnique.find('_',begin);
|
||||||
|
std::string study_uid= seriesUnique.substr(idx,idx);
|
||||||
|
StudiesMapType::iterator cur_study_iter = cur_patient_iter->second->studies->find(study_uid);
|
||||||
if (cur_study_iter == cur_patient_iter->second->studies->end())
|
if (cur_study_iter == cur_patient_iter->second->studies->end())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
begin = idx;
|
||||||
SeriesMapType::iterator the_series = cur_study_iter->second->series->find(uniqueID.series_uid);
|
idx = seriesUnique.find('_',begin);
|
||||||
if (the_series == cur_study_iter->second->series->end())
|
std::string series_uid= seriesUnique.substr(idx,idx);
|
||||||
{
|
SeriesMapType::iterator the_series = cur_study_iter->second->series->find(series_uid);
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *the_series->second->instances->begin();
|
|
||||||
|
|
||||||
}
|
|
||||||
SeriesInfo_t* DicomLoader::getSerieInfo(const UniqueIDInfo &uniqueID)
|
|
||||||
{
|
|
||||||
PatientsMapType::iterator cur_patient_iter = m_patients.find(uniqueID.patient_name);
|
|
||||||
if (cur_patient_iter == m_patients.end())
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
StudiesMapType::iterator cur_study_iter = cur_patient_iter->second->studies->find(uniqueID.study_uid);
|
|
||||||
if (cur_study_iter == cur_patient_iter->second->studies->end())
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SeriesMapType::iterator the_series = cur_study_iter->second->series->find(uniqueID.series_uid);
|
|
||||||
if (the_series == cur_study_iter->second->series->end())
|
if (the_series == cur_study_iter->second->series->end())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -335,33 +246,17 @@ void DicomLoader::preReadNewFile(const std::string &dir, SeriesOpenMode openMode
|
|||||||
}
|
}
|
||||||
if ( imageProperties.size() > 0 ) {
|
if ( imageProperties.size() > 0 ) {
|
||||||
currentImageProperty = imageProperties[0];
|
currentImageProperty = imageProperties[0];
|
||||||
|
defaultUniqueID = "";
|
||||||
|
defaultUniqueID.append(currentImageProperty->GetPatientName());
|
||||||
|
defaultUniqueID.append("_");
|
||||||
|
defaultUniqueID.append(currentImageProperty->GetStudyUID());
|
||||||
|
defaultUniqueID.append("_");
|
||||||
|
defaultUniqueID.append(currentImageProperty->GetSeriesUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
readSeries();
|
readSeries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UniqueIDInfo_t* DicomLoader::createUniqueID(const std::string &dicomName, SeriesOpenMode openMode)
|
|
||||||
{
|
|
||||||
if (!currentImageProperty) return nullptr;
|
|
||||||
UniqueIDInfo_t* pUniqueID(new UniqueIDInfo_t());
|
|
||||||
pUniqueID->open_mode = openMode;
|
|
||||||
pUniqueID->dicom_name = dicomName;
|
|
||||||
if (openMode == FILE_OPEN_MODE)
|
|
||||||
{
|
|
||||||
char buffer[16]={};
|
|
||||||
pUniqueID->instance_num=itoa(currentImageProperty->GetFileNames()->size(),buffer,10);
|
|
||||||
}
|
|
||||||
pUniqueID->patient_name = currentImageProperty->GetPatientName();
|
|
||||||
pUniqueID->study_uid = currentImageProperty->GetStudyUID();
|
|
||||||
pUniqueID->series_uid = currentImageProperty->GetSeriesUID();
|
|
||||||
|
|
||||||
return pUniqueID;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DicomTagInfo_t* DicomLoader::createDicomTagsInfo()
|
DicomTagInfo_t* DicomLoader::createDicomTagsInfo()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -403,10 +298,10 @@ DicomTagInfo_t* DicomLoader::createDicomTagsInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SeriesImageSet* DicomLoader::createSeries(UniqueIDInfo_t* uniqueID)
|
SeriesImageSet* DicomLoader::createSeries(const std::string& uniqueID)
|
||||||
{
|
{
|
||||||
|
|
||||||
SeriesImageSet* series = instance->getSeriesImageSet(*uniqueID);
|
SeriesImageSet* series = instance->getSeriesImageSet(uniqueID);
|
||||||
|
|
||||||
series->setUpSeriesInstance();
|
series->setUpSeriesInstance();
|
||||||
return series;
|
return series;
|
||||||
@@ -416,14 +311,20 @@ void DicomLoader::readSeries() {
|
|||||||
|
|
||||||
for (ExtendMedicalImageProperties* property: imageProperties){
|
for (ExtendMedicalImageProperties* property: imageProperties){
|
||||||
|
|
||||||
UniqueIDInfo_t *unique = new UniqueIDInfo_t;
|
std::string unique = "";
|
||||||
copyUniqueInfo(unique, property);
|
std::string patient_name = property->GetPatientName();
|
||||||
|
std::string study_uid = property->GetStudyUID();
|
||||||
|
std::string series_uid = property->GetSeriesUID();
|
||||||
|
unique.append(patient_name);
|
||||||
|
unique.append("_");
|
||||||
|
unique.append(study_uid);
|
||||||
|
unique.append("_");
|
||||||
|
unique.append(series_uid);
|
||||||
//patient level
|
//patient level
|
||||||
PatientInfo_t* patient = nullptr;
|
PatientInfo_t* patient = nullptr;
|
||||||
//get from store
|
//get from store
|
||||||
if (m_patients.count(unique->patient_name)>0){
|
if (m_patients.count(patient_name)>0){
|
||||||
patient = m_patients[unique->patient_name];
|
patient = m_patients[patient_name];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//create new
|
//create new
|
||||||
@@ -431,34 +332,34 @@ void DicomLoader::readSeries() {
|
|||||||
patient->patient_name = property->GetPatientName();
|
patient->patient_name = property->GetPatientName();
|
||||||
patient->birth_date = property->GetPatientBirthDate();
|
patient->birth_date = property->GetPatientBirthDate();
|
||||||
patient->studies = new StudiesMapType();
|
patient->studies = new StudiesMapType();
|
||||||
m_patients[unique->patient_name] = patient;
|
m_patients[patient_name] = patient;
|
||||||
}
|
}
|
||||||
StudyInfo_t* study = nullptr;
|
StudyInfo_t* study = nullptr;
|
||||||
//get from store
|
//get from store
|
||||||
if (patient->studies->count(unique->study_uid)>0){
|
if (patient->studies->count(study_uid)>0){
|
||||||
study = patient->studies->at(unique->study_uid);
|
study = patient->studies->at(study_uid);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//create new
|
//create new
|
||||||
study = new StudyInfo_t();
|
study = new StudyInfo_t();
|
||||||
patient->studies->insert({unique->study_uid, study});
|
patient->studies->insert({study_uid, study});
|
||||||
study->study_description = property->GetStudyDescription();
|
study->study_description = property->GetStudyDescription();
|
||||||
study->study_date = property->GetStudyDate();
|
study->study_date = property->GetStudyDate();
|
||||||
study->study_time = property->GetStudyTime();
|
study->study_time = property->GetStudyTime();
|
||||||
study->series = new SeriesMapType();
|
study->series = new SeriesMapType();
|
||||||
}
|
}
|
||||||
SeriesInfo_t* series = nullptr;
|
SeriesInfo_t* series = nullptr;
|
||||||
if (study->series->count(unique->series_uid)>0){
|
if (study->series->count(series_uid)>0){
|
||||||
series = study->series->at(unique->series_uid);
|
series = study->series->at(series_uid);
|
||||||
//TODO:need to add override logic!!
|
//TODO:need to add override logic!!
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
series = new SeriesInfo_t();
|
series = new SeriesInfo_t();
|
||||||
study->series->insert({unique->series_uid,series});
|
study->series->insert({series_uid,series});
|
||||||
DicomTagInfo_t *dicom = new DicomTagInfo_t;
|
DicomTagInfo_t *dicom = new DicomTagInfo_t;
|
||||||
copyDicomTasInfo(dicom, property);
|
copyDicomTasInfo(dicom, property);
|
||||||
series->tag_info = dicom;
|
series->tag_info = dicom;
|
||||||
series->unique_info = unique;
|
series->unique_id = unique;
|
||||||
double *wlww = property->GetNthWindowLevelPreset(0);
|
double *wlww = property->GetNthWindowLevelPreset(0);
|
||||||
int ww = wlww ? ((int) wlww[0]) : (512);
|
int ww = wlww ? ((int) wlww[0]) : (512);
|
||||||
int wl = wlww ? ((int) wlww[1]) : (256);
|
int wl = wlww ? ((int) wlww[1]) : (256);
|
||||||
|
|||||||
@@ -9,16 +9,19 @@
|
|||||||
qint32 SeriesImageSet::image_label_size = 100;
|
qint32 SeriesImageSet::image_label_size = 100;
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
SeriesImageSet::SeriesImageSet(const UniqueIDInfo& uniqueID,ExtendMedicalImageProperties* property, vtkImageData* imagedata) :
|
SeriesImageSet::SeriesImageSet(ExtendMedicalImageProperties* property, vtkImageData* imagedata)
|
||||||
m_pUniqueID(uniqueID)
|
|
||||||
{
|
{
|
||||||
m_image = imagedata;
|
m_image = imagedata;
|
||||||
m_property = property;
|
m_property = property;
|
||||||
|
m_pUniqueID.append(property->GetPatientName());
|
||||||
|
m_pUniqueID.append("_");
|
||||||
|
m_pUniqueID.append(property->GetStudyUID());
|
||||||
|
m_pUniqueID.append("_");
|
||||||
|
m_pUniqueID.append(property->GetSeriesUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
SeriesImageSet::~SeriesImageSet() {
|
SeriesImageSet::~SeriesImageSet() {
|
||||||
if (m_property) m_property->Delete();
|
|
||||||
m_property = nullptr;
|
m_property = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +57,6 @@ const char* SeriesImageSet::getCurImageName() const
|
|||||||
|
|
||||||
const char* SeriesImageSet::getCurSeriesName() const
|
const char* SeriesImageSet::getCurSeriesName() const
|
||||||
{
|
{
|
||||||
if (m_pUniqueID.dicom_name.empty())
|
if (!m_property) return nullptr;
|
||||||
return nullptr;
|
return m_property->GetSeriesNumber();
|
||||||
return m_pUniqueID.dicom_name.c_str();
|
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ void ThumbnailBarWidget::Slot_setCurrentThumbnail(DicomImageView *view)
|
|||||||
SeriesImageSet *series = view->getSeriesInstance();
|
SeriesImageSet *series = view->getSeriesInstance();
|
||||||
//set to another
|
//set to another
|
||||||
DicomLoader *helper = DicomLoader::GetInstance();
|
DicomLoader *helper = DicomLoader::GetInstance();
|
||||||
SeriesInfo_t* cur_serie = helper->getSerieInfo(*series->getUniqueID());
|
SeriesInfo_t* cur_serie = helper->getSerieInfo(series->getUniqueID());
|
||||||
if (cur_serie)
|
if (cur_serie)
|
||||||
{
|
{
|
||||||
thumbnailImage *thumb = cur_serie->thumb_nail;
|
thumbnailImage *thumb = cur_serie->thumb_nail;
|
||||||
|
|||||||
@@ -73,21 +73,6 @@ SeriesImageSet* ViewContainerWidget::getCurrentSeries() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewContainerWidget::getRelevantViewList(const UniqueIDInfo& unique, QList<DicomImageView*> & viewList)
|
|
||||||
{
|
|
||||||
for (auto *v : view_list_) {
|
|
||||||
if (v->HasSeries())
|
|
||||||
{
|
|
||||||
UniqueIDInfo_t* exist = v->getSeriesInstance()->getUniqueID();
|
|
||||||
if (DicomUtil::EqualsUnique(*exist, unique))
|
|
||||||
{
|
|
||||||
viewList.push_back(v);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ViewContainerWidget::Slot_SyncEvent(DicomImageView *view, int interactionMode, void* calldata)
|
void ViewContainerWidget::Slot_SyncEvent(DicomImageView *view, int interactionMode, void* calldata)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -395,7 +380,7 @@ void ViewContainerWidget::Slot_DragDropEvent(DicomImageView *view, thumbnailImag
|
|||||||
{
|
{
|
||||||
old = view->getSeriesInstance();
|
old = view->getSeriesInstance();
|
||||||
}
|
}
|
||||||
replaceViewWithSerie(serie_info->unique_info, view);
|
replaceViewWithSerie(serie_info->unique_id, view);
|
||||||
setCurrentView(view);
|
setCurrentView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,11 +392,11 @@ void ViewContainerWidget::Slot_ThumbnailClickEvent(thumbnailImage* tb)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SeriesInfo_t* serie_info = tb->getSeriesInfo();
|
SeriesInfo_t* serie_info = tb->getSeriesInfo();
|
||||||
replaceViewWithSerie(serie_info->unique_info, view);
|
replaceViewWithSerie(serie_info->unique_id, view);
|
||||||
setCurrentView(view);
|
setCurrentView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewContainerWidget::replaceViewWithSerie(UniqueIDInfo_t* unique_info, DicomImageView* curV)
|
void ViewContainerWidget::replaceViewWithSerie(const std::string& uniqueid, DicomImageView* curV)
|
||||||
{
|
{
|
||||||
if (!curV)
|
if (!curV)
|
||||||
{
|
{
|
||||||
@@ -419,7 +404,7 @@ void ViewContainerWidget::replaceViewWithSerie(UniqueIDInfo_t* unique_info, Dico
|
|||||||
}
|
}
|
||||||
curV->removeViewWithFusion();
|
curV->removeViewWithFusion();
|
||||||
DicomLoader *helper = DicomLoader::GetInstance();
|
DicomLoader *helper = DicomLoader::GetInstance();
|
||||||
curV->setDicomImageView(helper->createSeries(unique_info));
|
curV->setDicomImageView(helper->createSeries(uniqueid));
|
||||||
curV->Render();
|
curV->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user