Use SyncSlicePoint instead of SyncSliceWithPage.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#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"
|
||||||
@@ -51,18 +51,33 @@ const char *SeriesImageSet::getStudyUID() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SeriesImageSet::IntersectWorldBounds(SeriesImageSet *imageSet) {
|
bool SeriesImageSet::IntersectWorldBounds(SeriesImageSet *imageSet) {
|
||||||
double originOffset[3] = {.0, .0, .0};
|
double bounds[6] ={.0,.0,.0,.0,.0,.0};
|
||||||
for (int i = 0; i < 3; ++i) {
|
imageSet->GetData()->GetBounds(bounds);
|
||||||
originOffset[i] = GetProperty()->GetPosition()[i] - imageSet->GetProperty()->GetPosition()[i];
|
double minP[4] ={bounds[0],bounds[2], bounds[4], 1.0};
|
||||||
}
|
double maxP[4] ={bounds[1],bounds[3], bounds[5], 1.0};
|
||||||
double adjustBounds[6] ={.0,.0,.0,.0,.0,.0};
|
imageSet->GetProperty()->GetModelToWorldMatrix()->MultiplyPoint(minP,minP);
|
||||||
GetData()->GetBounds(adjustBounds);
|
imageSet->GetProperty()->GetModelToWorldMatrix()->MultiplyPoint(maxP,maxP);
|
||||||
for (int j = 0; j < 6; ++j) {
|
bounds[0] = min(minP[0],maxP[0]);
|
||||||
adjustBounds[j] = adjustBounds[j] + originOffset[j/2];
|
bounds[1] = max(minP[0],maxP[0]);
|
||||||
}
|
bounds[2] = min(minP[1],maxP[1]);
|
||||||
|
bounds[3] = max(minP[1],maxP[1]);
|
||||||
|
bounds[4] = min(minP[2],maxP[2]);
|
||||||
|
bounds[5] = max(minP[2],maxP[2]);
|
||||||
|
double cBounds[6] ={.0,.0,.0,.0,.0,.0};
|
||||||
|
GetData()->GetBounds(cBounds);
|
||||||
|
double minP2[4] ={cBounds[0], cBounds[2], cBounds[4], 1.0};
|
||||||
|
double maxP2[4] ={cBounds[1], cBounds[3], cBounds[5], 1.0};
|
||||||
|
GetProperty()->GetModelToWorldMatrix()->MultiplyPoint(minP2,minP2);
|
||||||
|
GetProperty()->GetModelToWorldMatrix()->MultiplyPoint(maxP2,maxP2);
|
||||||
|
cBounds[0] = min(minP2[0], maxP2[0]);
|
||||||
|
cBounds[1] = max(minP2[0],maxP2[0]);
|
||||||
|
cBounds[2] = min(minP2[1], maxP2[1]);
|
||||||
|
cBounds[3] = max(minP2[1], maxP2[1]);
|
||||||
|
cBounds[4] = min(minP2[2], maxP2[2]);
|
||||||
|
cBounds[5] = max(minP2[2], maxP2[2]);
|
||||||
vtkBoundingBox box1;
|
vtkBoundingBox box1;
|
||||||
box1.SetBounds(adjustBounds);
|
box1.SetBounds(bounds);
|
||||||
vtkBoundingBox box2;
|
vtkBoundingBox box2;
|
||||||
box2.SetBounds(imageSet->GetData()->GetBounds());
|
box2.SetBounds(cBounds);
|
||||||
return box1.IntersectBox(box2);
|
return box1.IntersectBox(box2);
|
||||||
}
|
}
|
||||||
@@ -628,7 +628,31 @@ void infinitiViewer::ChangeSlice(vtkObject *, unsigned long eventid, void *calld
|
|||||||
}
|
}
|
||||||
|
|
||||||
void infinitiViewer::SyncSlicePoint(double * point) {
|
void infinitiViewer::SyncSlicePoint(double * point) {
|
||||||
//TODO:SyncSlicePoint with different series in same study
|
double focusPoint[4] = {.0, .0, .0, 1.0};
|
||||||
|
focusPoint[0] = point[0] - imageDataOrigin[0];
|
||||||
|
focusPoint[1] = point[1] - imageDataOrigin[1];
|
||||||
|
focusPoint[2] = point[2] - imageDataOrigin[2];
|
||||||
|
matrix->Invert();
|
||||||
|
matrix->MultiplyPoint(focusPoint, focusPoint);
|
||||||
|
matrix->Invert();
|
||||||
|
double f[3] = {.0, .0, .0};
|
||||||
|
Renderer->GetActiveCamera()->GetFocalPoint(f);
|
||||||
|
double bounds[6] = {.0, .0, .0, .0, .0, .0};
|
||||||
|
ImageMapper->GetBounds(bounds);
|
||||||
|
f[SliceOrientation] = focusPoint[SliceOrientation];
|
||||||
|
Renderer->GetActiveCamera()->SetFocalPoint(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void infinitiViewer::GetSlicePoint(double * point) {
|
||||||
|
double focusPoint[4] = {.0, .0, .0, 1.0};
|
||||||
|
Renderer->GetActiveCamera()->GetFocalPoint(focusPoint);
|
||||||
|
matrix->MultiplyPoint(focusPoint, focusPoint);
|
||||||
|
focusPoint[0] += imageDataOrigin[0];
|
||||||
|
focusPoint[1] += imageDataOrigin[1];
|
||||||
|
focusPoint[2] += imageDataOrigin[2];
|
||||||
|
point[0] = focusPoint[0];
|
||||||
|
point[1] = focusPoint[1];
|
||||||
|
point[2] = focusPoint[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkSmartPointer<vtkPoints> infinitiViewer::GetSliceBoundPoints(){
|
vtkSmartPointer<vtkPoints> infinitiViewer::GetSliceBoundPoints(){
|
||||||
@@ -1055,7 +1079,7 @@ vtkTypeBool infinitiViewer::GetOffScreenRendering()
|
|||||||
void infinitiViewer::SetInputData(vtkImageData* in)
|
void infinitiViewer::SetInputData(vtkImageData* in)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("fusion origin:%f,%f,%f", in->GetOrigin()[0], in->GetOrigin()[1], in->GetOrigin()[2]);
|
printf("fusion imageDataOrigin:%f,%f,%f", in->GetOrigin()[0], in->GetOrigin()[1], in->GetOrigin()[2]);
|
||||||
printf("fusion spacing:%f,%f,%f", in->GetSpacing()[0], in->GetSpacing()[1], in->GetSpacing()[2]);
|
printf("fusion spacing:%f,%f,%f", in->GetSpacing()[0], in->GetSpacing()[1], in->GetSpacing()[2]);
|
||||||
#endif
|
#endif
|
||||||
this->FirstRender = 1;
|
this->FirstRender = 1;
|
||||||
@@ -1362,17 +1386,22 @@ void infinitiViewer::initCornerInfo(ExtendMedicalImageProperties* pSeries)
|
|||||||
|
|
||||||
|
|
||||||
matrix->Zero();
|
matrix->Zero();
|
||||||
matrix->SetElement(0, 0, xVector[0]);
|
matrix->SetElement( 0,0, xVector[0]);
|
||||||
matrix->SetElement(0, 1, xVector[1]);
|
matrix->SetElement( 1,0, xVector[1]);
|
||||||
matrix->SetElement(0, 2, xVector[2]);
|
matrix->SetElement( 2,0, xVector[2]);
|
||||||
matrix->SetElement(1, 0, yVector[0]);
|
matrix->SetElement( 0,1, yVector[0]);
|
||||||
matrix->SetElement(1, 1, yVector[1]);
|
matrix->SetElement( 1,1, yVector[1]);
|
||||||
matrix->SetElement(1, 2, yVector[2]);
|
matrix->SetElement( 2,1, yVector[2]);
|
||||||
matrix->SetElement(2, 0, zVector[0]);
|
matrix->SetElement( 0,2, zVector[0]);
|
||||||
matrix->SetElement(2, 1, zVector[1]);
|
matrix->SetElement( 1,2, zVector[1]);
|
||||||
matrix->SetElement(2, 2, zVector[2]);
|
matrix->SetElement( 2,2, zVector[2]);
|
||||||
matrix->SetElement(3, 3, 1);
|
matrix->SetElement( 3,3, 1);
|
||||||
matrix->Invert();
|
// matrix->Invert();
|
||||||
|
|
||||||
|
double* p = pSeries->GetPosition();
|
||||||
|
imageDataOrigin[0] = p[0];
|
||||||
|
imageDataOrigin[1] = p[1];
|
||||||
|
imageDataOrigin[2] = p[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
int getOrientationIndex(double* v){
|
int getOrientationIndex(double* v){
|
||||||
@@ -1467,3 +1496,4 @@ int infinitiViewer::GetWorldSliceOrientation() {
|
|||||||
matrix->MultiplyPoint(orientations, orientations);
|
matrix->MultiplyPoint(orientations, orientations);
|
||||||
return (int)abs(round(1.0 * orientations[1]) + round(2.0 * orientations[2]));
|
return (int)abs(round(1.0 * orientations[1]) + round(2.0 * orientations[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ public:
|
|||||||
return &raiser;
|
return &raiser;
|
||||||
}
|
}
|
||||||
void SyncSlicePoint(double* point);
|
void SyncSlicePoint(double* point);
|
||||||
|
void GetSlicePoint(double* point);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
infinitiViewer();
|
infinitiViewer();
|
||||||
@@ -370,11 +371,6 @@ protected:
|
|||||||
void RemoveMeasures(vtkObject*,unsigned long eventid,void* calldata );
|
void RemoveMeasures(vtkObject*,unsigned long eventid,void* calldata );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateTopLeftCornerInfo();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
infinitiViewer(const infinitiViewer&) = delete;
|
infinitiViewer(const infinitiViewer&) = delete;
|
||||||
void operator=(const infinitiViewer&) = delete;
|
void operator=(const infinitiViewer&) = delete;
|
||||||
std::vector<std::vector<double>> fusion_tf_vector;
|
std::vector<std::vector<double>> fusion_tf_vector;
|
||||||
@@ -387,10 +383,10 @@ private:
|
|||||||
void raiseEvent(vtkObject* sender,unsigned long eventId,void* callData = nullptr){
|
void raiseEvent(vtkObject* sender,unsigned long eventId,void* callData = nullptr){
|
||||||
raiser.raiseEvent(sender,eventId,callData);
|
raiser.raiseEvent(sender,eventId,callData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCurrentSliceMeasure() const;
|
void ClearCurrentSliceMeasure() const;
|
||||||
|
|
||||||
void ReloadCurrentSliceMeasure();
|
void ReloadCurrentSliceMeasure();
|
||||||
|
void updateTopLeftCornerInfo();
|
||||||
|
|
||||||
vtkNew<RulerLegendActor> ruler;
|
vtkNew<RulerLegendActor> ruler;
|
||||||
bool rulerActive = false;
|
bool rulerActive = false;
|
||||||
void RenderRuler();
|
void RenderRuler();
|
||||||
@@ -399,6 +395,7 @@ private:
|
|||||||
int viewRightIndex = 1;
|
int viewRightIndex = 1;
|
||||||
DicomCornerInfo m_cornerInfo;
|
DicomCornerInfo m_cornerInfo;
|
||||||
char SOP_UID[20]={0};
|
char SOP_UID[20]={0};
|
||||||
|
double imageDataOrigin[3] = {.0, .0, .0};
|
||||||
vtkNew<vtkMatrix4x4> matrix;
|
vtkNew<vtkMatrix4x4> matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "view/dicomimageview.h"
|
#include "view/dicomimageview.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "view/thumbnailImage.h"
|
#include "view/thumbnailImage.h"
|
||||||
@@ -111,16 +111,12 @@ void DicomImageView::Slot_scrollValueChanged(int slice)
|
|||||||
}
|
}
|
||||||
case(scrollScope::TriggerType::STYLE_TRIGGER):
|
case(scrollScope::TriggerType::STYLE_TRIGGER):
|
||||||
{
|
{
|
||||||
|
qDebug()<<"======>>";
|
||||||
_ImageViewer->updateCornerInfo(TOP_LEFT);
|
_ImageViewer->updateCornerInfo(TOP_LEFT);
|
||||||
//invoke event
|
//invoke event
|
||||||
_SliceStep = slice - _PrevSlice;
|
double focusPoint[3] = {.0, .0, .0};
|
||||||
_PrevSlice = slice;
|
_ImageViewer->GetSlicePoint(focusPoint);
|
||||||
//emit Signal_scrollValueChanged(this, slice);
|
this->Signal_SyncEvent(this, VTKIS_IMAGE_SLICING, focusPoint);
|
||||||
int sliceArray[2];
|
|
||||||
sliceArray[0] = slice;
|
|
||||||
sliceArray[1] = _SliceStep;
|
|
||||||
|
|
||||||
this->Signal_SyncEvent(this, VTKIS_IMAGE_SLICING, sliceArray);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(scrollScope::TriggerType::SYNC_ONLY):
|
case(scrollScope::TriggerType::SYNC_ONLY):
|
||||||
@@ -847,3 +843,10 @@ int DicomImageView::GetSliceOrientation() {
|
|||||||
void DicomImageView::viewerClicked() {
|
void DicomImageView::viewerClicked() {
|
||||||
emit Signal_ViewClicked(this);
|
emit Signal_ViewClicked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DicomImageView::SyncScrollBar() {
|
||||||
|
setScrollChangedType(scrollScope::TriggerType::SYNC_ONLY);
|
||||||
|
_scrollBar->setValue(_ImageViewer->GetSlice());
|
||||||
|
_ImageViewer->updateCornerInfo(TOP_LEFT);
|
||||||
|
setScrollChangedType(scrollScope::TriggerType::USER_TRIGGER);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QOpenGLWidget>
|
#include <QOpenGLWidget>
|
||||||
#include "ClickableScrollBar.h"
|
#include "ClickableScrollBar.h"
|
||||||
@@ -98,6 +98,7 @@ public:
|
|||||||
void SetSlice(int slice);
|
void SetSlice(int slice);
|
||||||
void SetZoomScale(double scale);
|
void SetZoomScale(double scale);
|
||||||
void SetPanOffset(double * p);
|
void SetPanOffset(double * p);
|
||||||
|
void SyncScrollBar();
|
||||||
|
|
||||||
//CineMode
|
//CineMode
|
||||||
void onFirstFrame();
|
void onFirstFrame();
|
||||||
@@ -130,7 +131,10 @@ public:
|
|||||||
bool CompareWorldSliceOrientation(DicomImageView* view){
|
bool CompareWorldSliceOrientation(DicomImageView* view){
|
||||||
return this->_ImageViewer->GetWorldSliceOrientation() == view->_ImageViewer->GetWorldSliceOrientation();
|
return this->_ImageViewer->GetWorldSliceOrientation() == view->_ImageViewer->GetWorldSliceOrientation();
|
||||||
}
|
}
|
||||||
|
void SyncSlicePoint(double* point){
|
||||||
|
_ImageViewer->SyncSlicePoint(point);
|
||||||
|
_ImageViewer->Render();
|
||||||
|
}
|
||||||
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.
|
||||||
|
|||||||
@@ -70,10 +70,9 @@ void ViewContainerWidget::Slot_SyncEvent(DicomImageView *view, int interactionMo
|
|||||||
{
|
{
|
||||||
manager.smartDo([](auto v,auto callData){
|
manager.smartDo([](auto v,auto callData){
|
||||||
if (v->HasSeries()) {
|
if (v->HasSeries()) {
|
||||||
int *r = (int *) callData;
|
double* r = (double*) callData;
|
||||||
v->setScrollChangedType(scrollScope::TriggerType::SYNC_ONLY);
|
v->SyncSlicePoint(r);
|
||||||
v->SetSlice(r[0]);
|
v->SyncScrollBar();
|
||||||
v->setScrollChangedType(scrollScope::TriggerType::USER_TRIGGER);
|
|
||||||
}
|
}
|
||||||
},view, calldata,ImageViewManager::EStudyEBoundsSeries);
|
},view, calldata,ImageViewManager::EStudyEBoundsSeries);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user