Domanda

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.

È stato utile?

Soluzione

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 ();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top