[vtkusers] vtkImageViewer2 loads dicom and displays slices smaller then actual size
Evushka
eva.private at gmail.com
Tue Mar 6 18:04:48 EST 2012
Hi All,
I'm new to vtk and itk and hope you will be able to help me with my problem.
I'll do my best to describe.
I'm loading DICOM files using itk::ImageSeriesReader, then pass them to vtk
by 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: image is loaded 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, so it's basically shrinked. Is it something is
setup of the vtk viewer I've missed? Please advise.
Thank you for your help. Below is my code. Let me know if more detailed code
is necessary to post.
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/vtkImageViewer2-loads-dicom-and-displays-slices-smaller-then-actual-size-tp5542602p5542602.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list