[vtkusers] Impossible to fit image in vtkImageViewer2?

itkvtk123 at gmx.net itkvtk123 at gmx.net
Tue Dec 1 15:54:43 EST 2009


Hey guys,

I spent alot time reading the mailing list today and it seems that I am facing a problem which is not solvable at all:
Fitting an image into the vtkImageViewer2 with parallel projection on!

I can easily fit the image with parallel projection set to off, but when I set it to on, the image is always too large.
The parallel scale parameter does not seem to have any influence, no matter if I set it to 0.5 or 20000, the result will always be the same.



My code:

#include "vtkImageViewer2.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPNGReader.h"
#include "vtkRenderer.h"
#include "vtkCamera.h"

int main()
{
	vtkImageViewer2* viewer = vtkImageViewer2::New();
	vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
	viewer->SetupInteractor(iren);

	vtkPNGReader* reader = vtkPNGReader::New();
	reader->SetFileName("C:/BrainProtonDensitySlice.png");
	reader->Update();

	viewer->SetInput(reader->GetOutput());

	viewer->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
	viewer->GetRenderer()->GetActiveCamera()->SetParallelScale(256);

	viewer->Render();
	iren->Start();

	return 0;
}
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser



More information about the vtkusers mailing list