[vtkusers] vtkImageReslice and scaling through vtkTransform.
Anja Ende
anja.ende at googlemail.com
Tue Aug 15 05:59:24 EDT 2006
Hi everyone,
Another one of those endless questions about the vtkImageReslicer.
I am trying to achieve scaling through the vtkImageReslicer by applying the
diagonal scaling matrix through a vtkTransform.
The problem is that the output of the reslicer actually chops the image
along the sides... i.e. cuts off portions of it. This chopping increases as
the scaling increases. I think the reslicer is not returning the full image
size or something like this. I have tried playing with OutputExtent but it
did not help :(
I have the code below. Quite simple, as you can see.
//-------------------------------------------------------------------------------------
QVTKWidget widget;
widget.resize(512, 512);
vtkDICOMImageReader *readerG = vtkDICOMImageReader::New();
readerG->SetDirectoryName("/home/zoyd/data/dicom/11034");
readerG->Update();
// Center the image so that our scaling is uniform.
vtkImageChangeInformation * imageChangeInformation =
vtkImageChangeInformation::New();
imageChangeInformation->SetInput(readerG->GetOutput());
imageChangeInformation->CenterImageOn();
// Scale the image to double the size
vtkTransform * transform = vtkTransform::New();
transform->Identity();
transform->Scale(0.5, 0.5, 0.5);
// VTK reslicer
vtkImageReslice * slicer = vtkImageReslice::New();
slicer->SetResliceTransform(transform);
slicer->SetInput(imageChangeInformation->GetOutput());
slicer->SetOutputDimensionality (2);
slicer->InterpolateOn();
slicer->SetInterpolationModeToCubic();
vtkImageViewer2 * view = vtkImageViewer2::New();
view->SetInput(slicer->GetOutput());
// Not important...
widget.SetRenderWindow(viewer1->GetRenderWindow());
viewer1->SetupInteractor(widget.GetRenderWindow()->GetInteractor());
viewer1->Render();
//-------------------------------------------------------------------------------------
I would really appreciate if someone can help me here. I am truly stuck!!!
Thanks,
Anna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060815/97cdeb87/attachment.htm>
More information about the vtkusers
mailing list