Atropos with `-k ManifoldParzenWindows` results in a segmentation fault
Describe the problem
Calling Atropos with -k ManifoldParzenWindows results in a segmentation fault.
To Reproduce
Atropos -d 3 -x tpl-MNI152NLin2009cAsym_res-02_desc-brain_mask.nii.gz \
-c [ 5,0.00001 ] \
-a tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz \
-i kmeans[ 3 ] \
-k ManifoldParzenWindows \
-m [ 0.1,1x1x1 ] \
-o [ tmpSegmentation.nii.gz,posteriors%d.nii.gz ] \
-r 1 -p Socrates[ 0 ] \
--verbose
System information (please complete the following information)
Reproduced on Mac (compiled locally) and Linux (via Docker).
ANTs version information
- ANTs code version: Various, error is present from at least v2.4.0
- ANTs installation type: Locally compiled (Mac) and Docker (Linux)
Additional information
Debug output
$ lldb Atropos
(lldb) target create "Atropos"
Current executable set to 'Atropos' (x86_64).
(lldb) run -d 3 -x tpl-MNI152NLin2009cAsym_res-02_desc-brain_mask.nii.gz -c [ 200,0.0005 ] -a tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz -i kmeans[ 2 ] -k ManifoldParzenWindows[ 1, 32 ] -m [ 0.1,1x1x1 ] -o [ tmpSegmentation.nii.gz,posteriors%d.nii.gz
Process 42871 launched: '/Users/pcook/tmp/NOT_BACKED_UP/antsAtroposMalloc/install/bin/Atropos' (x86_64)
Running Atropos for 3-dimensional images.
Progress:
Iteration 0 (of 200): posterior probability = 0 (annealing temperature = 1)
Process 42871 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x0000000100178307 Atropos`itk::Statistics::KdTree<itk::Statistics::ListSample<itk::Array<float> > >::Size(this=0x0000600002900c40) const at itkKdTree.h:680:22
677 SizeValueType
678 Size() const
679 {
-> 680 return m_Sample->Size();
681 }
682
683 /** Returns the pointer to the empty terminal node. A KdTree object
Target 0: (Atropos) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x0000000100178307 Atropos`itk::Statistics::KdTree<itk::Statistics::ListSample<itk::Array<float> > >::Size(this=0x0000600002900c40) const at itkKdTree.h:680:22
frame #1: 0x0000000100177de8 Atropos`itk::Statistics::KdTree<itk::Statistics::ListSample<itk::Array<float> > >::Search(this=0x0000600002900c40, query=0x00007ff7bfefb7e8, numberOfNeighborsRequested=32, result=size=0, distances=size=0) const at itkKdTree.hxx:191:42
frame #2: 0x0000000100177d74 Atropos`itk::Statistics::KdTree<itk::Statistics::ListSample<itk::Array<float> > >::Search(this=0x0000600002900c40, query=0x00007ff7bfefb7e8, numberOfNeighborsRequested=32, result=size=0) const at itkKdTree.hxx:181:9
frame #3: 0x0000000100176633 Atropos`itk::ants::Statistics::ManifoldParzenWindowsListSampleFunction<itk::Statistics::ListSample<itk::Array<float> >, float, float>::Evaluate(this=0x000060000350c0b0, measurement=0x00007ff7bfefb7e8) const at antsManifoldParzenWindowsListSampleFunction.hxx:195:45
frame #4: 0x00000001002b1ce9 Atropos`itk::ants::AtroposSegmentationImageFilter<itk::Image<float, 3u>, itk::Image<unsigned int, 3u>, itk::Image<unsigned int, 3u> >::PerformLocalLabelingUpdate(this=0x0000000103d04eb0, It=NeighborhoodIterator<itk::Image<unsigned int, 3>, itk::ZeroFluxNeumannBoundaryCondition<itk::Image<unsigned int, 3>, itk::Image<unsigned int, 3> > > @ 0x00007ff7bfefbf08) at antsAtroposSegmentationImageFilter.hxx:1507:62
frame #5: 0x0000000100287f09 Atropos`itk::ants::AtroposSegmentationImageFilter<itk::Image<float, 3u>, itk::Image<unsigned int, 3u>, itk::Image<unsigned int, 3u> >::UpdateClassLabeling(this=0x0000000103d04eb0) at antsAtroposSegmentationImageFilter.hxx:1200:38
frame #6: 0x000000010027c2f7 Atropos`itk::ants::AtroposSegmentationImageFilter<itk::Image<float, 3u>, itk::Image<unsigned int, 3u>, itk::Image<unsigned int, 3u> >::GenerateData(this=0x0000000103d04eb0) at antsAtroposSegmentationImageFilter.hxx:459:49
frame #7: 0x00000001010ecdc8 Atropos`itk::ProcessObject::UpdateOutputData(this=0x0000000103d04eb0, (null)=0x0000000103d05330) at itkProcessObject.cxx:1694:11
frame #8: 0x00000001011238ea Atropos`itk::DataObject::UpdateOutputData(this=0x0000000103d05330) at itkDataObject.cxx:388:17
frame #9: 0x0000000100282947 Atropos`itk::ImageBase<3u>::UpdateOutputData(this=0x0000000103d05330) at itkImageBase.hxx:265:23
frame #10: 0x00000001011235f7 Atropos`itk::DataObject::Update(this=0x0000000103d05330) at itkDataObject.cxx:319:9
frame #11: 0x00000001010ebcf1 Atropos`itk::ProcessObject::Update(this=0x0000000103d04eb0) at itkProcessObject.cxx:1286:20
frame #12: 0x000000010001f9da Atropos`int ants::AtroposSegmentation<3u>(parser=0x0000600003d08000) at Atropos.cxx:1020:16
frame #13: 0x000000010000b907 Atropos`ants::Atropos(args=size=35, (null)=0x00007ff854922ca0) at Atropos.cxx:1721:14
frame #14: 0x00000001000019a6 Atropos`main(argc=35, argv=0x00007ff7bfeff1d8) at cli_Atropos.cxx:11:10
frame #15: 0x000000010375952e dyld`start + 462
Somehow the tree object is not created correctly, but I can't figure it out. Doesn't seem to be related to threads
I've got the same issue, is there any fix planned @cookpa ?
Sorry @arnaudbore, I could not find a solution, but I was able to fix HistogramParzenWindows if that works for you
I'll try to take a look.
Sorry, actually I misread my command line I'm already using HistogramParzenWindows. I get a Segmentation fault (core dumped)
I'm using this version: ANTs Version: 2.5.0.post11-gdee5e1a I get the same error with this version also: v2.4.3-gcaa60eb I don't get the error using this version: v2.3.5.post76-g28dd25c
No problem, can you please open a bug report with the specifics, I will try to reproduce
Done #1756 :) Thank you @cookpa
https://github.com/ANTsX/ANTs/pull/1757