Load data memory fix.(corner anno caused)
This commit is contained in:
@@ -19,6 +19,7 @@ class SeriesImageSet;
|
|||||||
class DICOMDirectoryHelper;
|
class DICOMDirectoryHelper;
|
||||||
class ExtendMedicalImageProperties;
|
class ExtendMedicalImageProperties;
|
||||||
class vtkDICOMImageReader2;
|
class vtkDICOMImageReader2;
|
||||||
|
typedef std::map<std::string, SeriesImageSet*> ImageSetStore;
|
||||||
|
|
||||||
class DicomLoader {
|
class DicomLoader {
|
||||||
public:
|
public:
|
||||||
@@ -53,8 +54,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if not duplicate
|
|
||||||
SeriesImageSet* InitFromRead(const UniqueIDInfo &uniqueID);// , DicomTagInfo_t* tag_info);
|
SeriesImageSet* getSeriesImageSet(const UniqueIDInfo &uniqueID);
|
||||||
|
|
||||||
SeriesInfo_t* getSerieInfo(const UniqueIDInfo &uniqueID);
|
SeriesInfo_t* getSerieInfo(const UniqueIDInfo &uniqueID);
|
||||||
SeriesImageSet* getFirstInstance(const UniqueIDInfo &uniqueID);
|
SeriesImageSet* getFirstInstance(const UniqueIDInfo &uniqueID);
|
||||||
@@ -84,7 +85,7 @@ private:
|
|||||||
ExtendMedicalImageProperties * currentImageProperty = nullptr;
|
ExtendMedicalImageProperties * currentImageProperty = nullptr;
|
||||||
std::vector<ExtendMedicalImageProperties*> imageProperties;
|
std::vector<ExtendMedicalImageProperties*> imageProperties;
|
||||||
vtkDICOMImageReader2 * reader = nullptr;
|
vtkDICOMImageReader2 * reader = nullptr;
|
||||||
|
ImageSetStore store;
|
||||||
AddDicomType m_addType;
|
AddDicomType m_addType;
|
||||||
PatientsMapType m_patients;
|
PatientsMapType m_patients;
|
||||||
vtkObject* placeHolder;
|
vtkObject* placeHolder;
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ public slots:
|
|||||||
void Slot_ViewClicked(DicomImageView *view);
|
void Slot_ViewClicked(DicomImageView *view);
|
||||||
void Slot_ViewDoubleClicked(DicomImageView *view);
|
void Slot_ViewDoubleClicked(DicomImageView *view);
|
||||||
void Slot_DragDropEvent(DicomImageView *view, thumbnailImage* tb);
|
void Slot_DragDropEvent(DicomImageView *view, thumbnailImage* tb);
|
||||||
|
/**
|
||||||
|
* 缩略图点击槽函数,会导致当前选中的view重新load数据
|
||||||
|
* @param tb 缩略图对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
void Slot_ThumbnailClickEvent(thumbnailImage* tb);
|
void Slot_ThumbnailClickEvent(thumbnailImage* tb);
|
||||||
void Slot_SyncEvent(DicomImageView *view, int interactionMode, void* calldata);
|
void Slot_SyncEvent(DicomImageView *view, int interactionMode, void* calldata);
|
||||||
|
|
||||||
|
|||||||
@@ -154,8 +154,15 @@ bool DicomLoader::IsDuplicate(UniqueIDInfo_t* unique)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
SeriesImageSet* DicomLoader::InitFromRead(const UniqueIDInfo &uniqueID)//, DicomTagInfo_t* tag_info)
|
SeriesImageSet* DicomLoader::getSeriesImageSet(const UniqueIDInfo &uniqueID)//, DicomTagInfo_t* tag_info)
|
||||||
{
|
{
|
||||||
|
//only user key to the series level
|
||||||
|
auto key = uniqueID.patient_name+uniqueID.study_uid+uniqueID.series_uid;
|
||||||
|
if (store.count(key)>0)
|
||||||
|
{
|
||||||
|
//use cache instead load
|
||||||
|
return store[key];
|
||||||
|
}
|
||||||
if (reader) reader->Delete();
|
if (reader) reader->Delete();
|
||||||
reader = vtkDICOMImageReader2::New();
|
reader = vtkDICOMImageReader2::New();
|
||||||
reader->SetFileNames(*(currentImageProperty->GetFileNames()));
|
reader->SetFileNames(*(currentImageProperty->GetFileNames()));
|
||||||
@@ -163,6 +170,7 @@ SeriesImageSet* DicomLoader::InitFromRead(const UniqueIDInfo &uniqueID)//, Dicom
|
|||||||
SeriesImageSet* result = new SeriesImageSet(uniqueID,currentImageProperty,reader->GetOutput());
|
SeriesImageSet* result = new SeriesImageSet(uniqueID,currentImageProperty,reader->GetOutput());
|
||||||
reader->Delete();
|
reader->Delete();
|
||||||
reader = nullptr;
|
reader = nullptr;
|
||||||
|
store[key] = result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +406,7 @@ DicomTagInfo_t* DicomLoader::createDicomTagsInfo()
|
|||||||
SeriesImageSet* DicomLoader::createSeries(UniqueIDInfo_t* uniqueID)
|
SeriesImageSet* DicomLoader::createSeries(UniqueIDInfo_t* uniqueID)
|
||||||
{
|
{
|
||||||
|
|
||||||
SeriesImageSet* series =instance->InitFromRead(*uniqueID);
|
SeriesImageSet* series = instance->getSeriesImageSet(*uniqueID);
|
||||||
|
|
||||||
series->setUpSeriesInstance();
|
series->setUpSeriesInstance();
|
||||||
return series;
|
return series;
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ infinitiViewer::~infinitiViewer()
|
|||||||
{
|
{
|
||||||
if (this->ImageMapper)
|
if (this->ImageMapper)
|
||||||
{
|
{
|
||||||
|
this->ImageMapper->SetInputData(nullptr);
|
||||||
this->ImageMapper->Delete();
|
this->ImageMapper->Delete();
|
||||||
this->ImageMapper = nullptr;
|
this->ImageMapper = nullptr;
|
||||||
}
|
}
|
||||||
@@ -363,6 +364,7 @@ infinitiViewer::~infinitiViewer()
|
|||||||
this->ImageActor->Delete();
|
this->ImageActor->Delete();
|
||||||
this->ImageActor = nullptr;
|
this->ImageActor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->FusionMapper)
|
if (this->FusionMapper)
|
||||||
{
|
{
|
||||||
this->FusionMapper->Delete();
|
this->FusionMapper->Delete();
|
||||||
@@ -394,9 +396,14 @@ infinitiViewer::~infinitiViewer()
|
|||||||
|
|
||||||
if (this->InteractorStyle)
|
if (this->InteractorStyle)
|
||||||
{
|
{
|
||||||
|
this->InteractorStyle->SetCornerAnnotation(nullptr);
|
||||||
this->InteractorStyle->Delete();
|
this->InteractorStyle->Delete();
|
||||||
this->InteractorStyle = nullptr;
|
this->InteractorStyle = nullptr;
|
||||||
}
|
}
|
||||||
|
if (this->cornerAnnotation) {
|
||||||
|
this->cornerAnnotation->Delete();
|
||||||
|
this->cornerAnnotation = nullptr;
|
||||||
|
}
|
||||||
measureStore->RemoveAllInSeries(SOP_UID);
|
measureStore->RemoveAllInSeries(SOP_UID);
|
||||||
// measureStore->Clear();
|
// measureStore->Clear();
|
||||||
//delete measureStore;
|
//delete measureStore;
|
||||||
|
|||||||
@@ -40,7 +40,13 @@ ActorDraggableInteractorStyle::ActorDraggableInteractorStyle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ActorDraggableInteractorStyle::~ActorDraggableInteractorStyle() {
|
ActorDraggableInteractorStyle::~ActorDraggableInteractorStyle() {
|
||||||
|
if (scalarProp) {
|
||||||
|
scalarProp->Delete();
|
||||||
|
scalarProp = nullptr;
|
||||||
|
}
|
||||||
|
if (CornerAnnotation) {
|
||||||
|
CornerAnnotation->UnRegister(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -205,10 +211,10 @@ void ActorDraggableInteractorStyle::NoneStatePick() {
|
|||||||
scalarProp = nullptr;
|
scalarProp = nullptr;
|
||||||
}
|
}
|
||||||
dragProp = nullptr;
|
dragProp = nullptr;
|
||||||
this->CornerAnnotation->SetText(BOTTOM_LEFT, "");
|
if (this->CornerAnnotation)this->CornerAnnotation->SetText(BOTTOM_LEFT, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->CornerAnnotation->SetText(BOTTOM_LEFT, "");
|
if (this->CornerAnnotation)this->CornerAnnotation->SetText(BOTTOM_LEFT, "");
|
||||||
this->Interactor->Render();
|
this->Interactor->Render();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -684,6 +684,9 @@ void DicomImageView::Render()
|
|||||||
|
|
||||||
void DicomImageView::CopyFromSeries(SeriesImageSet *series)
|
void DicomImageView::CopyFromSeries(SeriesImageSet *series)
|
||||||
{
|
{
|
||||||
|
if (_Series){
|
||||||
|
delete _Series;
|
||||||
|
}
|
||||||
_Series = series;
|
_Series = series;
|
||||||
|
|
||||||
_ImageViewer->SetInputData(_Series->GetData());
|
_ImageViewer->SetInputData(_Series->GetData());
|
||||||
@@ -804,16 +807,14 @@ void DicomImageView::ResetView()
|
|||||||
|
|
||||||
removeViewWithFusion();
|
removeViewWithFusion();
|
||||||
removeViewWithMeasure();
|
removeViewWithMeasure();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
orphanizeSeriesInstance();
|
orphanizeSeriesInstance();
|
||||||
//_glWidt->update();
|
//_glWidt->update();
|
||||||
|
|
||||||
//_scrollBar = nullptr;
|
//_scrollBar = nullptr;
|
||||||
_ImageViewer->Delete();
|
_ImageViewer->Delete();
|
||||||
_ImageViewer = nullptr;
|
_ImageViewer = nullptr;
|
||||||
|
int count = _Series->GetData()->GetReferenceCount();
|
||||||
|
qDebug()<<count;
|
||||||
_Series = nullptr;
|
_Series = nullptr;
|
||||||
|
|
||||||
_ScrollTriggerType = scrollScope::TriggerType::USER_TRIGGER;
|
_ScrollTriggerType = scrollScope::TriggerType::USER_TRIGGER;
|
||||||
|
|||||||
@@ -407,13 +407,6 @@ void ViewContainerWidget::Slot_ThumbnailClickEvent(thumbnailImage* tb)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SeriesInfo_t* serie_info = tb->getSeriesInfo();
|
SeriesInfo_t* serie_info = tb->getSeriesInfo();
|
||||||
SeriesImageSet* old = nullptr;
|
|
||||||
bool copy = true;
|
|
||||||
|
|
||||||
if (view->HasSeries())
|
|
||||||
{
|
|
||||||
old = view->getSeriesInstance();
|
|
||||||
}
|
|
||||||
replaceViewWithSerie(serie_info->unique_info, view);
|
replaceViewWithSerie(serie_info->unique_info, view);
|
||||||
setCurrentView(view);
|
setCurrentView(view);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user