[Insight-users] flipped VTK

Shady Shidfar shady_shidfar at yahoo.com
Wed Sep 3 07:02:15 EDT 2008


Thanks Luis,
Well the flipping as suggested by D_E works but, I can't change the camera position, I tried to change the camera position and viewUp but everything gets mixed up. Is there any sample code or something you can refer me too? And also what's the advantage of changing camera location instead of flipping image?

Thanks alot
Shaadi



----- Original Message ----
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Shady Shidfar <shady_shidfar at yahoo.com>
Cc: insight users <insight-users at itk.org>; VTKUsers <vtkusers at vtk.org>
Sent: Tuesday, 2 September, 2008 2:13:44 PM
Subject: Re: [Insight-users] flipped VTK


Hi Shady,

This is a known issue.

It is not really an "ITK problem", nor a "VTK problem".

You simmply have to put your vtkCamera in the right location.

E.g. make the UP vector of the vtkCamera point parallel to (0,1,0).


You are correct in that the itkImageToVTKImageFilter doesn't
make any attempt to flip the images.


    Regards,


        Luis


--------------------
Shady Shidfar wrote:
> Hi Everyone,
>  
> I have a weird problem. I'm using itk to read an image, then convert it 
> to VTK and display it. The problem is that the result displayed image is 
> filpped vertically. I know itk's image origin is at top left and VTK's 
> at bottom right (That's correct, right?), But I thought this would be 
> corrected by itkImageToVTKImageFilter , but it seems it's not. I'm 
> attaching the code. Am I doing anything wrong? or do I have to flip the 
> image every time I want to display the image in VTK???
>  
> I'm not sure if the problem is with ITK or VTK?
>  
> Thanks for your help
>  
> Shaadi
>  
> 
> try
> 
> {
> 
> itkImage_UC3 input = itkImage_UC3.New();
> 
> input.Read("C:/brainCut.tif");
> 
> // Import ITK image to VTK
> 
> itkImageToVTKImageFilter_IUC3 itk2vtk =
> 
> itkImageToVTKImageFilter_IUC3.New();
> 
> itk2vtk.SetInput(input);
> 
> itk2vtk.Update();
> 
> vtkImageData data = itk2vtk.GetOutput();
> 
> vtk.vtkImageActor imageActor= new vtkImageActor();
> 
> imageActor.SetInput(data);
> 
> vtkRenderer renderer = new vtkRenderer();
> 
> renderer.AddActor(imageActor);
> 
> vtkFormsWindowControl1.GetRenderWindow().AddRenderer(renderer);
> 
> vtkFormsWindowControl1.Update();
> 
> }
> 
> catch (Exception ex)
> 
> {
> 
> Console.WriteLine(ex);
> 
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080903/ad5d7ecf/attachment-0001.htm>


More information about the Insight-users mailing list