level 2
vtkTransform.RotateX() 绕x旋转
2020年11月04日 03点11分
2
level 3
楼主的问题解决了吗,对vtkimagedata数据进行旋转平移,特别是要在切片之前旋转平移。不是对actor进行旋转平移。
2021年02月24日 09点02分
3
你好,请问如何在切片之前将vtkimagedata进行旋转平移
2023年04月21日 15点04分
level 1
transform不行的,要使用vtkImageReslice进行旋转和平移。在这个类中设置好4x4的矩阵进行操作,给你个例子:
double axialElements0[16]={ 1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,1 }; vtkSmartPointer<vtkImageReslice> imageReslice0=vtkSmartPointer<vtkImageReslice>::New(); vtkSmartPointer<vtkMatrix4x4> resliceAxies0=vtkSmartPointer<vtkMatrix4x4>::New(); resliceAxies0->DeepCopy(axialElements0); imageReslice0->SetInputData(imageData); imageReslice0->SetInformationInput(imageData); imageReslice0->SetResliceAxes(resliceAxies0); imageReslice0->SetInterpolationModeToLinear(); imageReslice0->Update();
// Get spacing double PixelSpacing[3]; PixelSpacing[0]=dicomReader->GetPixelSpacing()[0]; PixelSpacing[1]=dicomReader->GetPixelSpacing()[1]; PixelSpacing[2]=dicomReader->GetPixelSpacing()[2];
// Set origin and spacing imageReslice0->GetOutput()->SetOrigin(ImagePositionPatient); imageReslice0->GetOutput()->SetSpacing(PixelSpacing);
// Move to the isocenter vtkSmartPointer<vtkImageReslice> imageReslice=vtkSmartPointer<vtkImageReslice>::New(); double axialElements[16]={ 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 }; vtkSmartPointer<vtkMatrix4x4> resliceAxies=vtkSmartPointer<vtkMatrix4x4>::New(); resliceAxies->DeepCopy(axialElements); resliceAxies->SetElement(0,3,iso[0]); resliceAxies->SetElement(1,3,iso[1]); resliceAxies->SetElement(2,3,iso[2]); imageReslice->SetInputData(imageReslice0->GetOutput()); imageReslice->SetInformationInput(imageReslice0->GetOutput()); imageReslice->SetResliceAxes(resliceAxies); imageReslice->SetInterpolationModeToLinear(); imageReslice->Update();
输出是vtkImageData类型
2021年04月16日 04点04分
5