[vtkusers] VTKViewer2 shrinks images. How to show them in vtkViewer2 in original size?
Evushka
eva.private at gmail.com
Mon Mar 12 09:59:25 EDT 2012
Hi VTK Users,
I'm using vtkViewer2 to display dicom files. When images are showed in
viewer they are shrinked. Is there some setup to force VTKviewer2 to show
actual size images without shrinking ? More details are given below.
I'm loading DICOM files using itk::ImageSeriesReader, then pass them to
itk::ImageToVTKImageFilter and finally display them using VtkImageViewer2.
Two observers are attached to vtk viewer for
vtkCommand::MouseWheelForwardEvent and for
vtkCommand::MouseWheelBackwardEvent.
Slice image is visible in the vtk viewer and I can scroll between slices.
PROBLEM: loaded image is smaller then its actual size. For example image is
512x512, I'm setting vtk viewer size to 512x512. When image displayed in vtk
viewer its about 400x400 with black frame around, so it's basically
shrinked. Is it something in setup of the vtk viewer I've missed? Please
advise.
Below is my code. Thank you,
Evushka
ITKseriesReader->SetFileNames( vector<string> seriesFileNames );
ITKseriesReader->UpdateLargestPossibleRegion();
int
size=ITKseriesReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0];
//used later to set vtk viewer size
ITKseriesReader->Update();
ITKtoVTKconnector->SetInput(ITKseriesReader->GetOutput());
m_pImageViewer->SetInput(ITKtoVTKconnector->GetOutput());
ResetSize(size,size);
m_pImageViewer->SetColorWindow(255); // Set an initial window that makes
sense for you.
m_pImageViewer->SetColorLevel(128); // Set an initial level that makes
sense for you.
m_pImageViewer->GetRenderer()->ResetCamera();
m_pImageViewer->SetParentId(parent_window);
m_pImageViewer->SetPosition(30,70);
// Add a mouse move obvserver which we will have tell us the pixel value
// under the mouse whenever it moves.
VtkObserverMouseMove *observeMouseMove =
VtkObserverMouseMove::New(m_pImageViewer, m_pIren, m_pPicker,this,
m_pTextInfo->GetTextMapper());
m_pIren->GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonReleaseEvent
, observeMouseMove);
observeMouseMove->Delete();
// Observe mouse wheel messages on the interactor, we want to reinterpret
// that to mean scrolling through the images of the input series.
VtkObserverMouseWheel* observeMouseWheelForward =
VtkObserverMouseWheel::New(m_pImageViewer,this);
m_pIren->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent,
observeMouseWheelForward);
observeMouseWheelForward->Delete();
VtkObserverMouseWheel* observeMouseWheelBackward =
VtkObserverMouseWheel::New(m_pImageViewer,this);
m_pIren->GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent,
observeMouseWheelBackward);
observeMouseWheelBackward->Delete();
--
View this message in context: http://vtk.1045678.n5.nabble.com/VTKViewer2-shrinks-images-How-to-show-them-in-vtkViewer2-in-original-size-tp5557831p5557831.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list