Add UI for DIDKIT.
This commit is contained in:
66
DIDKit/App/DICOMPropertiesStore.cpp
Normal file
66
DIDKit/App/DICOMPropertiesStore.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/9/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DICOMPropertiesStore.h"
|
||||||
|
|
||||||
|
#include "IO/DICOM/ExtendMedicalImageProperties.h"
|
||||||
|
|
||||||
|
void DICOMPropertiesStore::addProperty(ExtendMedicalImageProperties *property) {
|
||||||
|
std::string patient_name = property->GetPatientName();
|
||||||
|
std::string study_uid = property->GetStudyUID();
|
||||||
|
std::string series_uid = property->GetSeriesUID();
|
||||||
|
//patient level
|
||||||
|
PatientInfo_t* patient = nullptr;
|
||||||
|
//get from store
|
||||||
|
if (m_patients.count(patient_name)>0){
|
||||||
|
patient = m_patients[patient_name];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//create new
|
||||||
|
patient = new PatientInfo_t();
|
||||||
|
patient->patient_name = property->GetPatientName();
|
||||||
|
patient->birth_date = property->GetPatientBirthDate();
|
||||||
|
patient->studies = new StudiesMapType();
|
||||||
|
m_patients[property->GetPatientID()] = patient;
|
||||||
|
}
|
||||||
|
StudyInfo_t* study = nullptr;
|
||||||
|
//get from store
|
||||||
|
if (patient->studies->count(study_uid)>0){
|
||||||
|
study = patient->studies->at(study_uid);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//create new
|
||||||
|
study = new StudyInfo_t();
|
||||||
|
patient->studies->insert({study_uid, study});
|
||||||
|
study->study_description = property->GetStudyDescription();
|
||||||
|
study->study_date = property->GetStudyDate();
|
||||||
|
study->study_time = property->GetStudyTime();
|
||||||
|
study->series = new SeriesMapType();
|
||||||
|
}
|
||||||
|
//TODO:need add Image set logic
|
||||||
|
if (study->series->count(series_uid)>0){
|
||||||
|
study->series->at(series_uid)->insert({property->GetUniqueID(),property});
|
||||||
|
property->Register(m_Holder);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImageSetMapType* v = new ImageSetMapType;
|
||||||
|
v->insert({property->GetUniqueID(),property});
|
||||||
|
study->series->insert({series_uid,v});
|
||||||
|
property->Register(m_Holder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DICOMPropertiesStore::reset() {
|
||||||
|
m_patients.clear();
|
||||||
|
if (m_Holder)m_Holder->Delete();
|
||||||
|
m_Holder = vtkObject::New();
|
||||||
|
}
|
||||||
|
|
||||||
|
DICOMPropertiesStore::DICOMPropertiesStore() {
|
||||||
|
m_Holder = vtkObject::New();
|
||||||
|
}
|
||||||
|
|
||||||
|
DICOMPropertiesStore::~DICOMPropertiesStore() {
|
||||||
|
if (m_Holder)m_Holder->Delete();
|
||||||
|
}
|
||||||
38
DIDKit/App/DICOMPropertiesStore.h
Normal file
38
DIDKit/App/DICOMPropertiesStore.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/9/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OMEGAV_DICOMPROPERTIESSTORE_H
|
||||||
|
#define OMEGAV_DICOMPROPERTIESSTORE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vtkObject.h>
|
||||||
|
|
||||||
|
#include "IO/Common/DICOMTypes.h"
|
||||||
|
|
||||||
|
class ExtendMedicalImageProperties;
|
||||||
|
|
||||||
|
class DICOMPropertiesStore {
|
||||||
|
public:
|
||||||
|
static DICOMPropertiesStore *GetInstance() {
|
||||||
|
static DICOMPropertiesStore store;
|
||||||
|
return &store;
|
||||||
|
}
|
||||||
|
|
||||||
|
PatientsMapType* getPatientsList() {
|
||||||
|
return &m_patients;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addProperty(ExtendMedicalImageProperties *property);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DICOMPropertiesStore();
|
||||||
|
~DICOMPropertiesStore();
|
||||||
|
PatientsMapType m_patients;
|
||||||
|
vtkObject *m_Holder;
|
||||||
|
};
|
||||||
|
#endif //OMEGAV_DICOMPROPERTIESSTORE_H
|
||||||
@@ -1,15 +1,96 @@
|
|||||||
//
|
|
||||||
// Created by Krad on 2022/9/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "DIDMainWindow.h"
|
#include "DIDMainWindow.h"
|
||||||
#include "PACS/Widget/ImportWidget.h"
|
#include "ui_DIDMainWindow.h"
|
||||||
|
|
||||||
DIDMainWindow::DIDMainWindow(QWidget *parent) {
|
#include "MenuAction/ClearFileAction.h"
|
||||||
auto m_import = new ImportWidget(this);
|
#include "MenuAction/ClearPropertyAction.h"
|
||||||
m_import->show();
|
#include "MenuAction/OpenFileAction.h"
|
||||||
|
#include "MenuAction/OpenDirAction.h"
|
||||||
|
#include "MenuAction/OpenWorkSpaceAction.h"
|
||||||
|
#include "MenuAction/ExitAction.h"
|
||||||
|
#include "MenuAction/GetPacsConfigDialogAction.h"
|
||||||
|
|
||||||
|
#include "Model/FileModel.h"
|
||||||
|
#include "Model/PropertyTableModel.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <QTreeView>
|
||||||
|
#include <QTableView>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
|
DIDMainWindow::DIDMainWindow(QWidget *aParent)
|
||||||
|
: QMainWindow(aParent)
|
||||||
|
, mUI(new Ui::DIDMainWindow)
|
||||||
|
, mTreeView(new QTreeView(this))
|
||||||
|
, mTableModel(new PropertyTableModel(this))
|
||||||
|
, mTreeModel(new FileModel(mTableModel,this))
|
||||||
|
, mTableView(new QTableView(this))
|
||||||
|
|
||||||
|
{
|
||||||
|
mUI->setupUi(this);
|
||||||
|
initMenu();
|
||||||
|
initFileWidget();
|
||||||
|
initTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDMainWindow::~DIDMainWindow() {
|
void DIDMainWindow::initTable() const {
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(mUI->mPropertyWidget);
|
||||||
|
layout->addWidget(mTableView);
|
||||||
|
mTableView->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
mTableView->verticalHeader()->hide();
|
||||||
|
mTableView->setModel(mTableModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIDMainWindow::~DIDMainWindow()
|
||||||
|
{
|
||||||
|
delete mUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIDMainWindow::initMenu()
|
||||||
|
{
|
||||||
|
QMenu* openMenu = new QMenu(tr("Open"),this);
|
||||||
|
auto fileAction = new OpenFileAction(tr("Open File"),this);
|
||||||
|
connect(fileAction, &OpenFileAction::dataLoaded,this, &DIDMainWindow::loadPropertyTable);
|
||||||
|
openMenu->addAction(fileAction);
|
||||||
|
auto dirAction = new OpenDirAction(tr("Open Directory"),this);
|
||||||
|
connect(dirAction, &OpenDirAction::dataLoaded,this, &DIDMainWindow::loadPropertyTable);
|
||||||
|
openMenu->addAction(dirAction);
|
||||||
|
openMenu->addAction(new OpenWorkSpaceAction(tr("Open WorkSpace"),this));
|
||||||
|
openMenu->addSeparator();
|
||||||
|
openMenu->addAction(new ExitAction(tr("Exit"),this));
|
||||||
|
|
||||||
|
QMenu* clearMenu = new QMenu(tr("Clear"),this);
|
||||||
|
clearMenu->addAction(new ClearFileAction(tr("Clear File"),mTreeModel,this));
|
||||||
|
clearMenu->addAction(new ClearPropertyAction(tr("Clear Property"),mTableModel,this));
|
||||||
|
|
||||||
|
QMenu* pacsMenu = new QMenu(tr("PACS"),this);
|
||||||
|
pacsMenu->addAction(new GetPacsConfigDialogAction(tr("Config"),this));
|
||||||
|
|
||||||
|
mUI->mMenuBar->addMenu(openMenu);
|
||||||
|
mUI->mMenuBar->addMenu(clearMenu);
|
||||||
|
mUI->mMenuBar->addMenu(pacsMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIDMainWindow::initFileWidget()
|
||||||
|
{
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(mUI->mFileWidget);
|
||||||
|
layout->addWidget(mTreeView);
|
||||||
|
|
||||||
|
mTreeView->setModel(mTreeModel);
|
||||||
|
mTreeView->setHeaderHidden(true);
|
||||||
|
connect(mTreeView,&QAbstractItemView::doubleClicked,mTreeModel,&FileModel::executeItemAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIDMainWindow::loadPropertyTable(bool loadSuccess)
|
||||||
|
{
|
||||||
|
if (loadSuccess){
|
||||||
|
mTreeModel->setModelData();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
QMessageBox::warning(this,"Warning","No DICOM loaded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,38 @@
|
|||||||
//
|
#ifndef DIDMAINWINDOW_H
|
||||||
// Created by Krad on 2022/9/20.
|
#define DIDMAINWINDOW_H
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef OMEGAV_DIDMAINWINDOW_H
|
#include <QMainWindow>
|
||||||
#define OMEGAV_DIDMAINWINDOW_H
|
|
||||||
|
|
||||||
#include <QtWidgets/QMainWindow>
|
namespace Ui {
|
||||||
|
class DIDMainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
class DIDMainWindow : public QMainWindow{
|
class QTreeView;
|
||||||
Q_OBJECT
|
class QTableView;
|
||||||
|
class FileModel;
|
||||||
|
class PropertyTableModel;
|
||||||
|
|
||||||
public:
|
class DIDMainWindow : public QMainWindow
|
||||||
explicit DIDMainWindow(QWidget *parent = Q_NULLPTR);
|
{
|
||||||
~DIDMainWindow();
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DIDMainWindow(QWidget *aParent = nullptr);
|
||||||
|
~DIDMainWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initMenu();
|
||||||
|
void initFileWidget();
|
||||||
|
void loadPropertyTable(bool loadSuccess);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::DIDMainWindow *mUI;
|
||||||
|
QTreeView* mTreeView;
|
||||||
|
PropertyTableModel* mTableModel;
|
||||||
|
FileModel* mTreeModel;
|
||||||
|
QTableView* mTableView;
|
||||||
|
|
||||||
|
void initTable() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // DIDMAINWINDOW_H
|
||||||
#endif //OMEGAV_DIDMAINWINDOW_H
|
|
||||||
|
|||||||
40
DIDKit/App/DIDMainWindow.ui
Normal file
40
DIDKit/App/DIDMainWindow.ui
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DIDMainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="DIDMainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>670</width>
|
||||||
|
<height>469</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>DIDMainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="mCentralWidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="mFileWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="mPropertyWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="mMenuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>670</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
19
DIDKit/App/MenuAction/ClearFileAction.cpp
Normal file
19
DIDKit/App/MenuAction/ClearFileAction.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "ClearFileAction.h"
|
||||||
|
#include "Model/FileModel.h"
|
||||||
|
|
||||||
|
ClearFileAction::ClearFileAction(const QString& aName, FileModel* aModel, QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
, mModel(aModel)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&ClearFileAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearFileAction::~ClearFileAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearFileAction::executeAction()
|
||||||
|
{
|
||||||
|
mModel->clearModelData();
|
||||||
|
}
|
||||||
21
DIDKit/App/MenuAction/ClearFileAction.h
Normal file
21
DIDKit/App/MenuAction/ClearFileAction.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef CLEARFILEACTION_H
|
||||||
|
#define CLEARFILEACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class FileModel;
|
||||||
|
|
||||||
|
class ClearFileAction : public QAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ClearFileAction(const QString& aName,FileModel* aModel, QWidget* aParent = nullptr);
|
||||||
|
~ClearFileAction() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
|
||||||
|
private:
|
||||||
|
FileModel* mModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLEARFILEACTION_H
|
||||||
20
DIDKit/App/MenuAction/ClearPropertyAction.cpp
Normal file
20
DIDKit/App/MenuAction/ClearPropertyAction.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include "ClearPropertyAction.h"
|
||||||
|
|
||||||
|
#include "Model/PropertyTableModel.h"
|
||||||
|
|
||||||
|
ClearPropertyAction::ClearPropertyAction(const QString& aName, PropertyTableModel* aModel, QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
, mModel(aModel)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&ClearPropertyAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearPropertyAction::~ClearPropertyAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearPropertyAction::executeAction()
|
||||||
|
{
|
||||||
|
mModel->removeRows(0,mModel->rowCount());;
|
||||||
|
}
|
||||||
21
DIDKit/App/MenuAction/ClearPropertyAction.h
Normal file
21
DIDKit/App/MenuAction/ClearPropertyAction.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef CLEARPROPERTYACTION_H
|
||||||
|
#define CLEARPROPERTYACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class PropertyTableModel;
|
||||||
|
|
||||||
|
class ClearPropertyAction : public QAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ClearPropertyAction(const QString& aName,PropertyTableModel* aModel, QWidget* aParent = nullptr);
|
||||||
|
~ClearPropertyAction() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
|
||||||
|
private:
|
||||||
|
PropertyTableModel* mModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLEARPROPERTYACTION_H
|
||||||
17
DIDKit/App/MenuAction/ExitAction.cpp
Normal file
17
DIDKit/App/MenuAction/ExitAction.cpp
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#include "ExitAction.h"
|
||||||
|
|
||||||
|
ExitAction::ExitAction(const QString& aName,QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&ExitAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExitAction::~ExitAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExitAction::executeAction()
|
||||||
|
{
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
16
DIDKit/App/MenuAction/ExitAction.h
Normal file
16
DIDKit/App/MenuAction/ExitAction.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef EXITACTION_H
|
||||||
|
#define EXITACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class ExitAction : public QAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExitAction(const QString& aName, QWidget* aParent = nullptr);
|
||||||
|
~ExitAction() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EXITACTION_H
|
||||||
20
DIDKit/App/MenuAction/GetPacsConfigDialogAction.cpp
Normal file
20
DIDKit/App/MenuAction/GetPacsConfigDialogAction.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include "GetPacsConfigDialogAction.h"
|
||||||
|
|
||||||
|
#include "PACS/Widget/importwidget.h"
|
||||||
|
|
||||||
|
GetPacsConfigDialogAction::GetPacsConfigDialogAction(const QString& aName,QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
, mWidget(new ImportWidget(aParent))
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&GetPacsConfigDialogAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetPacsConfigDialogAction::~GetPacsConfigDialogAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetPacsConfigDialogAction::executeAction()
|
||||||
|
{
|
||||||
|
mWidget->show();
|
||||||
|
}
|
||||||
21
DIDKit/App/MenuAction/GetPacsConfigDialogAction.h
Normal file
21
DIDKit/App/MenuAction/GetPacsConfigDialogAction.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef GETPACSCONFIGDIALOGACTION_H
|
||||||
|
#define GETPACSCONFIGDIALOGACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class ImportWidget;
|
||||||
|
|
||||||
|
class GetPacsConfigDialogAction : public QAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GetPacsConfigDialogAction(const QString& aName, QWidget* aParent = nullptr);
|
||||||
|
~GetPacsConfigDialogAction() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ImportWidget* mWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GETPACSCONFIGDIALOGACTION_H
|
||||||
41
DIDKit/App/MenuAction/OpenDirAction.cpp
Normal file
41
DIDKit/App/MenuAction/OpenDirAction.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#include "OpenDirAction.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
#include "IO/DICOM/DicomLoader.h"
|
||||||
|
#include "DICOMPropertiesStore.h"
|
||||||
|
|
||||||
|
OpenDirAction::OpenDirAction(const QString& aName,QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&OpenDirAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenDirAction::~OpenDirAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenDirAction::executeAction()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getExistingDirectory(menu(),
|
||||||
|
tr("Open Directory"), QDir::currentPath(),
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
DicomLoader::InitCodecs();
|
||||||
|
std::string dir = path.toStdString();
|
||||||
|
std::vector<ExtendMedicalImageProperties*> vector;
|
||||||
|
int count = 0;
|
||||||
|
DicomLoader::readPropertiesFromDir(dir,vector, count);
|
||||||
|
DicomLoader::FinalizeCodecs();
|
||||||
|
if( vector.empty()){
|
||||||
|
emit dataLoaded(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DICOMPropertiesStore::GetInstance()->reset();
|
||||||
|
for (auto item : vector) {
|
||||||
|
DICOMPropertiesStore::GetInstance()->addProperty(item);
|
||||||
|
}
|
||||||
|
emit dataLoaded(true);
|
||||||
|
}
|
||||||
|
|
||||||
18
DIDKit/App/MenuAction/OpenDirAction.h
Normal file
18
DIDKit/App/MenuAction/OpenDirAction.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef OPENDIRACTION_H
|
||||||
|
#define OPENDIRACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class OpenDirAction : public QAction
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
OpenDirAction(const QString& aName, QWidget* aParent = nullptr);
|
||||||
|
~OpenDirAction() override;
|
||||||
|
signals:
|
||||||
|
void dataLoaded(bool loadSuccess);
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPENDIRACTION_H
|
||||||
41
DIDKit/App/MenuAction/OpenFileAction.cpp
Normal file
41
DIDKit/App/MenuAction/OpenFileAction.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#include "OpenFileAction.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include "IO/DICOM/DicomLoader.h"
|
||||||
|
#include "DICOMPropertiesStore.h"
|
||||||
|
|
||||||
|
OpenFileAction::OpenFileAction(const QString& aName,QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&OpenFileAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OpenFileAction::~OpenFileAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenFileAction::executeAction()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(menu());;
|
||||||
|
DicomLoader::InitCodecs();
|
||||||
|
std::string file = path.toStdString();
|
||||||
|
std::vector<ExtendMedicalImageProperties*> vector;
|
||||||
|
int count = 0;
|
||||||
|
DicomLoader::readPropertiesFromFile(file,vector, count);
|
||||||
|
DicomLoader::FinalizeCodecs();
|
||||||
|
if( vector.empty()){
|
||||||
|
emit dataLoaded(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DICOMPropertiesStore::GetInstance()->reset();
|
||||||
|
for (auto item : vector) {
|
||||||
|
DICOMPropertiesStore::GetInstance()->addProperty(item);
|
||||||
|
}
|
||||||
|
emit dataLoaded(true);
|
||||||
|
}
|
||||||
18
DIDKit/App/MenuAction/OpenFileAction.h
Normal file
18
DIDKit/App/MenuAction/OpenFileAction.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef OPENFILEACTION_H
|
||||||
|
#define OPENFILEACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class OpenFileAction : public QAction
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
OpenFileAction(const QString& aName, QWidget* aParent = nullptr);
|
||||||
|
~OpenFileAction() override;
|
||||||
|
signals:
|
||||||
|
void dataLoaded(bool loadSuccess);
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPENFILEACTION_H
|
||||||
22
DIDKit/App/MenuAction/OpenWorkSpaceAction.cpp
Normal file
22
DIDKit/App/MenuAction/OpenWorkSpaceAction.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "OpenWorkSpaceAction.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
OpenWorkSpaceAction::OpenWorkSpaceAction(const QString& aName,QWidget* aParent)
|
||||||
|
: QAction(aName, aParent)
|
||||||
|
{
|
||||||
|
connect(this,&QAction::triggered,this,&OpenWorkSpaceAction::executeAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OpenWorkSpaceAction::~OpenWorkSpaceAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenWorkSpaceAction::executeAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
16
DIDKit/App/MenuAction/OpenWorkSpaceAction.h
Normal file
16
DIDKit/App/MenuAction/OpenWorkSpaceAction.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef OPENWORKSPACEACTION_H
|
||||||
|
#define OPENWORKSPACEACTION_H
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
class OpenWorkSpaceAction : public QAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpenWorkSpaceAction(const QString& aName, QWidget* aParent = nullptr);
|
||||||
|
~OpenWorkSpaceAction() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void executeAction();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPENWORKSPACEACTION_H
|
||||||
82
DIDKit/App/Model/FileItem.cpp
Normal file
82
DIDKit/App/Model/FileItem.cpp
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#include "FileItem.h"
|
||||||
|
#include "FileItemAction.h"
|
||||||
|
|
||||||
|
FileItem::FileItem(FileItemDataPointer mData, FileItem* aParent, FileItemActionPointer aAction)
|
||||||
|
: mParent(aParent)
|
||||||
|
, mChilds(QList<FileItem*>())
|
||||||
|
, mData(mData)
|
||||||
|
, mAction(aAction)
|
||||||
|
{
|
||||||
|
if (mParent != nullptr)
|
||||||
|
{
|
||||||
|
mParent->setChild(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem::~FileItem()
|
||||||
|
{
|
||||||
|
qDeleteAll(mChilds);
|
||||||
|
mChilds.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItem::setChild(FileItem* aChild)
|
||||||
|
{
|
||||||
|
mChilds.append(aChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItem::setChilds(const QList<FileItem*>& aChilds)
|
||||||
|
{
|
||||||
|
mChilds.append(aChilds);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItem::removeChild(int aIndex)
|
||||||
|
{
|
||||||
|
mChilds.removeAt(aIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileItem::childCount()
|
||||||
|
{
|
||||||
|
return mChilds.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* FileItem::getChild(int aIndex)
|
||||||
|
{
|
||||||
|
if (aIndex < mChilds.count())
|
||||||
|
{
|
||||||
|
return mChilds.at(aIndex);
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* FileItem::getParent()
|
||||||
|
{
|
||||||
|
return mParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItemDataPointer FileItem::getData()
|
||||||
|
{
|
||||||
|
return mData;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileItem::getIndexRow()
|
||||||
|
{
|
||||||
|
if (mParent)
|
||||||
|
{
|
||||||
|
return mParent->mChilds.indexOf(this);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItem::clearChilds()
|
||||||
|
{
|
||||||
|
qDeleteAll(mChilds);
|
||||||
|
mChilds.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItem::executeAction()
|
||||||
|
{
|
||||||
|
if(!mAction.isNull())
|
||||||
|
{
|
||||||
|
mAction->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
37
DIDKit/App/Model/FileItem.h
Normal file
37
DIDKit/App/Model/FileItem.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#ifndef FILEITEM_H
|
||||||
|
#define FILEITEM_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
class FileItemAction;
|
||||||
|
typedef QSharedPointer<QVariant> FileItemDataPointer;
|
||||||
|
typedef QSharedPointer<FileItemAction> FileItemActionPointer;
|
||||||
|
|
||||||
|
|
||||||
|
class FileItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FileItem(FileItemDataPointer aData, FileItem* aParent = nullptr, FileItemActionPointer aAction = QSharedPointer<FileItemAction>());
|
||||||
|
~FileItem();
|
||||||
|
void setChild(FileItem* aChild);
|
||||||
|
void setChilds(const QList<FileItem*>& aChilds);
|
||||||
|
void removeChild(int aIndex);
|
||||||
|
int childCount();
|
||||||
|
FileItem* getChild(int aIndex);
|
||||||
|
FileItem* getParent();
|
||||||
|
FileItemDataPointer getData();
|
||||||
|
int getIndexRow();
|
||||||
|
void clearChilds();
|
||||||
|
void executeAction();
|
||||||
|
|
||||||
|
private:
|
||||||
|
FileItem* mParent;
|
||||||
|
QList<FileItem*> mChilds;
|
||||||
|
FileItemDataPointer mData;
|
||||||
|
FileItemActionPointer mAction;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEITEM_H
|
||||||
24
DIDKit/App/Model/FileItemAction.cpp
Normal file
24
DIDKit/App/Model/FileItemAction.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "FileItemAction.h"
|
||||||
|
|
||||||
|
#include "IO/DICOM/ExtendMedicalImageProperties.h"
|
||||||
|
#include "PropertyTableModel.h"
|
||||||
|
|
||||||
|
FileItemAction::FileItemAction(PropertyTableModel* aTableModel, ExtendMedicalImageProperties* aProperty)
|
||||||
|
: mTableModel(aTableModel)
|
||||||
|
, mProperty(aProperty)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileItemAction::execute()
|
||||||
|
{
|
||||||
|
mTableModel->setModelData(0,0,mProperty->GetSeriesNumber());
|
||||||
|
mTableModel->setModelData(0,1,mProperty->GetSeriesDescription());
|
||||||
|
mTableModel->setModelData(0,2,mProperty->GetAcquisitionDate());
|
||||||
|
mTableModel->setModelData(0,3,mProperty->GetAcquisitionTime());
|
||||||
|
mTableModel->setModelData(0,4,mProperty->GetModality());
|
||||||
|
mTableModel->setModelData(0,5,QString::number(mProperty->GetColumns()));
|
||||||
|
mTableModel->setModelData(0,6,QString::number(mProperty->GetRows()));
|
||||||
|
mTableModel->setModelData(0,7,QString::number(mProperty->GetFileNames().size()));
|
||||||
|
|
||||||
|
}
|
||||||
18
DIDKit/App/Model/FileItemAction.h
Normal file
18
DIDKit/App/Model/FileItemAction.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef FILEITEMACTION_H
|
||||||
|
#define FILEITEMACTION_H
|
||||||
|
|
||||||
|
class ExtendMedicalImageProperties;
|
||||||
|
class PropertyTableModel;
|
||||||
|
|
||||||
|
class FileItemAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FileItemAction(PropertyTableModel* aTableModel, ExtendMedicalImageProperties* aProperty);
|
||||||
|
void execute();
|
||||||
|
|
||||||
|
private:
|
||||||
|
PropertyTableModel* mTableModel;
|
||||||
|
ExtendMedicalImageProperties* mProperty;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEITEMACTION_H
|
||||||
180
DIDKit/App/Model/FileModel.cpp
Normal file
180
DIDKit/App/Model/FileModel.cpp
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
#include "FileModel.h"
|
||||||
|
#include "FileItem.h"
|
||||||
|
#include "FileItemAction.h"
|
||||||
|
|
||||||
|
#include "IO/DICOM/ExtendMedicalImageProperties.h"
|
||||||
|
#include "DICOMPropertiesStore.h"
|
||||||
|
|
||||||
|
FileModel::FileModel(PropertyTableModel* aTableModel, QObject *parent)
|
||||||
|
: QAbstractItemModel(parent)
|
||||||
|
, mRootItem(new FileItem(FileItemDataPointer(new QVariant("root"))))
|
||||||
|
, mPatientList(nullptr)
|
||||||
|
, mTableModel(aTableModel)
|
||||||
|
{
|
||||||
|
setModelData();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileModel::~FileModel()
|
||||||
|
{
|
||||||
|
delete mRootItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant FileModel::data(const QModelIndex &aIndex, int aRole) const
|
||||||
|
{
|
||||||
|
if (aRole != Qt::DisplayRole)
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aIndex.isValid())
|
||||||
|
{
|
||||||
|
return *mRootItem->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* item = static_cast<FileItem*>(aIndex.internalPointer());
|
||||||
|
if (item == nullptr)
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
return *item->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex FileModel::index(int aRow, int aColumn, const QModelIndex &aParent) const
|
||||||
|
{
|
||||||
|
if (!hasIndex(aRow, aColumn, aParent))
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* parentItem;
|
||||||
|
|
||||||
|
if (!aParent.isValid())
|
||||||
|
{
|
||||||
|
parentItem = mRootItem;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parentItem = static_cast<FileItem*>(aParent.internalPointer());
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* childItem = parentItem->getChild(aRow);
|
||||||
|
if (childItem)
|
||||||
|
{
|
||||||
|
return createIndex(aRow, aColumn, childItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex FileModel::parent(const QModelIndex &aIndex) const
|
||||||
|
{
|
||||||
|
if (!aIndex.isValid())
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem *childItem = static_cast<FileItem*>(aIndex.internalPointer());
|
||||||
|
FileItem *parentItem = childItem->getParent();
|
||||||
|
|
||||||
|
if (parentItem == nullptr || parentItem == mRootItem)
|
||||||
|
{
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
return createIndex(parentItem->getIndexRow(), 0, parentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileModel::rowCount(const QModelIndex& aParent) const
|
||||||
|
{
|
||||||
|
if (aParent.column() > 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aParent.isValid())
|
||||||
|
{
|
||||||
|
return mRootItem->childCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileItem* item = static_cast<FileItem*>(aParent.internalPointer());
|
||||||
|
if(item == nullptr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return item->childCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
int FileModel::columnCount(const QModelIndex &aParent) const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileModel::setModelData()
|
||||||
|
{
|
||||||
|
clearModelData();
|
||||||
|
mPatientList = DICOMPropertiesStore::GetInstance()->getPatientsList();
|
||||||
|
beginResetModel();
|
||||||
|
//Patient Node
|
||||||
|
std::map<std::string,PatientInfo*>::iterator patientIter;
|
||||||
|
for(patientIter = mPatientList->begin();patientIter != mPatientList->end(); ++patientIter)
|
||||||
|
{
|
||||||
|
FileItem* patient = new FileItem(
|
||||||
|
FileItemDataPointer(new QVariant(QString("Patient: %1, Name: %2, Birth Date: %3")
|
||||||
|
.arg(patientIter->first.c_str(),patientIter->second->patient_name.c_str(),patientIter->second->birth_date.c_str()))),mRootItem);
|
||||||
|
//Study Node
|
||||||
|
std::map<std::string,StudyInfo*>::iterator studyIter;
|
||||||
|
StudiesMapType* studyMap = patientIter->second->studies;
|
||||||
|
for(studyIter = studyMap->begin();studyIter != studyMap->end(); ++studyIter)
|
||||||
|
{
|
||||||
|
FileItem* study = new FileItem(FileItemDataPointer(new QVariant(QString("Study: %1, Date: %2")
|
||||||
|
.arg(studyIter->first.c_str(), studyIter->second->study_date.c_str()))),patient);
|
||||||
|
//Series Node
|
||||||
|
std::map<std::string,ImageSetMapType*>::iterator seriesIter;
|
||||||
|
SeriesMapType* seriesMap = studyIter->second->series;
|
||||||
|
for(seriesIter = seriesMap->begin();seriesIter != seriesMap->end(); ++seriesIter)
|
||||||
|
{
|
||||||
|
FileItem* series = new FileItem(FileItemDataPointer(new QVariant(QString("Series: ")+seriesIter->first.c_str())),study);
|
||||||
|
//Image Set Node
|
||||||
|
std::map<std::string,ExtendMedicalImageProperties*>::iterator imageSetIter;
|
||||||
|
ImageSetMapType* imageSetMap = seriesIter->second;
|
||||||
|
for(imageSetIter = imageSetMap->begin();imageSetIter != imageSetMap->end(); ++imageSetIter)
|
||||||
|
{
|
||||||
|
ExtendMedicalImageProperties* property = imageSetIter->second;
|
||||||
|
FileItem* imageSet = new FileItem(FileItemDataPointer(new QVariant(QString("ImageSet: ")+imageSetIter->first.c_str() + QString(" ")
|
||||||
|
+ QString::number(property->GetFileNames().size())))
|
||||||
|
, series
|
||||||
|
, FileItemActionPointer(new FileItemAction(mTableModel,property)));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileModel::clearModelData()
|
||||||
|
{
|
||||||
|
if (rowCount() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
beginResetModel();
|
||||||
|
mRootItem->clearChilds();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileModel::executeItemAction(const QModelIndex& aIndex)
|
||||||
|
{
|
||||||
|
if(aIndex.isValid())
|
||||||
|
{
|
||||||
|
FileItem* item = static_cast<FileItem*>(aIndex.internalPointer());
|
||||||
|
if (item != nullptr)
|
||||||
|
{
|
||||||
|
item->executeAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
35
DIDKit/App/Model/FileModel.h
Normal file
35
DIDKit/App/Model/FileModel.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef FILEMODEL_H
|
||||||
|
#define FILEMODEL_H
|
||||||
|
|
||||||
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
|
#include "IO/Common/DICOMTypes.h"
|
||||||
|
|
||||||
|
class FileItem;
|
||||||
|
class PropertyTableModel;
|
||||||
|
|
||||||
|
class FileModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FileModel(PropertyTableModel* aTableModel, QObject *parent = nullptr);
|
||||||
|
~FileModel() override;
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex &aIndex, int aRole) const override;
|
||||||
|
// Qt::ItemFlags flags(const QModelIndex &aIndex) const override;
|
||||||
|
// QVariant headerData(int aSection, Qt::Orientation orientation,
|
||||||
|
// int aRole = Qt::DisplayRole) const override;
|
||||||
|
QModelIndex index(int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const override;
|
||||||
|
QModelIndex parent(const QModelIndex &aIndex) const override;
|
||||||
|
int rowCount(const QModelIndex &aParent = QModelIndex()) const override;
|
||||||
|
int columnCount(const QModelIndex &aParent = QModelIndex()) const override;
|
||||||
|
void setModelData();
|
||||||
|
void clearModelData();
|
||||||
|
void executeItemAction(const QModelIndex& aIndex);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FileItem* mRootItem;
|
||||||
|
PatientsMapType* mPatientList;
|
||||||
|
PropertyTableModel* mTableModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEMODEL_H
|
||||||
22
DIDKit/App/Model/PropertyTableModel.cpp
Normal file
22
DIDKit/App/Model/PropertyTableModel.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "PropertyTableModel.h"
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
PropertyTableModel::PropertyTableModel(QObject *parent)
|
||||||
|
: QStandardItemModel(parent)
|
||||||
|
{
|
||||||
|
setHorizontalHeaderLabels(QStringList()<<tr("Series Num")<<tr("Series Des")<<tr("Date")<<tr("Time")
|
||||||
|
<<tr("Modality")<<tr("Column")<<tr("Rows")<<tr("Image Count"));
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyTableModel::~PropertyTableModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertyTableModel::setModelData(int aRow,int aColumn,const QString& aData)
|
||||||
|
{
|
||||||
|
for(int i=0;i< columnCount() ;++i)
|
||||||
|
setItem(aRow,aColumn,new QStandardItem(aData));
|
||||||
|
}
|
||||||
|
|
||||||
15
DIDKit/App/Model/PropertyTableModel.h
Normal file
15
DIDKit/App/Model/PropertyTableModel.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef PROPERTYTABLEMODEL_H
|
||||||
|
#define PROPERTYTABLEMODEL_H
|
||||||
|
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
|
class PropertyTableModel : public QStandardItemModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit PropertyTableModel(QObject *parent = nullptr);
|
||||||
|
~PropertyTableModel() override;
|
||||||
|
void setModelData(int aRow,int aColumn,const QString& aData);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROPERTYTABLEMODEL_H
|
||||||
@@ -9,42 +9,20 @@
|
|||||||
#include "IO/Convert/DICOMToPNGConverter.h"
|
#include "IO/Convert/DICOMToPNGConverter.h"
|
||||||
#include "IO/Convert/DICOMToJPEGConverter.h"
|
#include "IO/Convert/DICOMToJPEGConverter.h"
|
||||||
|
|
||||||
#include "IO/DICOM/MultiframeDICOMSpliter.h"
|
|
||||||
|
|
||||||
#include "DIDMainWindow.h"
|
#include "DIDMainWindow.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[])
|
||||||
MultiframeDICOMSpliter spliter;
|
{
|
||||||
spliter.SetInputFileName("F:\\Special DICOM\\112255\\b65b0956-c046-11ea-a50f-509a4c8d26e3_08870001_37445_112255_7328989.dcm");
|
QTextCodec* codec = QTextCodec::codecForName("GB2312");
|
||||||
spliter.SetOutputDirPath("D:\\mounttest");
|
QTextCodec::setCodecForLocale(codec);
|
||||||
spliter.SetOutputFilePattern("%d.dcm");
|
|
||||||
spliter.write();
|
|
||||||
return 0;
|
|
||||||
DICOMToBMPConverter converter;
|
|
||||||
converter.setOutputSize(300, 300);
|
|
||||||
converter.setFrame(2);
|
|
||||||
converter.setInputDICOMFile("F:\\Kinds Data Files\\MultiFrame\\MultiFrame_Anon.dcm");
|
|
||||||
|
|
||||||
converter.save("D:\\test.bmp");
|
QApplication a(argc, argv);
|
||||||
DICOMToPNGConverter pconverter;
|
|
||||||
pconverter.setFrame(2);
|
QFont font;
|
||||||
pconverter.setOutputSize(300, 300);
|
font.setFamily(QString::fromUtf8("Arial"));
|
||||||
pconverter.setInputDICOMFile("D:\\TestData\\CT\\4905\\a8c5c508-06b8-11ea-9b1e-509a4c8d26e3_08870001_4905_10903_287571");
|
QApplication::setFont(font);
|
||||||
pconverter.save("D:\\test.png");
|
|
||||||
DICOMToJPEGConverter jconverter;
|
DIDMainWindow w;
|
||||||
jconverter.setOutputSize(300, 300);
|
w.show();
|
||||||
jconverter.setInputDICOMFile("D:\\TestData\\CT\\4905\\a8c5c508-06b8-11ea-9b1e-509a4c8d26e3_08870001_4905_10903_287571");
|
return a.exec();
|
||||||
jconverter.save("D:\\test.jpg");
|
|
||||||
// QTextCodec* codec = QTextCodec::codecForName("GB2312");
|
|
||||||
// QTextCodec::setCodecForLocale(codec);
|
|
||||||
//
|
|
||||||
// QApplication a(argc, argv);
|
|
||||||
//
|
|
||||||
// QFont font;
|
|
||||||
// font.setFamily(QString::fromUtf8("Arial"));
|
|
||||||
// QApplication::setFont(font);
|
|
||||||
//
|
|
||||||
// DIDMainWindow w;
|
|
||||||
// w.show();
|
|
||||||
// return a.exec();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ file(GLOB_RECURSE DIDKit_IO_headers ../src/src/IO/*.h)
|
|||||||
file(GLOB_RECURSE DIDKit_IO_cpps ../src/src/IO/*.cpp)
|
file(GLOB_RECURSE DIDKit_IO_cpps ../src/src/IO/*.cpp)
|
||||||
file(GLOB_RECURSE DIDKit_PACS_headers ../src/src/PACS/*.h)
|
file(GLOB_RECURSE DIDKit_PACS_headers ../src/src/PACS/*.h)
|
||||||
file(GLOB_RECURSE DIDKit_PACS_cpps ../src/src/PACS/*.cpp)
|
file(GLOB_RECURSE DIDKit_PACS_cpps ../src/src/PACS/*.cpp)
|
||||||
file(GLOB_RECURSE DIDKit_App_headers App/*.h)
|
file(GLOB_RECURSE DIDKit_App_headers ./*/*.h)
|
||||||
file(GLOB_RECURSE DIDKit_App_cpps App/*.cpp)
|
file(GLOB_RECURSE DIDKit_App_cpps ./*/*.cpp)
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
if (${BUILD_SHARED_LIBS})
|
if (${BUILD_SHARED_LIBS})
|
||||||
include_directories(Defines/)
|
include_directories(Defines/)
|
||||||
endif()
|
endif()
|
||||||
include_directories(../src/src/)
|
include_directories(../src/src/)
|
||||||
|
include_directories(./App/)
|
||||||
|
|
||||||
add_library(DIDKit SHARED ${DIDKit_headers} ${DIDKit_cpps})
|
add_library(DIDKit SHARED ${DIDKit_headers} ${DIDKit_cpps})
|
||||||
|
|
||||||
@@ -20,7 +21,6 @@ set(BUILD_DIDKit_APP ON)
|
|||||||
|
|
||||||
find_package(DCMTK REQUIRED)
|
find_package(DCMTK REQUIRED)
|
||||||
include_directories(${DCMTK_INCLUDE_DIRS})
|
include_directories(${DCMTK_INCLUDE_DIRS})
|
||||||
|
|
||||||
include_directories(${DCM_NETWORK_INCLUDE_DIRS})
|
include_directories(${DCM_NETWORK_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_package(VTK REQUIRED)
|
find_package(VTK REQUIRED)
|
||||||
@@ -33,12 +33,14 @@ target_link_libraries(DIDKit ${VTK_LIBRARIES})
|
|||||||
target_link_libraries(DIDKit dcm_network)
|
target_link_libraries(DIDKit dcm_network)
|
||||||
add_dependencies(DIDKit dcm_network)
|
add_dependencies(DIDKit dcm_network)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE DIDKit_UI ./*/*.ui)
|
||||||
|
qt5_wrap_ui(DIDKit_UI_FILES ${DIDKit_UI})
|
||||||
|
|
||||||
if(${BUILD_DIDKit_APP})
|
if(${BUILD_DIDKit_APP})
|
||||||
add_executable(DIDKitApp ${DIDKit_IO_headers} ${DIDKit_IO_cpps} ${DIDKit_App_headers} ${DIDKit_App_cpps}
|
add_executable(DIDKitApp ${DIDKit_IO_headers} ${DIDKit_IO_cpps} ${DIDKit_App_headers} ${DIDKit_App_cpps} ${DIDKit_PACS_headers} ${DIDKit_PACS_cpps} ${DIDKit_UI_FILES})
|
||||||
${DIDKit_PACS_headers} ${DIDKit_PACS_cpps})
|
|
||||||
target_link_libraries(DIDKitApp ${DCMTK_LIBRARIES})
|
target_link_libraries(DIDKitApp ${DCMTK_LIBRARIES})
|
||||||
target_link_libraries(DIDKitApp ${VTK_LIBRARIES})
|
target_link_libraries(DIDKitApp ${VTK_LIBRARIES})
|
||||||
target_link_libraries(DIDKitApp dcm_network)
|
target_link_libraries(DIDKitApp dcm_network)
|
||||||
add_dependencies(DIDKitApp dcm_network)
|
add_dependencies(DIDKitApp dcm_network)
|
||||||
target_link_libraries(DIDKitApp Qt5::Core Qt5::Widgets Qt5::Gui)
|
target_link_libraries(DIDKitApp Qt5::Core Qt5::Widgets Qt5::Gui)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -82,11 +82,13 @@ void ImageSetStore::addImageSet(ExtendMedicalImageProperties* property) {
|
|||||||
if (study->series->count(series_uid)>0){
|
if (study->series->count(series_uid)>0){
|
||||||
study->series->at(series_uid)->insert({property->GetUniqueID(),property});
|
study->series->at(series_uid)->insert({property->GetUniqueID(),property});
|
||||||
imageProperties.push_back(property);
|
imageProperties.push_back(property);
|
||||||
|
property->Register(placeHolder);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ImageSetMapType* v = new ImageSetMapType;
|
ImageSetMapType* v = new ImageSetMapType;
|
||||||
v->insert({property->GetUniqueID(),property});
|
v->insert({property->GetUniqueID(),property});
|
||||||
study->series->insert({series_uid,v});
|
study->series->insert({series_uid,v});
|
||||||
imageProperties.push_back(property);
|
imageProperties.push_back(property);
|
||||||
|
property->Register(placeHolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,14 +86,10 @@ bool ExtendMedicalImageProperties::RescaledImageDataIsSigned()
|
|||||||
|
|
||||||
void ExtendMedicalImageProperties::GenerateUniqueID() {
|
void ExtendMedicalImageProperties::GenerateUniqueID() {
|
||||||
std::string uniqueID;
|
std::string uniqueID;
|
||||||
uniqueID.append(PatientName);
|
|
||||||
uniqueID.append("_");
|
|
||||||
uniqueID.append(StudyUID);
|
|
||||||
uniqueID.append("_");
|
|
||||||
uniqueID.append(SeriesUID);
|
uniqueID.append(SeriesUID);
|
||||||
uniqueID.append("_");
|
uniqueID.append("_");
|
||||||
char img[200]={0};
|
char img[200]={0};
|
||||||
sprintf(img,"%ld", ImageSetNumber);
|
sprintf(img,"_%ld", ImageSetNumber);
|
||||||
uniqueID.append(img);
|
uniqueID.append(img);
|
||||||
this->SetUniqueID(uniqueID.c_str());
|
this->SetUniqueID(uniqueID.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user