[Insight-users] ResampleImageFilter crashes in release mode

Luis Ibanez luis.ibanez at kitware.com
Mon Jul 6 11:09:10 EDT 2009


Hi Michael,

Thanks for reducing the problem to a minimal
example and posting it to the list.

I have build your code under Linux (Ubuntu)
and ran Valgrind on it.

Found that you were not initializing the pixel
data of the memory buffers passed to the
Import filter, and fixed that.

Also fixed an assignment between smart
pointers that was not compiling under gcc

 TransformType::ConstPointer cversor = iversor;

was replaced with:

 TransformType::ConstPointer cversor = iversor.GetPointer();


although a better solution is to change the API of
your "transformImage" method to take const raw
pointers instead of SmartPointer. (the code was
modified accordingly).

The code runs under Linux, both under Release and
Debug without crashing.

Please find the modified code attached.

(Note that, I put the boolean flag of the import filter
to "true", temporarily, in order to avoid a memory
leak report in Valgrind. You probably want to
put it back to "false" in your code).

Also, note that you will need to copy in the same
directory as the main.cxx, the file:

   Insight/Testing/Code/BasicFilters/itkFilterWatcher.h

This is just to capture progress events.


Please try the attached code and let us know
if that makes any difference when you run it
in your Windows system.



      Regards,


           Luis


---------------------------------------------------------
On Mon, Jul 6, 2009 at 5:39 AM, Michael Schildt <
michael.schildt at ifn-magdeburg.de> wrote:

> Hello Luis,
>
> I checked your points 1) and 3) to 5) but had no luck.
>
> But with 2) i have tracked down the problem to be an interplay of ITK and
> wxWidgets and found a workaround too.
> Basically, when i use an wxSplitterWindow ITK crashes, when commenting the
> wxSlitterWindow stuff out ITK works as expected. I used ITK 3.14, wxPack
> 2.8.9 and Visual Studio 2008 Express Edition.
> I have created a minimal example application (main.cpp, CMakeLists.txt)
> attched at the end of the message that makes this problem reproducable
> without additional dependencies. Running in Release or RelWithDebInfo will
> crash under Windows XP at resampler->Update(). Commenting out line 36
> (m_splitter2 = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition,
> wxDefaultSize, 0 );) will make ITK running smooth without a crash.
>
> And, a workaround was found while trying program on an other  PC. By using
> wxPack 2.8.8 instead of wxPack 2.8.9 the problem is gone. So, a downgrade to
> prior minor Version of wxWidgets is sufficient.
>
> But, i have not really an exmplaination for that. Especially the fact that
> the splitter in not instanciated before ITK runs. Would be nice to find how
> wxWidgets influences ITK!
>
> Best reguards,
>   Michael Schildt
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090706/4bf01a04/attachment.htm>
-------------- next part --------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
IF(COMMAND CMAKE_POLICY)
  CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)


PROJECT(ITKWXWindows)

FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})

FIND_PACKAGE(wxWidgets REQUIRED base core gl net)
INCLUDE(${wxWidgets_USE_FILE})

ADD_EXECUTABLE(itkWxWindows main.cxx )

TARGET_LINK_LIBRARIES(itkWxWindows 
  ITKCommon
  ${wxWidgets_LIBRARIES}
  )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx
Type: text/x-c++src
Size: 4892 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090706/4bf01a04/attachment.cxx>


More information about the Insight-users mailing list