Add Image Data bounds intersect and orientation check.(Use by ViewManager DoScope::EStudyEBoundsSeries)
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
#include "base/SeriesImageSet.h"
|
#include "base/SeriesImageSet.h"
|
||||||
#include <vtkRendererCollection.h>
|
#include <vtkRendererCollection.h>
|
||||||
#include "view/dicomimageview.h"
|
#include "view/dicomimageview.h"
|
||||||
#include "base/DicomLoader.h"
|
#include "base/DicomLoader.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "ExtendMedicalImageProperties.h"
|
#include "ExtendMedicalImageProperties.h"
|
||||||
|
#include <vtkBoundingBox.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -47,3 +48,20 @@ const char *SeriesImageSet::getStudyUID() const {
|
|||||||
if (!m_property) return nullptr;
|
if (!m_property) return nullptr;
|
||||||
return m_property->GetStudyUID();
|
return m_property->GetStudyUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SeriesImageSet::IntersectWorldBounds(SeriesImageSet *imageSet) {
|
||||||
|
double originOffset[3] = {.0, .0, .0};
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
originOffset[i] = GetProperty()->GetPosition()[i] - imageSet->GetProperty()->GetPosition()[i];
|
||||||
|
}
|
||||||
|
double adjustBounds[6] ={.0,.0,.0,.0,.0,.0};
|
||||||
|
GetData()->GetBounds(adjustBounds);
|
||||||
|
for (int j = 0; j < 6; ++j) {
|
||||||
|
adjustBounds[j] = adjustBounds[j] + originOffset[j/2];
|
||||||
|
}
|
||||||
|
vtkBoundingBox box1;
|
||||||
|
box1.SetBounds(adjustBounds);
|
||||||
|
vtkBoundingBox box2;
|
||||||
|
box2.SetBounds(imageSet->GetData()->GetBounds());
|
||||||
|
return box1.IntersectBox(box2);
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "global/include_vitk.h"
|
#include "global/include_vitk.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IntersectWorldBounds(SeriesImageSet* imageSet);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +52,6 @@ private:
|
|||||||
ExtendMedicalImageProperties* m_property = nullptr;
|
ExtendMedicalImageProperties* m_property = nullptr;
|
||||||
|
|
||||||
std::string m_pUniqueID;
|
std::string m_pUniqueID;
|
||||||
double m_extent;
|
|
||||||
double m_cameraPosition[3];
|
double m_cameraPosition[3];
|
||||||
double m_vup[3];
|
double m_vup[3];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1457,3 +1457,9 @@ void infinitiViewer::UnActiveRuler() {
|
|||||||
rulerActive = false;
|
rulerActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int infinitiViewer::GetWorldSliceOrientation() {
|
||||||
|
double orientations[4]={.0, .0, .0, 1.0};
|
||||||
|
orientations[SliceOrientation] = 1.0;
|
||||||
|
matrix->MultiplyPoint(orientations, orientations);
|
||||||
|
return (int)abs(round(1.0 * orientations[1]) + round(2.0 * orientations[2]));
|
||||||
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
{
|
{
|
||||||
this->SetSliceOrientation(infinitiViewer::SLICE_ORIENTATION_XZ);
|
this->SetSliceOrientation(infinitiViewer::SLICE_ORIENTATION_XZ);
|
||||||
}
|
}
|
||||||
|
int GetWorldSliceOrientation();
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
* Set/Get the current slice to display (depending on the orientation
|
* Set/Get the current slice to display (depending on the orientation
|
||||||
|
|||||||
@@ -54,7 +54,19 @@ void ImageViewManager::smartDo(SmartDoCallback cb, DicomImageView *sourceView, v
|
|||||||
if (!v->HasSeries()) return;
|
if (!v->HasSeries()) return;
|
||||||
//check series
|
//check series
|
||||||
auto series = sourceView->getSeriesInstance();
|
auto series = sourceView->getSeriesInstance();
|
||||||
if (v->getSeriesInstance()==series && v->GetSliceOrientation() == sourceView->GetSliceOrientation()){
|
auto currentSeries = v->getSeriesInstance();
|
||||||
|
//same series
|
||||||
|
if (series == currentSeries
|
||||||
|
//equal slice orientation
|
||||||
|
&& v->GetSliceOrientation() == sourceView->GetSliceOrientation()) {
|
||||||
|
cb(v, callData);
|
||||||
|
}
|
||||||
|
//equal study
|
||||||
|
else if (strcmp(currentSeries->getStudyUID(), series->getStudyUID()) == 0
|
||||||
|
//equal world slice orientation
|
||||||
|
&& v->CompareWorldSliceOrientation(sourceView)
|
||||||
|
//Intersect bounds
|
||||||
|
&& currentSeries->IntersectWorldBounds(series)) {
|
||||||
cb(v, callData);
|
cb(v, callData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ public:
|
|||||||
void SetSliceOrientation(int orientation);
|
void SetSliceOrientation(int orientation);
|
||||||
int GetSliceOrientation();
|
int GetSliceOrientation();
|
||||||
|
|
||||||
|
bool CompareWorldSliceOrientation(DicomImageView* view){
|
||||||
|
return this->_ImageViewer->GetWorldSliceOrientation() == view->_ImageViewer->GetWorldSliceOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* This signal will be emitted whenever a mouse event occurs within the QVTK window.
|
* This signal will be emitted whenever a mouse event occurs within the QVTK window.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "viewcontainerwidget.h"
|
#include "viewcontainerwidget.h"
|
||||||
#include "thumbnailImage.h"
|
#include "thumbnailImage.h"
|
||||||
#include "DicomLoader.h"
|
#include "DicomLoader.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@@ -377,14 +377,6 @@ void ViewContainerWidget::removeCurrentViewWithFusion()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compareDoubleArray(double* a, double* b, int valCount){
|
|
||||||
static const double m = 1.0;
|
|
||||||
for (int i = 0; i < valCount; i++){
|
|
||||||
if (fabs(a[i]-b[i])>m) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ViewContainerWidget::checkFusionStatus(DicomImageView *base, DicomImageView* overlap)
|
bool ViewContainerWidget::checkFusionStatus(DicomImageView *base, DicomImageView* overlap)
|
||||||
{
|
{
|
||||||
SeriesImageSet* baseSeries = base->getSeriesInstance();
|
SeriesImageSet* baseSeries = base->getSeriesInstance();
|
||||||
@@ -396,13 +388,7 @@ bool ViewContainerWidget::checkFusionStatus(DicomImageView *base, DicomImageView
|
|||||||
strcmp(baseSeries->getStudyUID(), overlapSeries->getStudyUID())!=0) return false;
|
strcmp(baseSeries->getStudyUID(), overlapSeries->getStudyUID())!=0) return false;
|
||||||
//same series
|
//same series
|
||||||
if (baseSeries->GetSeriesNumber() == overlapSeries->GetSeriesNumber()) return false;
|
if (baseSeries->GetSeriesNumber() == overlapSeries->GetSeriesNumber()) return false;
|
||||||
//diff position
|
return baseSeries->IntersectWorldBounds(overlapSeries);
|
||||||
if (!compareDoubleArray(baseSeries->GetProperty()->GetPosition(),overlapSeries->GetProperty()->GetPosition(),3)) return false;
|
|
||||||
//diff orientation
|
|
||||||
if (!compareDoubleArray(baseSeries->GetProperty()->GetDirectionCosine(),overlapSeries->GetProperty()->GetDirectionCosine(),6)) return false;
|
|
||||||
//diff bounds
|
|
||||||
if (!compareDoubleArray(baseSeries->GetData()->GetBounds(), overlapSeries->GetData()->GetBounds(),6)) return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewContainerWidget::updateCornerInfoAll() {
|
void ViewContainerWidget::updateCornerInfoAll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user