<font color="#660000"><font face="verdana,sans-serif">Dear members,</font></font><div><font color="#660000"><font face="verdana,sans-serif"><br></font></font></div><div><font color="#660000"><font face="verdana,sans-serif">My purpose is to search connected components on single slices of a 3d volume (then compare the results), therefore I thought SliceBySliceImageFilter would be a good choice to do this. I have 14 binary volumes, but by the half of the images my program crashes with glibc errors.</font></font></div>
<div><font color="#660000"><font face="verdana,sans-serif"><br></font></font></div><div><font color="#660000"><font face="verdana,sans-serif">My source is the following:</font></font></div><div><font color="#660000"><font face="verdana,sans-serif"><br>
</font></font></div><div><font color="#660000"><font face="verdana,sans-serif">// I have a reader to read the input</font></font></div><div><span class="Apple-style-span" style="font-family: verdana, sans-serif; color: rgb(102, 0, 0); "><br>
</span></div><div><span class="Apple-style-span" style="font-family: verdana, sans-serif; color: rgb(102, 0, 0); ">typedef itk::ConnectedComponentImageFilter<ShortImageType, ShortImageType, ShortImageType> ComponentFilterType;</span></div>
<div><font color="#660000"><font face="verdana,sans-serif"><div>ComponentFilterType::Pointer conn = ComponentFilterType::New();</div><div>conn->SetInput( reader->GetOutput() );</div><div><br></div><div>typedef itk::RelabelComponentImageFilter<ShortImageType, ShortImageType> RelabelFilterType;</div>
<div>RelabelFilterType::Pointer relabel = RelabelFilterType::New();</div><div>relabel->SetInput( conn->GetOutput() );</div><div><br></div><div>for ( int i = 0; i <=2; ++i ) {</div><div><br></div><div> std::cerr << i;</div>
<div><br></div><div><div> typedef itk::SliceBySliceImageFilter<ShortImageType, ShortImageType, ComponentFilterType, RelabelFilterType, ShortImageType, ShortImageType> SliceFilterType; </div><div> SliceFilterType::Pointer slicer = SliceFilterType::New();</div>
<div> slicer->SetInput( reader->GetOutput() );</div><div> slicer->SetInputFilter( conn );</div><div> slicer->SetOutputFilter( relabel ); </div><div> slicer->SetDimension( i );</div><div> slicer->Update();</div>
</div><div><br></div><div><div> std::cerr << " done." << std::endl;</div><div><br></div><div>} // endfor</div></div><div><br></div><div>return EXIT_SUCCESS;</div><div><br></div><div>---------------</div>
<div><br></div><div>The output is:</div><div><div>0 done.</div><div>1 done.</div><div>2 done.</div><div>*** glibc detected *** ./SliceImageFilterTest: free(): invalid pointer: 0x00007f7b5684f010 ***</div></div><div>...</div>
<div>...</div><div><br></div><div>What could be the reason for this?</div><div><br></div><div>I have run these tests in an other test program, there were problems too, not free() related, but: munmap_chunk(): invalid pointer.</div>
<div>And one case was: _int_malloc: Assertion `(unsigned long)(size) >= (unsigned long)(nb)' failed</div><div><br></div><div>If i remove line "slicer->SetDimension( i );" everything is OK, but in this case I get three (the same) 3D connected component labelmap. That is not I want of course.</div>
<div><br></div><div>I use ITK 3.20 and glibc 2.11.1 and the input binary images are all valid ones. Any hints?</div><div><br></div><div>Cheers,</div></font></font>-- <br>Zoli<br>
</div>