<br>Hi Rafael,<br><br>It looks like you are attempting to delete <br>an object that was already deleted.<br><br>You may want to run your code in Valgrind.<br><br><br> Regards,<br><br><br> Luis<br><br><br>----------------------------------------------------------------<br>
<div class="gmail_quote">On Wed, Sep 15, 2010 at 8:29 PM, Rafael S. Medeiros <span dir="ltr"><<a href="mailto:rafaelmedeiros.ufpel@gmail.com">rafaelmedeiros.ufpel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br clear="all">Hello,<br><br>I'm trying to write a program with the following code: <br><br>void MaskGenerator::generateOutput(){<br> ThresholdFilterType::Pointer thresholdFilter = ThresholdFilterType::New();<br> thresholdFilter->SetInput(this->mask);<br>
thresholdFilter->SetLowerThreshold(0.5);<br> thresholdFilter->Update();<br> outputImage = thresholdFilter->GetOutput();<br>}<br><br>This is the header of the class:<br><br>#ifndef _RGBTOHSV_H<br>#define _RGBTOHSV_H<br>
<br>#include "itkRGBPixel.h"<br>#include <itkImage.h><br>#include <itkBinaryThresholdImageFilter.h><br><br><br><br>using namespace std;<br><br>class MaskGenerator {<br>public:<br> #define MAX3(r,g,b) ((r)>(g)?((r)>(b)?(r):(b)):((g)>(b)?(g):(b)))<br>
#define MIN3(r,g,b) ((r)<(g)?((r)<(b)?(r):(b)):((g)<(b)?(g):(b)))<br> #define MaskImageDimension 2<br> //-------------------------Public Definitions----------------------<br> typedef itk::RGBPixel< unsigned char > PixelType;<br>
typedef itk::Image< PixelType, MaskImageDimension > ImageType;<br> typedef itk::Image< double, MaskImageDimension > OutImageType;<br> typedef itk::Image< double, MaskImageDimension > MaskImageType;<br>
typedef itk::ImageRegion< MaskImageDimension > RegionType;<br> typedef itk::Size< MaskImageDimension > SizeType;<br> typedef itk::Index< MaskImageDimension > IndexType;<br> typedef MaskGenerator* Pointer;<br>
typedef itk::BinaryThresholdImageFilter< MaskImageType, MaskImageType > ThresholdFilterType;<br> //-------------------------Public Methods--------------------------<br> MaskGenerator();<br> ~MaskGenerator();<br>
OutImageType::Pointer GetOutput();<br> void SetInput(ImageType::Pointer InputImage);<br> void Update();<br> static MaskGenerator::Pointer New();<br><br>private:<br> ImageType::Pointer inputImage;<br> OutImageType::Pointer outputImage;<br>
MaskImageType::Pointer mask;<br><br> double pixelToHSV(PixelType pixel);<br> void generateOutput();<br>};<br>#endif<br><br><br>When i run it I got a Segmentation fault when the thresholdFilter->Update().<br>
Then i tried to save the input of the thresholdFilter in a file to check if it was ok, and I've got the following error:<br>
<br>*** glibc detected *** ./contaGotas: free(): invalid next size (fast): 0x083a5a38 ***<br>======= Backtrace: =========<br>/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x3742591]<br>/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x3743de8]<br>
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x3746ecd]<br>/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x344e741]<br>/usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0x342ac2d]<br>/usr/lib/libstdc++.so.6(_ZNSsD1Ev+0x4c)[0x342c5dc]<br>
/home/rafol/InsightToolkit-3.20.0/bin/libITKCommon.so.3.20(_ZN3itk17ObjectFactoryBase15CreateAllObjectEPKc+0x67)[0x274bc7]<br>/home/rafol/InsightToolkit-3.20.0/bin/libITKCommon.so.3.20(_ZN3itk17ObjectFactoryBase17CreateAllInstanceEPKc+0x78)[0x27357c]<br>
/home/rafol/InsightToolkit-3.20.0/bin/libITKIO.so.3.20(_ZN3itk14ImageIOFactory13CreateImageIOEPKcNS0_12FileModeTypeE+0x3c)[0x5415c0]<br>./contaGotas(_ZN3itk15ImageFileWriterINS_5ImageIdLj2EEEE5WriteEv+0x61f)[0x806dd95]<br>
./contaGotas(_ZN3itk15ImageFileWriterINS_5ImageIdLj2EEEE6UpdateEv+0x1a)[0x806ca58]<br>./contaGotas(_ZN13MaskGenerator14generateOutputEv+0xa8)[0x8069e20]<br>./contaGotas(_ZN13MaskGenerator6UpdateEv+0x1ae)[0x8069a62]<br>./contaGotas(main+0x13e)[0x807c06e]<br>
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x36edbd6]<br>./contaGotas[0x80695a1]<br>======= Memory map: ========<br>00110000-0039f000 r-xp 00000000 08:02 419065 /home/rafol/InsightToolkit-3.20.0/bin/libITKCommon.so.3.20.0<br>
0039f000-003a9000 r--p 0028e000 08:02 419065 /home/rafol/InsightToolkit-3.20.0/bin/libITKCommon.so.3.20.0<br>003a9000-003b0000 rw-p 00298000 08:02 419065 /home/rafol/InsightToolkit-3.20.0/bin/libITKCommon.so.3.20.0<br>
003b0000-003be000 rw-p 00000000 00:00 0 <br>003be000-003dd000 r-xp 00000000 08:02 421826 /home/rafol/InsightToolkit-3.20.0/bin/libITKStatistics.so.3.20.0<br>003dd000-003de000 r--p 0001f000 08:02 421826 /home/rafol/InsightToolkit-3.20.0/bin/libITKStatistics.so.3.20.0<br>
003de000-003df000 rw-p 00020000 08:02 421826 /home/rafol/InsightToolkit-3.20.0/bin/libITKStatistics.so.3.20.0<br>003df000-005fd000 r-xp 00000000 08:02 421987 /home/rafol/InsightToolkit-3.20.0/bin/libITKIO.so.3.20.0<br>
005fd000-005fe000 ---p 0021e000 08:02 421987 /home/rafol/InsightToolkit-3.20.0/bin/libITKIO.so.3.20.0<br>005fe000-00606000 r--p 0021e000 08:02 421987 /home/rafol/InsightToolkit-3.20.0/bin/libITKIO.so.3.20.0<br>00606000-0060a000 rw-p 00226000 08:02 421987 /home/rafol/InsightToolkit-3.20.0/bin/libITKIO.so.3.20.0<br>
0060a000-0060b000 rw-p 00000000 00:00 0 <br>0060b000-00610000 r-xp 00000000 08:02 421592 /home/rafol/InsightToolkit-3.20.0/bin/libitkNetlibSlatec.so.3.20.0<br>00610000-00611000 r--p 00004000 08:02 421592 /home/rafol/InsightToolkit-3.20.0/bin/libitkNetlibSlatec.so.3.20.0<br>
00611000-00612000 rw-p 00005000 08:02 421592 /home/rafol/InsightToolkit-3.20.0/bin/libitkNetlibSlatec.so.3.20.0<br>00612000-0063a000 r-xp 00000000 08:02 420561 /home/rafol/InsightToolkit-3.20.0/bin/libitkjpeg12.so.3.20.0<br>
0063a000-0063b000 r--p 00027000 08:02 420561 /home/rafol/InsightToolkit-3.20.0/bin/libitkjpeg12.so.3.20.0<br>0063b000-0063c000 rw-p 00028000 08:02 420561 /home/rafol/InsightToolkit-3.20.0/bin/libitkjpeg12.so.3.20.0<br>
0063c000-0063f000 r-xp 00000000 08:02 261826 /lib/libuuid.so.1.3.0<br>0063f000-00640000 r--p 00002000 08:02 261826 /lib/libuuid.so.1.3.0<br>00640000-00641000 rw-p 00003000 08:02 261826 /lib/libuuid.so.1.3.0<br>
00642000-0064b000 r-xp 00000000 08:02 421814 /home/rafol/InsightToolkit-3.20.0/bin/libITKBasicFilters.so.3.20.0<br>0064b000-0064c000 r--p 00008000 08:02 421814 /home/rafol/InsightToolkit-3.20.0/bin/libITKBasicFilters.so.3.20.0<br>
0064c000-0064d000 rw-p 00009000 08:02 421814 /home/rafol/InsightToolkit-3.20.0/bin/libITKBasicFilters.so.3.20.0<br>0064d000-0075c000 r-xp 00000000 08:02 421649 /home/rafol/InsightToolkit-3.20.0/bin/libitkgdcm.so.3.20.0<br>
0075c000-0075d000 r--p 0010f000 08:02 421649 /home/rafol/InsightToolkit-3.20.0/bin/libitkgdcm.so.3.20.0<br>0075d000-0076a000 rw-p 00110000 08:02 421649 /home/rafol/InsightToolkit-3.20.0/bin/libitkgdcm.so.3.20.0<br>
0076a000-00788000 r-xp 00000000 08:02 420741 /home/rafol/InsightToolkit-3.20.0/bin/libitkopenjpeg.so.3.20.0<br>00788000-00789000 r--p 0001d000 08:02 420741 /home/rafol/InsightToolkit-3.20.0/bin/libitkopenjpeg.so.3.20.0<br>
00789000-0078a000 rw-p 0001e000 08:02 420741 /home/rafol/InsightToolkit-3.20.0/bin/libitkopenjpeg.so.3.20.0<br>0078a000-007b3000 r-xp 00000000 08:02 420673 /home/rafol/InsightToolkit-3.20.0/bin/libitkpng.so.3.20.0<br>
007b3000-007b4000 r--p 00028000 08:02 420673 /home/rafol/InsightToolkit-3.20.0/bin/libitkpng.so.3.20.0<br>007b4000-007b5000 rw-p 00029000 08:02 420673 /home/rafol/InsightToolkit-3.20.0/bin/libitkpng.so.3.20.0<br>
007b5000-00807000 r-xp 00000000 08:02 420717 /home/rafol/InsightToolkit-3.20.0/bin/libitktiff.so.3.20.0<br>
00807000-00808000 ---p 00052000 08:02 420717 /home/rafol/InsightToolkit-3.20.0/bin/libitktiff.so.3.20.0<br>00808000-00809000 r--p 00052000 08:02 420717 /home/rafol/InsightToolkit-3.20.0/bin/libitktiff.so.3.20.0<br>
00809000-0080a000 rw-p 00053000 08:02 420717 /home/rafol/InsightToolkit-3.20.0/bin/libitktiff.so.3.20.0<br>0080a000-0080b000 r-xp 00000000 08:02 420874 /home/rafol/InsightToolkit-3.20.0/bin/libitkvcl.so.3.20.0<br>
0080b000-0080c000 r--p 00000000 08:02 420874 /home/rafol/InsightToolkit-3.20.0/bin/libitkvcl.so.3.20.0<br>0080c000-0080d000 rw-p 00001000 08:02 420874 /home/rafol/InsightToolkit-3.20.0/bin/libitkvcl.so.3.20.0<br>
0080e000-00843000 r-xp 00000000 08:02 420822 /home/rafol/InsightToolkit-3.20.0/bin/libITKNrrdIO.so.3.20.0<br>
00843000-00844000 r--p 00035000 08:02 420822 /home/rafol/InsightToolkit-3.20.0/bin/libITKNrrdIO.so.3.20.0<br>00844000-00846000 rw-p 00036000 08:02 420822 /home/rafol/InsightToolkit-3.20.0/bin/libITKNrrdIO.so.3.20.0<br>
00846000-00859000 r-xp 00000000 08:02 420652 /home/rafol/InsightToolkit-3.20.0/bin/libitkzlib.so.3.20.0<br>00859000-0085a000 r--p 00012000 08:02 420652 /home/rafol/InsightToolkit-3.20.0/bin/libitkzlib.so.3.20.0<br>
0085a000-0085b000 rw-p 00013000 08:02 420652 /home/rafol/InsightToolkit-3.20.0/bin/libitkzlib.so.3.20.0<br>0085b000-00860000 r-xp 00000000 08:02 421167 /home/rafol/InsightToolkit-3.20.0/bin/libitkv3p_lsqr.so.3.20.0<br>
00860000-00861000 r--p 00004000 08:02 421167 /home/rafol/InsightToolkit-3.20.0/bin/libitkv3p_lsqr.so.3.20.0<br>00861000-00862000 rw-p 00005000 08:02 421167 /home/rafol/InsightToolkit-3.20.0/bin/libitkv3p_lsqr.so.3.20.0<br>
00862000-00864000 r-xp 00000000 08:02 268655 /lib/tls/i686/cmov/<a href="http://libdl-2.11.1.so" target="_blank">libdl-2.11.1.so</a><br>00864000-00865000 r--p 00001000 08:02 268655 /lib/tls/i686/cmov/<a href="http://libdl-2.11.1.so" target="_blank">libdl-2.11.1.so</a><br>
00865000-00866000 rw-p 00002000 08:02 268655 /lib/tls/i686/cmov/<a href="http://libdl-2.11.1.so" target="_blank">libdl-2.11.1.so</a><br>00869000-00891000 r-xp 00000000 08:02 420635 /home/rafol/InsightToolkit-3.20.0/bin/libitkjpeg16.so.3.20.0Aborted<br>
<br>Does anyone knows what it means or how can I fix it?<br>Thank you.<br><div><br></div><div>Rafael Sachett Medeiros<br></div><font color="#888888">--<br>Ciência da Computação - 8º Semestre<br><div>Universidade Federal de Pelotas</div>
<div>Grupo de Computação Gráfica e Procesamento de Imagens - GComGPI</div>
<br>
</font><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>