[vtkusers] stretching

Renaud Isabelle renauisa at yahoo.fr
Thu May 26 15:01:33 EDT 2005


Thanks, Luis, for your advice. I took a look at the example supplied in ImageSliceViewer. And I implement what is inside SetupCamera().
 
However, where I am going really crazy :-D, is that all lines of code that I am implementing is not taken into account. The result is still the same. 
 
Here is what I did:
 
//(vtkImageViewer*) viewer
imageInitiale = reader->GetOutput();
viewer->SetInput(imageInitiale);
 
 //display the image in the frame
 viewer->SetParentId(this->m_hWnd);
 
 //to fit the image to the render window, 
 float spacing[3] = {imageInitiale->GetSpacing()[0], 
      imageInitiale->GetSpacing()[1],
      imageInitiale->GetSpacing()[2]};
 double max = MAX(spacing[0]*width,spacing[1]*height);

 vtkCamera* camera = viewer->GetRenderer()->GetActiveCamera();
 viewer->GetRenderer()->ResetCamera();
 camera->ParallelProjectionOn();
 camera->SetParallelScale(max/2);
 
 //execute
 viewer->Render();
 
What`s wrong with that?
 
Isabelle
 

Luis Ibanez <luis.ibanez at kitware.com> a écrit:

Hi Isabelle,


Thanks for letting us know that you were using
VTK for visualization.

...You should have said that from the beginning :-)



Please look at the code in the file


ImageSliceViewer.cxx


in the directory

InsightApplications/
LiverTumorSegmentation/


http://www.itk.org/cgi-bin/viewcvs.cgi/LiverTumorSegmentation/ImageSliceViewer.cxx?rev=1.3&root=InsightApplications&view=log


You will see in this class how to manage
the scale of your image in the method
SetupCamera(), in lines 118-185.



BTW, I'm assuming that you want to stretch the
image *WITHOUT* changing its aspect ratio. You
probably don't want to change the aspect ratio
of a Medical Image.


Note that *iff* your image has correctly specified
its pixel size in X and Y. VTK will take this pixel
size into account at the moment of rendering the
image.



Regards,


Luis



------------------------
Renaud Isabelle wrote:
> Hi everybody,
> 
> My job is to implement an MFC interface for medical image segmentation 
> purposes. Before, my lab was working on Matlab to display their data. 
> Default behavior of matlab is to display my image in parallel mode and 
> stretch the image to fill the best my window. It was a convenient way to 
> see our 1552*128 images. That is exactly what I want to reproduce in my 
> interface.
> 
> So, what I am desperately trying to do is to stretch my image (different 
> scale factors in x and y) to fit my render window.
> 
> viewer->GetRenderer()->GetActiveCamera()->*ParallelProjectionOn*() is 
> OK, but
> viewer->GetRenderer()->GetActiveCamera()->*SetParallelScale*() scale 
> not stretch my image.
> There should be a way to stretch. 
> 
> Isabelle
> 
> ------------------------------------------------------------------------
> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos 
> mails, photos et vidéos !
> Créez votre Yahoo! Mail 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




		
---------------------------------
 Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vidéos !
Créez votre Yahoo! Mail  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050526/738a031d/attachment-0001.htm>


More information about the vtkusers mailing list