[vtk-developers] FW: Linking a VTK viewer in MFC Application

Sridhar Ponnangatti Masilamani Sridhar.Masilamani at hcl.com
Wed Nov 16 07:54:43 EST 2011



Thanks & Regards,
Sridhar Masilamani
HCL Technologies Ltd.
8&9 G.B. Palya, Off Hosur Road 
Bangalore, KA.(India)- 560068.
Mob: +91-7829822805
www.hcltech.com 
www.hcl.com




-----Original Message-----
From: Sridhar Ponnangatti Masilamani 
Sent: Wednesday, November 16, 2011 6:05 PM
To: 'Leo van Ruijven'
Subject: RE: [vtk-developers] Linking a VTK viewer in MFC Application

Hi Leo,

I right now created a MFC Single Document based application.
I have added this part of the code below.

This code operates when I click a button.

1.Reading an image using ITK.
2.Displaying the image in VTK viewer.
3. I need to embed the VTK viewer inside the MFC picture control.(right now I am getting two windows)
 
 I need to get the VTK window inside a MFC picture control.

void CItkRegMFCDlg::OnBnClickedButton1()
{
	// TODO: Add your control notification handler code here

	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("vhm.401.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();
}


So , as you can see there will two windows popping up. Please find the attached  screen shot related to the output I am getting. 
So, I want the VTK window to appear inside the picture control. As I am new to MFC programming, I request you to kindly provide the steps in order to achieve this.

Thanks ,
Sridhar.



-----Original Message-----
From: Leo van Ruijven [mailto:LvRuijven at gmx.com]
Sent: Wednesday, November 16, 2011 5:40 PM
To: vtk-developers at vtk.org
Cc: Sridhar Ponnangatti Masilamani
Subject: Re: [vtk-developers] Linking a VTK viewer in MFC Application

Hello Sridhar,

I have tried to link several controls with a VTK viewer, but until now I had no success (if somebody else knows how to do this, please post it). So I link the VTK Viewer to the document view (see code below). I call this function in the Create function of the document view. Allthough I used a multiple document interface, I think it will also work for your single document viewS.

void VTK_Image_Pipe::Create(CWnd *Parent, RECT r1) {  IRenWin->SetParentId(Parent->m_hWnd);
 IRenWin->SetPosition(r1.left, r1.top);
 IRenWin->SetSize(r1.right-r1.left, r1.top-r1.bottom);

 iren->Initialize();
 iren->SetRenderWindow(IRenWin);
 IRenWin->Render();
}

Regards,
Leo.




> Message: 6
> Date: Wed, 16 Nov 2011 17:17:51 +0530
> From: Sridhar Ponnangatti Masilamani <Sridhar.Masilamani at hcl.com>
> Subject: Re: [vtk-developers] Linking a VTK viewer in MFC Application
> To: David Cole <david.cole at kitware.com>
> Cc: "vtk-developers at vtk.org" <vtk-developers at vtk.org>
> Message-ID:
> <9CD842E470496C4EB9FD76E837FC5CD426EEB89C37 at CHN-HCLT-EVS09.HCLT.CORP.H
> CL.IN>
> 
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi David,
> 
> I have gone through the specified examples and was able to get the output.
> 
> I am able to get a VTK Viewer and also a MFC window. I am displaying two windows.
> 
> 
> My question is can we integrate a VTK viewer window into a picture control of a MFC application i.e. I want the VTK viewer to be displayed in a single window not displaying as two separate windows?
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: vtk-developers-bounces at vtk.org 
> [mailto:vtk-developers-bounces at vtk.org] On Behalf Of David Cole
> Sent: Wednesday, November 16, 2011 5:08 PM
> To: Sridhar Ponnangatti Masilamani
> Cc: vtk-developers at vtk.org
> Subject: Re: [vtk-developers] Linking a VTK viewer in MFC Application
> 
> Please see the MFC related examples in VTK/Examples/GUI/Win32.
> 
> Adding your ITK support to an app based on one of those examples 
> should be a good start.
> 
> 
> HTH,
> David
> 
> On Wed, Nov 16, 2011 at 12:49 AM, Sridhar Ponnangatti Masilamani 
> <Sridhar.Masilamani at hcl.com> wrote:
> > Hi,
> >
> >
> >
> > I have made a application in which I read an image using ITK, 
> > display it in VTK viewer.
> >
> > I have combined the above two in a MFC Single Document application.
> >
> >
> >
> > So when I click a button on GUI,
> >
> >
> >
> > The image is read in ITK and displayed using a VTK viewer.
> >
> >
> >
> > My concern is I am getting two separate windows i.e. one for the MFC 
> > and the other the VTK viewer.
> >
> >
> >
> > Can we combine the VTK Viewer into an MFC GUI i.e. I want to embed 
> > that VTK viewer my MFC. I don't want two separate windows coming up.
> >
> >
> >
> > Please provide some suggestions on this.
> >
> >
> >
> >
> >
> > 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.
> >
> > --------------------------------------------------------------------
> > ---------------------------------------------------
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at 
> > http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtk-developers
> >
> >
> >
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 
> 
> End of vtk-developers Digest, Vol 91, Issue 13
> **********************************************


L van Ruijven
Functional Anatomy (ACTA)
Gustav Mahlerlaan 3004
1081 LA Amsterdam
Netherlands
Ph. +31(0)20-5980852 (out of office on friday)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ITK AND MFC.jpg
Type: image/jpeg
Size: 109659 bytes
Desc: ITK AND MFC.jpg
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20111116/5db53c9b/attachment-0001.jpg>


More information about the vtk-developers mailing list