[Insight-users] ImageToVtkImageFilter +MFC
John Drescher
drescherjm at gmail.com
Thu Jun 17 08:57:02 EDT 2010
2010/6/16 ┭定格Ⅱ╃ <jerry5612897 at foxmail.com>:
> Hi all:
>
> I want to display a dicom Image with ImageToVtkImageFilter(ITK)and
> vtkimageview2(VTK).In 32 console application it's OK!But in a MFC
> Application it can be compiled successfully but when I open a dicom image to
> display,it has a problem!
>
> My codes are as follow,Who can help me to solve this ?
>
> //a menu which opens an image
> void CImg2View::OnImgOpen()
> {
> // TODO: Add your command handler code here
> static char BASED_CODE szFilter[] = "DCM Files (*.dcm)|*.dcm|All Files
> (*.*)|*.*||";
> CFileDialog cFileDialog(TRUE, NULL, NULL, OFN_HIDEREADONLY |
> OFN_OVERWRITEPROMPT, szFilter);
> if (cFileDialog.DoModal() == IDOK)
> {
> m_movName=cFileDialog.GetFileName();
> pipeline();
> }
> }
>
> void CImg2View::pipeline()
> {
> movingImageReader->SetFileName(m_movName);
> // movingImageReader->Update(); !!!!!!!!!!!!!!! here will occur an exception
> connectorMov->SetInput(movingImageReader->GetOutput());
> viewer->SetInput(connectorMov->GetOutput());
> viewer->SetPosition(0,0);
> viewer->SetupInteractor(viewInt);
> viewInt->Initialize();
> viewer->Render();
> }
>
Put the reading of the file in a try {} catch block and see what itk
exception is thrown.
John
More information about the Insight-users
mailing list