Fix different orientation ImageData fusion bug.
This commit is contained in:
@@ -691,7 +691,7 @@ bool simpleFusionableCheck(vtkImageData *a, vtkImageData *b) {
|
||||
return (origin1[0] == origin2[0]) && (origin1[1] == origin2[1]) && (origin1[2] == origin2[2]);
|
||||
}
|
||||
|
||||
void infinitiViewer::SetFusionInputData(vtkImageData *data) {
|
||||
void infinitiViewer::SetFusionInputData(vtkImageData *data, vtkMatrix4x4* matrix) {
|
||||
if (!this->GetInput()) return;
|
||||
if (!simpleFusionableCheck(data, this->GetInput())) return;
|
||||
if (!this->FusionMapper) {
|
||||
@@ -702,6 +702,12 @@ void infinitiViewer::SetFusionInputData(vtkImageData *data) {
|
||||
FusionMapper->SetInputData(data);
|
||||
this->FusionActor = vtkImageSlice::New();
|
||||
//must set fusion image slice layer to 1 to make main image is active layer of image stack
|
||||
if (matrix){
|
||||
vtkNew<vtkMatrix4x4> userMatrix;
|
||||
userMatrix->DeepCopy(matrix);
|
||||
vtkMatrix4x4::Multiply4x4( WorldToModelMatrix,userMatrix, userMatrix);
|
||||
FusionActor->SetUserMatrix(userMatrix);
|
||||
}
|
||||
FusionActor->GetProperty()->SetLayerNumber(1);
|
||||
FusionActor->SetPickable(false);
|
||||
FusionActor->SetMapper(FusionMapper);
|
||||
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
/**
|
||||
* Set a imageData to fusion with current rendered image.
|
||||
*/
|
||||
void SetFusionInputData(vtkImageData *);
|
||||
void SetFusionInputData(vtkImageData * data, vtkMatrix4x4* matrix = nullptr);
|
||||
//@}
|
||||
|
||||
//@{
|
||||
|
||||
@@ -338,7 +338,7 @@ void DicomImageView::setFusionInput(DicomImageView *overlay) {
|
||||
mOverlayView->OverlayOn();
|
||||
mOverlayView->SetBaseView(this);
|
||||
|
||||
mImageViewer->SetFusionInputData(overlay_data);
|
||||
mImageViewer->SetFusionInputData(overlay_data, overlay->getSeriesInstance()->GetProperty()->GetModelToWorldMatrix());
|
||||
mImageViewer->SetFusionColorLeveL(level);
|
||||
mImageViewer->SetFusionColorWindow(window);
|
||||
mImageViewer->SetFusionOpacity(mImageViewer->GetFusionOpacity());
|
||||
|
||||
Reference in New Issue
Block a user