[Insight-users] Re: wxWidgets with ITK/VTK?

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Jul 25 08:53:22 EDT 2005


Ricardo,

	Now that I know you plateform, I'll try to reproduce this bug on my 
side and try to fix it.

Thanks for report,
Mathieu

Ricardo J. Ferrari wrote:
> 
> Thank you guys your prompt answer. I have built VTK/ITK and wxVTK. The 
> only problem now is when I try to run any example comming with the wxVTK 
> I got the following message
> 
> "
> The program 'Sample' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadWindow (invalid Window parameter)'.
>  (Details: serial 7 error_code 3 request_code 2 minor_code 0)
>  (Note to programmers: normally, X errors are reported asynchronously;
>   that is, you will receive the error a while after causing it.
>   To debug your program, run it with the --sync command line
>   option to change this behavior. You can then get a meaningful
>   backtrace from your debugger if you break on the gdk_x_error() function.)
> "
> 
> BTW:  I have installed:  VTK-CVS, ITK-CVS, and wxVTK-0.8, Ubuntu hoary
> 
> If I run the examples using --sync, for example, ./Sample --sync, then 
> it works okay.
> 
> Any idea ?
> 
> Thanks,
> 
> Ricardo
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Wilbur C.K. Wong wrote:
> 
>> Hi Ricardo,
>>
>>  
>>
>>> Does anybody know if there is a simple example available in somewhere
>>> about how to use wxWidgets with ITK/VTK?
>>>   
>>
>>
>> The wxVTKRenderWindowInteractor (available at
>> http://wxvtk.sourceforge.net/) would help to you connect the VTK
>> renderer output to the wxWidgets framework.  This is what I've been
>> using for my research work.
>>
>> I suggest you to use the CMake to generate the makefile/project file
>> that has the information of all the libraries which you need for the
>> software development.
>>
>> Below is an example, hope this can help.
>>
>> PROJECT( MyProject )
>>
>> # Set useful directories path.
>> SET(WXWINDOWS_ROOT C:/wxWindows-2.4.2)
>> SET(WXWINDOWS_CONTRIBUTION_ROOT ${WXWINDOWS_ROOT}/contrib/)
>> SET(WXWINDOWS_LIBRARY_ROOT ${WXWINDOWS_ROOT}/lib)
>>
>> # Find a wxWidgets installation.
>> INCLUDE(${CMAKE_ROOT}/Modules/FindwxWidgets.cmake)
>> IF(WXWINDOWS_INCLUDE_DIR)
>>   INCLUDE_DIRECTORIES(${WXWINDOWS_INCLUDE_DIR})
>> ENDIF(WXWINDOWS_INCLUDE_DIR)
>> IF( WXWINDOWS_LINK_DIRECTORIES )
>>    LINK_DIRECTORIES( ${WXWINDOWS_LINK_DIRECTORIES} )
>> ENDIF( WXWINDOWS_LINK_DIRECTORIES )
>>
>> # Find an ITK installation.
>> INCLUDE(${CMAKE_ROOT}/Modules/FindITK.cmake) IF(ITK_USE_FILE)     
>> INCLUDE(${ITK_USE_FILE}) ENDIF(ITK_USE_FILE)
>>
>> # Find an OpenGL installation.
>> INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake) 
>> INCLUDE(${CMAKE_ROOT}/Modules/FindGLU.cmake)
>>
>> # Find a VTK installation.
>> INCLUDE(${CMAKE_ROOT}/Modules/FindVTK.cmake) IF(VTK_USE_FILE)     
>> INCLUDE(${VTK_USE_FILE}) ENDIF(VTK_USE_FILE)
>> IF( VTK_INCLUDE_DIRS )
>>    INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
>> ENDIF( VTK_INCLUDE_DIRS )
>> IF( VTK_LIBRARY_DIRS )
>>    LINK_DIRECTORIES( ${VTK_LIBRARY_DIRS} )
>> ENDIF( VTK_LIBRARY_DIRS )
>>
>> # Set WIN32 related information.
>> IF( WIN32 )
>>   SET( WIN32_EXECUTABLE WIN32 )
>> ENDIF( WIN32 )
>>
>> INCLUDE_DIRECTORIES(
>>    ${MYPROJECT_SOURCE_DIR}
>>    ${MYPROJECT_SOURCE_DIR}/Src
>>    C:/InsightApplications-1.8.0/vtkITK/Common
>>    )
>>
>> ADD_EXECUTABLE(
>>    MyProject
>>    ${WIN32_EXECUTABLE}
>>    Src/MyProject.cpp
>>    Src/MyProject.rc
>>    )
>>
>> # The VTK libraries to be linked to the target.
>> IF( VTK_FOUND )
>>    SET(VTK_LIBRARIES vtkRendering vtkGraphics vtkHybrid vtkImaging
>>        vtkIO vtkFiltering vtkCommon vtkPatented)
>> ENDIF( VTK_FOUND )
>>
>> # The ITK libraries to be linked to the target.
>> IF( ITK_FOUND )
>>     SET( ITK_LIBRARIES ITKBasicFilters ITKCommon ITKIO ITKNumerics 
>> ITKMetaIO          ITKAlgorithms ITKStatistics )
>> ENDIF( ITK_FOUND )
>>
>> SET(WXWINDOWS_CONTRIBUTION_LIBRARIES ${WXWINDOWS_LIBRARY_ROOT}/plotd)
>> INCLUDE_DIRECTORIES(${WXWINDOWS_CONTRIBUTION_ROOT}/include)
>>
>> TARGET_LINK_LIBRARIES(
>>    MyProject
>>    ${OPENGL_LIBRARY}
>>    ${GLU_LIBRARY}
>>    ${WXWINDOWS_LIBRARIES}
>>    ${WXWINDOWS_CONTRIBUTION_LIBRARIES}
>>    ${VTK_LIBRARIES}
>>    ${ITK_LIBRARIES}
>>    )
>>
>> Best,
>> Wilbur C. K. Wong
>> Ph.D. Student
>> Lo Kwee-Seong Medical Image Analysis Laboratory
>> Computer Science - Hong Kong University of Science & Technology
>> cswilbur "AT" ust "DOT" hk | wilburckwong "AT" gmail "DOT" com
>> http://www.cs.ust.hk/~cswilbur | http://www.wilburwong.ws
>>
>> Medical Image Processing and Analysis | Computer-aided Endovascular
>> Treatment Project
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>  
>>
> 
> 



More information about the Insight-users mailing list