[Insight-users] xxxxxSPAMxxxxx Fw: ITK+VTK+MFC

孙滕 jerry5612897 at tom.com
Fri Jan 8 03:16:23 EST 2010


 


Dear Luis:
     
     Now I need your help!
     
     I had combined ITK and VTK correctly and run the example of myProject in tutorial of Getting started with ITK and VTK.That's OK!I can get what I want.Now I want to use ITK to read some picture and show them in MFC with VTK.I want to convert codes in myProject above to MFC. But there are some problems. I show you my codes as follow.
     
    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(str);                          //str by CFileDialog
    connector->SetInput( reader->GetOutput() );    

    viewerRef = vtkImageViewer::New();
 
    viewerRef->SetInput( connector->GetOutput() );
    viewerRef->SetColorWindow(255);
    viewerRef->SetColorLevel(128); 
 
    CRect rect;
    m_refStatic = &m_picRef;                         //m_refStatic is a CStatic* ,m_picRef too.
    m_refStatic->GetClientRect(&rect);
    viewerRef->SetParentId(m_refStatic->m_hWnd);
    viewerRef->SetPosition(rect.left, rect.top);
    viewerRef->SetSize(100, 100);
    viewerRef->GetRenderWindow()->SetCurrentCursor(9);
    viewerRef->Render();  
  
    These codes can't display a picture correctly,errors are:VTK 5.2\vtk\Imaging\vtkImageImport.cxx, line 324
vtkImageImport (01C95498): Unknown exception.VTK5.2\vtk\Imaging\vtkImageImport.cxx, line 303
vtkImageImport (01C95498): Unknown exception.
 
    Hope your apply! Thank you!
        Jerry 
           




 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100108/aa070eba/attachment.htm>


More information about the Insight-users mailing list