<div dir="ltr">I ahve to work with coronal and sagittal images as well.<br><br>SetViewUpVector works, but the images are turned right-to-left and the images appears all above the window - you have to pan it to view properly.<br>
<br>I think the rotation about the IPP point is the only good solution for this problem.<br><br>Can someone tell me how to rotate vtkImageData about the IPP point.<br><br>It's really driving me nuts!<br><br>Thank you<br>
<br>Jothy <br><br><div class="gmail_quote">On Tue, Mar 1, 2011 at 5:45 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jothy,<br>
<br>
If you work with sagittal and coronal image you will have to worry about<br>
image orientation, but with axial images everything is identity.<br>
<br>
For axial images, just make sure that your camera ViewUp is (0, -1, 0)<br>
and DirectionOfProjection is (0, 0, 1). The direction of projection for<br>
the camera is the (FocalPoint - Position) direction.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
<br>
On Tue, Mar 1, 2011 at 10:36 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
> Hi David,<br>
><br>
> I have given up using vtkImageViewer2 right from the beginign of this<br>
> project!<br>
><br>
> Since it has problem with actors with varying z position - if your actors<br>
> are from cutter ( some go behind the viewer).I am using vtkImageActor with<br>
> vtkImageMapToColors and vtkImageReslice.<br>
><br>
> The match between the dose and CT is perfect, except the view is upside<br>
> down.<br>
><br>
> So you mean there is no point in setting rotation and instead use the camera<br>
> orientation.<br>
><br>
> Thanks<br>
><br>
> Jothy<br>
><br>
> On Tue, Mar 1, 2011 at 5:26 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
>><br>
>> Hi Jothy,<br>
>><br>
>> If your ImageOrientationPatient is 1 0 0 0 1 0 then the direction<br>
>> cosines will be the identity matrix.<br>
>><br>
>> So the image is fine, my guess is that vtkImageViewer2 is the<br>
>> problem. As I've said in other emails, I never use vtkImageViewer2.<br>
>> But digging into its code, I see this:<br>
>><br>
>> case vtkImageViewer2::SLICE_ORIENTATION_XY:<br>
>> cam->SetFocalPoint(0,0,0);<br>
>> cam->SetPosition(0,0,1); // -1 if medical ?<br>
>> cam->SetViewUp(0,1,0);<br>
>> break;<br>
>><br>
>> This view orientation is NOT the proper axial orientation for<br>
>> DICOM patient coordinates. In DICOM, Y increases in the<br>
>> A-P direction (top-down), but vtkImageViewer2 has Y increase<br>
>> from bottom to top.<br>
>><br>
>> I suggest that you give up on vtkImageViewer2. As I've said<br>
>> before, I always use vtkImageActor to display images, and I<br>
>> set the camera orientation myself. And I use FileLowerLeftOn.<br>
>><br>
>> And it is moot now, but the math here is incorrect:<br>
>> reslice->SetElement(0,3,IPP[0]);<br>
>> reslice->SetElement(1,3,IPP[1]);<br>
>> reslice->SetElement(2,3,IPP[2]);<br>
>><br>
>> This applies a translation by IPP after the rotation, which is<br>
>> not the same thing as rotating about IPP.<br>
>><br>
>> - David<br>
>><br>
>><br>
>><br>
>> On Tue, Mar 1, 2011 at 9:58 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
>> > Yes it doesn't rotate at all!<br>
>> ><br>
>> > My axial elements were<br>
>> ><br>
>> > reslice->DeepCopy( imageReader->GetDirectionCosines());<br>
>> > reslice->SetElement(0,3,IPP[0]);<br>
>> > reslice->SetElement(1,3,IPP[1]);<br>
>> > reslice->SetElement(2,3,IPP[2]);<br>
>> ><br>
>> > My images have<br>
>> ><br>
>> > Image position: -275 -524 -122.441<br>
>> > Image Dims: 512 512 98<br>
>> > Image Origin: -275 -524 -122.441<br>
>> > ImageOrient: 1 0 -1.22465e-16 0 1 0<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > But this is changing only the y axis (some translation in Y). But no<br>
>> > rotation.<br>
>> ><br>
>> > Any help is greatly appreciated.<br>
>> ><br>
>> > Thanks again<br>
>> ><br>
>> > Jothy<br>
>> ><br>
>> > On Tue, Mar 1, 2011 at 4:42 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi Jothy,<br>
>> >><br>
>> >> When you say "doesn't rotate the image", do you mean that it does<br>
>> >> nothing at all? What are the elements of your direction cosines<br>
>> >> matrix?<br>
>> >><br>
>> >> Also, note that direction cosines matrix is a pure rotation matrix.<br>
>> >> i.e. it rotates about (0,0,0). You need to create a matrix that<br>
>> >> rotates around a particular point in space.<br>
>> >><br>
>> >> - David<br>
>> >><br>
>> >><br>
>> >> On Tue, Mar 1, 2011 at 9:28 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
>> >> > Thanks!<br>
>> >> ><br>
>> >> > Now my images appeasr like the one shown in figure.<br>
>> >> ><br>
>> >> > I need to rotate the image and dose about the ImagePositionPatient<br>
>> >> > upside-down.<br>
>> >> ><br>
>> >> > I tried vtkImageFlip - it invalidates the dicom coordinate system and<br>
>> >> > the<br>
>> >> > dose and image doesn't match.<br>
>> >> ><br>
>> >> > I tried this<br>
>> >> ><br>
>> >> > vtkMatrix4x4 *invert = vtkMatrix4x4::New();<br>
>> >> ><br>
>> >> > invert->DeepCopy( imageReader->GetDirectionCosines());<br>
>> >> ><br>
>> >> > invert->Invert();<br>
>> >> ><br>
>> >> > vtkImageReslice *reslice = vtkImageReslice::New();<br>
>> >> ><br>
>> >> > reslice->SetResliceAxes( invert );<br>
>> >> ><br>
>> >> > reslice->SetInput(this->imageData);<br>
>> >> ><br>
>> >> > reslice->Update();<br>
>> >> ><br>
>> >> ><br>
>> >> > But it doesn't rotate the image.How to rotate the image?<br>
>> >> ><br>
>> >> > Thanks<br>
>> >> ><br>
>> >> > Jothy<br>
>> >> ><br>
>> >> ><br>
>> >> > On Tue, Mar 1, 2011 at 4:07 PM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
>> >> >><br>
>> >> >> But in this example FileLowerLeft is switched off.<br>
>> >> >><br>
>> >> >> Thanks<br>
>> >> >><br>
>> >> >> Jothy<br>
>> >> >><br>
>> >> >> On Tue, Mar 1, 2011 at 3:50 PM, Mathieu Malaterre<br>
>> >> >> <<a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a>> wrote:<br>
>> >> >>><br>
>> >> >>> jothy, I think what you are looking for is already in gdcm, have a<br>
>> >> >>> look<br>
>> >> >>> at:<br>
>> >> >>> gdcmreslice.cxx<br>
>> >> >>><br>
>> >> >>> hth<br>
>> >> >>> On Tue, Mar 1, 2011 at 4:31 PM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
>> >> >>> > Hi all,<br>
>> >> >>> ><br>
>> >> >>> > I am trying to rotate vtkImageData using vtkMatrix4x4 about a<br>
>> >> >>> > point.<br>
>> >> >>> > is<br>
>> >> >>> > there any example on how to do this?<br>
>> >> >>> ><br>
>> >> >>> > Thanks<br>
>> >> >>> ><br>
>> >> >>> > Jothy<br>
>> >> >>> ><br>
>> >> >>> > _______________________________________________<br>
>> >> >>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> >>> ><br>
>> >> >>> > Visit other Kitware open-source projects at<br>
>> >> >>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> >>> ><br>
>> >> >>> > Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> >>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >> >>> ><br>
>> >> >>> > Follow this link to subscribe/unsubscribe:<br>
>> >> >>> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> >> >>> ><br>
>> >> >>> ><br>
>> >> >>><br>
>> >> >>><br>
>> >> >>><br>
>> >> >>> --<br>
>> >> >>> Mathieu<br>
>> >> >><br>
>> >> ><br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> ><br>
>> >> > Visit other Kitware open-source projects at<br>
>> >> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> ><br>
>> >> > Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >> ><br>
>> >> > Follow this link to subscribe/unsubscribe:<br>
>> >> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>