[vtk-developers] Reg:Embed a VTK viewer in a MFC application
Sridhar Ponnangatti Masilamani
Sridhar.Masilamani at hcl.com
Thu Nov 17 08:43:56 EST 2011
Hi,
I created a MFC SDI application in which I read an image using ITK, display it through a VTK viewer.
So, when I run the application I get two windows ,one for the MFC dialog and the other VTK viewer.
So in order to get the VTK viewer embedded into the MFC application , I need some suggestions on this.
At the end my VTK viewer has to sit on the MFC GUI Application i.e it must be displayed as a single window.
Please provide some suggestions on this as I am pretty new to MFC programming.
Also is it possible to link a VTK viewer into a MFC application or any other approach is to be followed.
Please find below the code related to it.
void CItkRegMFCView::OnFileOpen()
{
// TODO: Add your command handler code here
// Added By Sridhar on 14/11/2011
typedef itk::Image <unsigned short, 2> ImageType;
typedef itk::ImageFileReader<ImageType>ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType>FilterType;
ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer connector = FilterType::New();
reader->SetFileName("Fig6.35(3)newsize.bmp");
connector->SetInput(reader->GetOutput());
vtkImageViewer *viewer = vtkImageViewer::New();
vtkRenderWindowInteractor *renderWindowInteractor = vtkRenderWindowInteractor::New();
viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput(connector->GetOutput());
viewer->Render();
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);//128
renderWindowInteractor->Start();
}
Awaiting your replies.
Regards,
Sridhar.
________________________________
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20111117/5a06e329/attachment.html>
More information about the vtk-developers
mailing list