|
@@ -65,6 +65,8 @@ public:
|
|
|
|
|
|
void init();
|
|
void init();
|
|
|
|
|
|
|
|
+ void setImage(const QModelIndex& imageIndex);
|
|
|
|
+
|
|
void onPatientModelSelected(const QModelIndex& index);
|
|
void onPatientModelSelected(const QModelIndex& index);
|
|
void onStudyModelSelected(const QModelIndex& index);
|
|
void onStudyModelSelected(const QModelIndex& index);
|
|
void onSeriesModelSelected(const QModelIndex& index);
|
|
void onSeriesModelSelected(const QModelIndex& index);
|
|
@@ -95,18 +97,14 @@ void ctkDICOMDatasetViewPrivate::init()
|
|
}
|
|
}
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
// -------------------------------------------------------------------------
|
|
-void ctkDICOMDatasetViewPrivate::onPatientModelSelected(const QModelIndex &index){
|
|
|
|
|
|
+void ctkDICOMDatasetViewPrivate::setImage(const QModelIndex &imageIndex){
|
|
Q_Q(ctkDICOMDatasetView);
|
|
Q_Q(ctkDICOMDatasetView);
|
|
|
|
|
|
- ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(index.model()));
|
|
|
|
|
|
+ ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(imageIndex.model()));
|
|
|
|
|
|
if(model){
|
|
if(model){
|
|
- QModelIndex patientIndex = index;
|
|
|
|
- QModelIndex studyIndex = patientIndex.child(0,0);
|
|
|
|
- QModelIndex seriesIndex = studyIndex.child(0,0);
|
|
|
|
- model->fetchMore(seriesIndex);
|
|
|
|
- int imageCount = model->rowCount(seriesIndex);
|
|
|
|
- QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
|
|
|
|
+ QModelIndex seriesIndex = imageIndex.parent();
|
|
|
|
+ QModelIndex studyIndex = seriesIndex.parent();
|
|
|
|
|
|
QString thumbnailPath = this->databaseDirectory;
|
|
QString thumbnailPath = this->databaseDirectory;
|
|
thumbnailPath.append("/dicom/").append(model->data(studyIndex ,ctkDICOMModel::UIDRole).toString());
|
|
thumbnailPath.append("/dicom/").append(model->data(studyIndex ,ctkDICOMModel::UIDRole).toString());
|
|
@@ -123,6 +121,26 @@ void ctkDICOMDatasetViewPrivate::onPatientModelSelected(const QModelIndex &index
|
|
}else{
|
|
}else{
|
|
q->clearImages();
|
|
q->clearImages();
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------------------------
|
|
|
|
+void ctkDICOMDatasetViewPrivate::onPatientModelSelected(const QModelIndex &index){
|
|
|
|
+ Q_Q(ctkDICOMDatasetView);
|
|
|
|
+
|
|
|
|
+ ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(index.model()));
|
|
|
|
+
|
|
|
|
+ if(model){
|
|
|
|
+ QModelIndex patientIndex = index;
|
|
|
|
+ model->fetchMore(patientIndex);
|
|
|
|
+ QModelIndex studyIndex = patientIndex.child(0,0);
|
|
|
|
+ model->fetchMore(studyIndex);
|
|
|
|
+ QModelIndex seriesIndex = studyIndex.child(0,0);
|
|
|
|
+ model->fetchMore(seriesIndex);
|
|
|
|
+ int imageCount = model->rowCount(seriesIndex);
|
|
|
|
+ QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
|
|
+
|
|
|
|
+ this->setImage(imageIndex);
|
|
}else{
|
|
}else{
|
|
q->clearImages();
|
|
q->clearImages();
|
|
}
|
|
}
|
|
@@ -136,26 +154,13 @@ void ctkDICOMDatasetViewPrivate::onStudyModelSelected(const QModelIndex &index){
|
|
|
|
|
|
if(model){
|
|
if(model){
|
|
QModelIndex studyIndex = index;
|
|
QModelIndex studyIndex = index;
|
|
|
|
+ model->fetchMore(studyIndex);
|
|
QModelIndex seriesIndex = studyIndex.child(0,0);
|
|
QModelIndex seriesIndex = studyIndex.child(0,0);
|
|
model->fetchMore(seriesIndex);
|
|
model->fetchMore(seriesIndex);
|
|
int imageCount = model->rowCount(seriesIndex);
|
|
int imageCount = model->rowCount(seriesIndex);
|
|
QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
|
|
|
|
- QString thumbnailPath = this->databaseDirectory;
|
|
|
|
- thumbnailPath.append("/dicom/").append(model->data(studyIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(seriesIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(imageIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
-
|
|
|
|
- if (QFile(thumbnailPath).exists())
|
|
|
|
- {
|
|
|
|
- DicomImage dcmImage( thumbnailPath.toStdString().c_str() );
|
|
|
|
- ctkDICOMImage ctkImage( & dcmImage );
|
|
|
|
- q->clearImages();
|
|
|
|
- q->addImage( ctkImage );
|
|
|
|
- this->currentImageIndex = imageIndex;
|
|
|
|
- }else{
|
|
|
|
- q->clearImages();
|
|
|
|
- }
|
|
|
|
|
|
+ this->setImage(imageIndex);
|
|
}else{
|
|
}else{
|
|
q->clearImages();
|
|
q->clearImages();
|
|
}
|
|
}
|
|
@@ -169,26 +174,11 @@ void ctkDICOMDatasetViewPrivate::onSeriesModelSelected(const QModelIndex &index)
|
|
|
|
|
|
if(model){
|
|
if(model){
|
|
QModelIndex seriesIndex = index;
|
|
QModelIndex seriesIndex = index;
|
|
- QModelIndex studyIndex = seriesIndex.parent();
|
|
|
|
model->fetchMore(seriesIndex);
|
|
model->fetchMore(seriesIndex);
|
|
int imageCount = model->rowCount(seriesIndex);
|
|
int imageCount = model->rowCount(seriesIndex);
|
|
QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
QModelIndex imageIndex = seriesIndex.child(imageCount/2,0);
|
|
|
|
|
|
- QString thumbnailPath = this->databaseDirectory;
|
|
|
|
- thumbnailPath.append("/dicom/").append(model->data(studyIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(seriesIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(imageIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
-
|
|
|
|
- if (QFile(thumbnailPath).exists())
|
|
|
|
- {
|
|
|
|
- DicomImage dcmImage( thumbnailPath.toStdString().c_str() );
|
|
|
|
- ctkDICOMImage ctkImage( & dcmImage );
|
|
|
|
- q->clearImages();
|
|
|
|
- q->addImage( ctkImage );
|
|
|
|
- this->currentImageIndex = imageIndex;
|
|
|
|
- }else{
|
|
|
|
- q->clearImages();
|
|
|
|
- }
|
|
|
|
|
|
+ this->setImage(imageIndex);
|
|
}else{
|
|
}else{
|
|
q->clearImages();
|
|
q->clearImages();
|
|
}
|
|
}
|
|
@@ -202,24 +192,8 @@ void ctkDICOMDatasetViewPrivate::onImageModelSelected(const QModelIndex &index){
|
|
|
|
|
|
if(model){
|
|
if(model){
|
|
QModelIndex imageIndex = index;
|
|
QModelIndex imageIndex = index;
|
|
- QModelIndex seriesIndex = imageIndex.parent();
|
|
|
|
- QModelIndex studyIndex = seriesIndex.parent();
|
|
|
|
-
|
|
|
|
- QString thumbnailPath = this->databaseDirectory;
|
|
|
|
- thumbnailPath.append("/dicom/").append(model->data(studyIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(seriesIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
- thumbnailPath.append("/").append(model->data(imageIndex ,ctkDICOMModel::UIDRole).toString());
|
|
|
|
|
|
|
|
- if (QFile(thumbnailPath).exists())
|
|
|
|
- {
|
|
|
|
- DicomImage dcmImage( thumbnailPath.toStdString().c_str() );
|
|
|
|
- ctkDICOMImage ctkImage( & dcmImage );
|
|
|
|
- q->clearImages();
|
|
|
|
- q->addImage( ctkImage );
|
|
|
|
- this->currentImageIndex = imageIndex;
|
|
|
|
- }else{
|
|
|
|
- q->clearImages();
|
|
|
|
- }
|
|
|
|
|
|
+ this->setImage(imageIndex);
|
|
}else{
|
|
}else{
|
|
q->clearImages();
|
|
q->clearImages();
|
|
}
|
|
}
|