Flip a DICOM Image over the x = y Line

情到浓时终转凉″ 提交于 2019-12-13 05:24:46

问题


I am working on displaying a DICOM image. But it requires me to flip the incoming DICOM image about the x = y line. In other words, I want to rotates the image about the x = y axis with 180 degree

I have found setFlipOverOrigin() from vtkImageFlip. However, it seems not working. Could anyone suggest me a method or how to use setFlipOverOrigin() correctly if it helps.

Thanks in advance.


回答1:


Try using vtkTransform class, and apply a 180 degrees rotation around the axe (1, 1, 0) => x = y = 1 ; z = 0

void vtkTransform::RotateWXYZ   (double angle, double x, double y, double z );

Create a rotation matrix and concatenate it with the current transformation according to PreMultiply or PostMultiply semantics. The angle is in degrees, and (x,y,z) specifies the axis that the rotation will be performed around.

vtkSmartPointer<vtkTransform> rotation = vtkSmartPointer<vtkTransform>::New();
rotation->RotateWXYZ (180, 1.0, 1.0, 0);
// rotation->setInputConnection( DicomReaderImage->GetOutputPort () ); // link your image into your pipeline
rotation->Update ();


来源:https://stackoverflow.com/questions/21236052/flip-a-dicom-image-over-the-x-y-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!