Fix ClearTransformations function.

This commit is contained in:
Krad
2022-07-22 15:50:56 +08:00
parent 0667650ceb
commit a6feaacaf8
2 changed files with 8 additions and 16 deletions

View File

@@ -376,6 +376,8 @@ vtkTypeMacro(infinitiViewer, vtkObject);
void GetSlicePoint(double *point); void GetSlicePoint(double *point);
virtual void UpdateOrientation();
protected: protected:
infinitiViewer(); infinitiViewer();
@@ -391,8 +393,6 @@ protected:
void PrepareFusionColorTable(vtkScalarsToColors *table, bool reset = false); void PrepareFusionColorTable(vtkScalarsToColors *table, bool reset = false);
virtual void UpdateOrientation();
void LoadMeasures() { void LoadMeasures() {
LoadMeasures(false); LoadMeasures(false);
} }

View File

@@ -403,21 +403,21 @@ void DicomImageView::syncEventFunc(vtkObject *, unsigned long eid, void *calldat
int *r = (int *) calldata; int *r = (int *) calldata;
switch (eid) { switch (eid) {
case (vtkCommand::EventIds::EndPanEvent): case (vtkCommand::EventIds::EndPanEvent):
this->onSync(this, VTKIS_IMAGE_PAN, calldata); emit onSync(this, VTKIS_IMAGE_PAN, calldata);
break; break;
case (vtkCommand::EventIds::EndWindowLevelEvent): case (vtkCommand::EventIds::EndWindowLevelEvent):
//update corner info through callback //update corner info through callback
this->onSync(this, VTKIS_IMAGE_WINDOWLEVEL, calldata); emit onSync(this, VTKIS_IMAGE_WINDOWLEVEL, calldata);
break; break;
case (ActorDraggableInteractorStyle::DraggableStyleEvents::EndDollyEvent): case (ActorDraggableInteractorStyle::DraggableStyleEvents::EndDollyEvent):
this->onSync(this, VTKIS_IMAGE_ZOOM, calldata); emit onSync(this, VTKIS_IMAGE_ZOOM, calldata);
break; break;
case (ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent): { case (ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent): {
mScrollBar->SetValueSilently(r[0]); mScrollBar->SetValueSilently(r[0]);
//invoke event //invoke event
double focusPoint[3] = {.0, .0, .0}; double focusPoint[3] = {.0, .0, .0};
mImageViewer->GetSlicePoint(focusPoint); mImageViewer->GetSlicePoint(focusPoint);
this->onSync(this, VTKIS_IMAGE_SLICING, focusPoint); emit onSync(this, VTKIS_IMAGE_SLICING, focusPoint);
break; break;
} }
default: default:
@@ -485,11 +485,10 @@ void DicomImageView::setPanOffset(double *pan) {
} }
} }
//FIXME:这个函数有问题,会导致MPR显示出错
void DicomImageView::resetPanZoom() { void DicomImageView::resetPanZoom() {
if (hasSeries()) { if (hasSeries()) {
mImageViewer->GetRenderer()->ResetCamera();
mImageViewer->ResetZoomScaleToFitWindowSize(); mImageViewer->ResetZoomScaleToFitWindowSize();
} }
} }
@@ -581,15 +580,8 @@ void DicomImageView::rotateImage(double angle, TransFormType operation) {
void DicomImageView::ClearTransformations() { void DicomImageView::ClearTransformations() {
if (hasSeries()) { if (hasSeries()) {
int slice = mImageViewer->GetSlice(); int slice = mImageViewer->GetSlice();
mImageViewer->UpdateOrientation();
resetPanZoom(); resetPanZoom();
double cameraPosition[3];
double vup[3];
mSeries->getCameraCfg(vup, cameraPosition);
//necessary to reset flip and rotate
mImageViewer->GetRenderer()->GetActiveCamera()->SetPosition(cameraPosition);
mImageViewer->GetRenderer()->GetActiveCamera()->SetViewUp(vup);
//avoid black out problem //avoid black out problem
mImageViewer->GetRenderer()->ResetCameraClippingRange(); mImageViewer->GetRenderer()->ResetCameraClippingRange();
mImageViewer->SetSlice(slice); mImageViewer->SetSlice(slice);