Repository: InsightSoftwareConsortium/ITK (language: python)

Issue:
itkStatisticsUniqueLabelMapFilterTest1 test fails under TSan (Thread Sanitizer)
Two different threads (`T16` then `T10`) decide to write to the same pixel.  Perhaps they are writing the same colour, but that's still undefined behaviour.

Perhaps the bug is that they should be writing to different pixels?  Otherwise, it seems that some mutex or other synchronization would need to be added.

Full TSan output is:

```
Trying writer->Update()
libpng warning: sCAL: invalid unit
libpng warning: sCAL: invalid unit
-------- Start StatisticsUniqueLabelMapFilter "filter" StatisticsUniqueLabelMapFilter (0x7b4c00001880)
  RTTI typeinfo:   itk::StatisticsUniqueLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> > >
  Reference Count: 3
  Modified Time: 309
  Debug: Off
  Object Name: 
  Observers: 
    StartEvent(SimpleMemberCommand)
    EndEvent(SimpleMemberCommand)
    ProgressEvent(SimpleMemberCommand)
    IterationEvent(SimpleMemberCommand)
    AbortEvent(SimpleMemberCommand)
  Inputs: 
    Primary: (0x7b5000001c00) *
  Indexed Inputs: 
    0: Primary (0x7b5000001c00)
  Required Input Names: Primary
  NumberOfRequiredInputs: 1
  Outputs: 
    Primary: (0x7b5000001e00)
  Indexed Outputs: 
    0: Primary (0x7b5000001e00)
  NumberOfRequiredOutputs: 1
  Number Of Work Units: 64
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  AbortGenerateData: Off
  Progress: 0
  Multithreader: 
    RTTI typeinfo:   itk::PoolMultiThreader
    Reference Count: 1
    Modified Time: 295
    Debug: Off
    Object Name: 
    Observers: 
      none
    Number of Work Units: 64
    Number of Threads: 16
    Global Maximum Number Of Threads: 128
    Global Default Number Of Threads: 16
    Global Default Threader Type: itk::MultiThreaderBaseEnums::Threader::Pool
    SingleMethod: 0
    SingleData: 0x0
  DynamicMultiThreading: On
  CoordinateTolerance: 1e-06
  DirectionTolerance: 1e-06
  InPlace: On
  The input and output to this filter are the same type. The filter can be run in place.
  ReverseOrdering: 0
  Attribute: NumberOfPixels (100)
Progress  | 0 | 1
Filter took 0.0329771 seconds.
-------- End StatisticsUniqueLabelMapFilter "filter" 
StatisticsUniqueLabelMapFilter (0x7b4c00001880)
  RTTI typeinfo:   itk::StatisticsUniqueLabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> > >
  Reference Count: 3
  Modified Time: 309
  Debug: Off
  Object Name: 
  Observers: 
    StartEvent(SimpleMemberCommand)
    EndEvent(SimpleMemberCommand)
    ProgressEvent(SimpleMemberCommand)
    IterationEvent(SimpleMemberCommand)
    AbortEvent(SimpleMemberCommand)
  Inputs: 
    Primary: (0x7b5000001c00) *
  Indexed Inputs: 
    0: Primary (0x7b5000001c00)
  Required Input Names: Primary
  NumberOfRequiredInputs: 1
  Outputs: 
    Primary: (0x7b5000001e00)
  Indexed Outputs: 
    0: Primary (0x7b5000001e00)
  NumberOfRequiredOutputs: 1
  Number Of Work Units: 64
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  AbortGenerateData: Off
  Progress: 1
  Multithreader: 
    RTTI typeinfo:   itk::PoolMultiThreader
    Reference Count: 1
    Modified Time: 295
    Debug: Off
    Object Name: 
    Observers: 
      none
    Number of Work Units: 64
    Number of Threads: 16
    Global Maximum Number Of Threads: 128
    Global Default Number Of Threads: 16
    Global Default Threader Type: itk::MultiThreaderBaseEnums::Threader::Pool
    SingleMethod: 0
    SingleData: 0x0
  DynamicMultiThreading: On
  CoordinateTolerance: 1e-06
  DirectionTolerance: 1e-06
  InPlace: On
  The input and output to this filter are the same type. The filter can be run in place.
  ReverseOrdering: 0
  Attribute: NumberOfPixels (100)
==================
WARNING: ThreadSanitizer: data race (pid=41828)
  Write of size 1 at 0x7bc00005cc57 by thread T10:
    #0 itk::Image<unsigned char, 2u>::SetPixel(itk::Index<2u> const&, unsigned char const&) itkImage.h:211 (ITKLabelMapTestDriver:x86_64+0x100055d59)
    #1 itk::LabelMapToLabelImageFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::ThreadedProcessLabelObject(itk::StatisticsLabelObject<unsigned char, 2u>*) itkLabelMapToLabelImageFilter.hxx:57 (ITKLabelMapTestDriver:x86_64+0x100587160)
    #2 itk::LabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::DynamicThreadedGenerateData(itk::ImageRegion<2u> const&) itkLabelMapFilter.hxx:113 (ITKLabelMapTestDriver:x86_64+0x1005869c8)
    #3 itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)::operator()(itk::ImageRegion<2u> const&) const itkImageSource.hxx:233 (ITKLabelMapTestDriver:x86_64+0x100013eb7)
    #4 decltype(std::__1::forward<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&>(fp)(std::__1::forward<itk::ImageRegion<2u> const&>(fp0))) std::__1::__invoke<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100013e33)
    #5 void std::__1::__invoke_void_return_wrapper<void>::__call<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100013db3)
    #6 std::__1::__function::__alloc_func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100013d63)
    #7 std::__1::__function::__func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x1000128fc)
    #8 std::__1::__function::__value_func<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1000120b6)
    #9 std::__1::function<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x100011fe8)
    #10 void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)::operator()(long const*, unsigned long const*) const itkMultiThreaderBase.h:350 (ITKLabelMapTestDriver:x86_64+0x100011ed7)
    #11 decltype(std::__1::forward<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&>(fp)(std::__1::forward<long const*>(fp0), std::__1::forward<unsigned long const*>(fp0))) std::__1::__invoke<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100011dfe)
    #12 void std::__1::__invoke_void_return_wrapper<void>::__call<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100011d48)
    #13 std::__1::__function::__alloc_func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100011c78)
    #14 std::__1::__function::__func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x100010640)
    #15 std::__1::__function::__value_func<void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x10135193a)
    #16 std::__1::function<void (long const*, unsigned long const*)>::operator()(long const*, unsigned long const*) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x101349ec3)
    #17 itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5::operator()() const itkPoolMultiThreader.cxx:271 (ITKLabelMapTestDriver:x86_64+0x1013de1aa)
    #18 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(fp)()) std::__1::__invoke<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de111)
    #19 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__apply_functor<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&, std::__1::tuple<>&, std::__1::__tuple_indices<>, std::__1::tuple<>&&) functional:2644 (ITKLabelMapTestDriver:x86_64+0x1013de0c9)
    #20 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>::operator()<>() functional:2677 (ITKLabelMapTestDriver:x86_64+0x1013de089)
    #21 decltype(std::__1::forward<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(fp)()) std::__1::__invoke<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de021)
    #22 std::__1::__packaged_task_func<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>, std::__1::allocator<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5> >, void* ()>::operator()() future:1821 (ITKLabelMapTestDriver:x86_64+0x1013dd8a5)
    #23 std::__1::__packaged_task_function<void* ()>::operator()() const future:1998 (ITKLabelMapTestDriver:x86_64+0x1013d6cbf)
    #24 std::__1::packaged_task<void* ()>::operator()() future:2089 (ITKLabelMapTestDriver:x86_64+0x1013d6b6e)
    #25 std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()::operator()() const itkThreadPool.h:97 (ITKLabelMapTestDriver:x86_64+0x1013e0091)
    #26 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(fp)()) std::__1::__invoke<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e0021)
    #27 void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x1013dffb1)
    #28 std::__1::__function::__alloc_func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1527 (ITKLabelMapTestDriver:x86_64+0x1013dff71)
    #29 std::__1::__function::__func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1651 (ITKLabelMapTestDriver:x86_64+0x1013de9ed)
    #30 std::__1::__function::__value_func<void ()>::operator()() const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1013a6c84)
    #31 std::__1::function<void ()>::operator()() const functional:2347 (ITKLabelMapTestDriver:x86_64+0x1013a27e9)
    #32 itk::ThreadPool::ThreadExecute() itkThreadPool.cxx:211 (ITKLabelMapTestDriver:x86_64+0x1013e0e5a)
    #33 decltype(std::__1::forward<void (*)()>(fp)()) std::__1::__invoke<void (*)()>(void (*&&)()) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e7f76)
    #34 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>&, std::__1::__tuple_indices<>) thread:342 (ITKLabelMapTestDriver:x86_64+0x1013e7e59)
    #35 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()> >(void*) thread:352 (ITKLabelMapTestDriver:x86_64+0x1013e760a)

  Previous write of size 1 at 0x7bc00005cc57 by thread T16:
    #0 itk::Image<unsigned char, 2u>::SetPixel(itk::Index<2u> const&, unsigned char const&) itkImage.h:211 (ITKLabelMapTestDriver:x86_64+0x100055d59)
    #1 itk::LabelMapToLabelImageFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::ThreadedProcessLabelObject(itk::StatisticsLabelObject<unsigned char, 2u>*) itkLabelMapToLabelImageFilter.hxx:57 (ITKLabelMapTestDriver:x86_64+0x100587160)
    #2 itk::LabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::DynamicThreadedGenerateData(itk::ImageRegion<2u> const&) itkLabelMapFilter.hxx:113 (ITKLabelMapTestDriver:x86_64+0x1005869c8)
    #3 itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)::operator()(itk::ImageRegion<2u> const&) const itkImageSource.hxx:233 (ITKLabelMapTestDriver:x86_64+0x100013eb7)
    #4 decltype(std::__1::forward<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&>(fp)(std::__1::forward<itk::ImageRegion<2u> const&>(fp0))) std::__1::__invoke<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100013e33)
    #5 void std::__1::__invoke_void_return_wrapper<void>::__call<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100013db3)
    #6 std::__1::__function::__alloc_func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100013d63)
    #7 std::__1::__function::__func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x1000128fc)
    #8 std::__1::__function::__value_func<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1000120b6)
    #9 std::__1::function<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x100011fe8)
    #10 void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)::operator()(long const*, unsigned long const*) const itkMultiThreaderBase.h:350 (ITKLabelMapTestDriver:x86_64+0x100011ed7)
    #11 decltype(std::__1::forward<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&>(fp)(std::__1::forward<long const*>(fp0), std::__1::forward<unsigned long const*>(fp0))) std::__1::__invoke<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100011dfe)
    #12 void std::__1::__invoke_void_return_wrapper<void>::__call<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100011d48)
    #13 std::__1::__function::__alloc_func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100011c78)
    #14 std::__1::__function::__func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x100010640)
    #15 std::__1::__function::__value_func<void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x10135193a)
    #16 std::__1::function<void (long const*, unsigned long const*)>::operator()(long const*, unsigned long const*) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x101349ec3)
    #17 itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5::operator()() const itkPoolMultiThreader.cxx:271 (ITKLabelMapTestDriver:x86_64+0x1013de1aa)
    #18 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(fp)()) std::__1::__invoke<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de111)
    #19 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__apply_functor<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&, std::__1::tuple<>&, std::__1::__tuple_indices<>, std::__1::tuple<>&&) functional:2644 (ITKLabelMapTestDriver:x86_64+0x1013de0c9)
    #20 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>::operator()<>() functional:2677 (ITKLabelMapTestDriver:x86_64+0x1013de089)
    #21 decltype(std::__1::forward<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(fp)()) std::__1::__invoke<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de021)
    #22 std::__1::__packaged_task_func<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>, std::__1::allocator<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5> >, void* ()>::operator()() future:1821 (ITKLabelMapTestDriver:x86_64+0x1013dd8a5)
    #23 std::__1::__packaged_task_function<void* ()>::operator()() const future:1998 (ITKLabelMapTestDriver:x86_64+0x1013d6cbf)
    #24 std::__1::packaged_task<void* ()>::operator()() future:2089 (ITKLabelMapTestDriver:x86_64+0x1013d6b6e)
    #25 std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()::operator()() const itkThreadPool.h:97 (ITKLabelMapTestDriver:x86_64+0x1013e0091)
    #26 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(fp)()) std::__1::__invoke<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e0021)
    #27 void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x1013dffb1)
    #28 std::__1::__function::__alloc_func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1527 (ITKLabelMapTestDriver:x86_64+0x1013dff71)
    #29 std::__1::__function::__func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1651 (ITKLabelMapTestDriver:x86_64+0x1013de9ed)
    #30 std::__1::__function::__value_func<void ()>::operator()() const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1013a6c84)
    #31 std::__1::function<void ()>::operator()() const functional:2347 (ITKLabelMapTestDriver:x86_64+0x1013a27e9)
    #32 itk::ThreadPool::ThreadExecute() itkThreadPool.cxx:211 (ITKLabelMapTestDriver:x86_64+0x1013e0e5a)
    #33 decltype(std::__1::forward<void (*)()>(fp)()) std::__1::__invoke<void (*)()>(void (*&&)()) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e7f76)
    #34 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>&, std::__1::__tuple_indices<>) thread:342 (ITKLabelMapTestDriver:x86_64+0x1013e7e59)
    #35 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()> >(void*) thread:352 (ITKLabelMapTestDriver:x86_64+0x1013e760a)

  Location is heap block of size 65536 at 0x7bc000050000 allocated by main thread:
    #0 operator new[](unsigned long) <null>:5891680 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x6ed8b)
    #1 itk::ImportImageContainer<unsigned long, unsigned char>::AllocateElements(unsigned long, bool) const itkImportImageContainer.hxx:180 (ITKLabelMapTestDriver:x86_64+0x10001b2da)
    #2 itk::ImportImageContainer<unsigned long, unsigned char>::Reserve(unsigned long, bool) itkImportImageContainer.hxx:85 (ITKLabelMapTestDriver:x86_64+0x10001c3e5)
    #3 itk::Image<unsigned char, 2u>::Allocate(bool) itkImage.hxx:53 (ITKLabelMapTestDriver:x86_64+0x1000186f6)
    #4 itk::ImageSource<itk::Image<unsigned char, 2u> >::AllocateOutputs() itkImageSource.hxx:184 (ITKLabelMapTestDriver:x86_64+0x10000d752)
    #5 itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData() itkImageSource.hxx:215 (ITKLabelMapTestDriver:x86_64+0x10000ea7a)
    #6 itk::ProcessObject::UpdateOutputData(itk::DataObject*) itkProcessObject.cxx:1708 (ITKLabelMapTestDriver:x86_64+0x1013344a8)
    #7 itk::DataObject::UpdateOutputData() itkDataObject.cxx:376 (ITKLabelMapTestDriver:x86_64+0x101370a4d)
    #8 itk::ImageBase<2u>::UpdateOutputData() itkImageBase.hxx:263 (ITKLabelMapTestDriver:x86_64+0x10001747a)
    #9 itk::ImageFileWriter<itk::Image<unsigned char, 2u> >::Write() itkImageFileWriter.hxx:284 (ITKLabelMapTestDriver:x86_64+0x1000580ad)
    #10 itk::ImageFileWriter<itk::Image<unsigned char, 2u> >::Update() itkImageFileWriter.h:178 (ITKLabelMapTestDriver:x86_64+0x1000568f5)
    #11 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:136 (ITKLabelMapTestDriver:x86_64+0x100af9088)
    #12 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

  Thread T10 (tid=106450770, running) created by main thread at:
    #0 pthread_create <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x2933d)
    #1 std::__1::__libcpp_thread_create(_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:328 (ITKLabelMapTestDriver:x86_64+0x1013e7589)
    #2 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:368 (ITKLabelMapTestDriver:x86_64+0x1013e73cc)
    #3 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:360 (ITKLabelMapTestDriver:x86_64+0x1013e7300)
    #4 void std::__1::allocator<std::__1::thread>::construct<std::__1::thread, void (*)()>(std::__1::thread*, void (*&&)()) memory:1826 (ITKLabelMapTestDriver:x86_64+0x1013e72b8)
    #5 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::__construct<std::__1::thread, void (*)()>(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1718 (ITKLabelMapTestDriver:x86_64+0x1013e7268)
    #6 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::construct<std::__1::thread, void (*)()>(std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1561 (ITKLabelMapTestDriver:x86_64+0x1013e7118)
    #7 void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::emplace_back<void (*)()>(void (*&&)()) vector:1688 (ITKLabelMapTestDriver:x86_64+0x1013e0d12)
    #8 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:118 (ITKLabelMapTestDriver:x86_64+0x1013e0ac6)
    #9 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:108 (ITKLabelMapTestDriver:x86_64+0x1013e0f49)
    #10 itk::ThreadPool::GetInstance()::$_2::operator()() const itkThreadPool.cxx:83 (ITKLabelMapTestDriver:x86_64+0x1013e620b)
    #11 decltype(std::__1::forward<itk::ThreadPool::GetInstance()::$_2>(fp)()) std::__1::__invoke<itk::ThreadPool::GetInstance()::$_2>(itk::ThreadPool::GetInstance()::$_2&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e6103)
    #12 void std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::__execute<>(std::__1::__tuple_indices<>) mutex:622 (ITKLabelMapTestDriver:x86_64+0x1013e60d1)
    #13 std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::operator()() mutex:614 (ITKLabelMapTestDriver:x86_64+0x1013e6079)
    #14 void std::__1::__call_once_proxy<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >(void*) mutex:650 (ITKLabelMapTestDriver:x86_64+0x1013e5f19)
    #15 __tsan::(anonymous namespace)::call_once_callback_wrapper(void*) <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x69a0e)
    #16 itk::ThreadPool::GetInstance() itkThreadPool.cxx:79 (ITKLabelMapTestDriver:x86_64+0x1013e0681)
    #17 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:81 (ITKLabelMapTestDriver:x86_64+0x1013ca496)
    #18 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:82 (ITKLabelMapTestDriver:x86_64+0x1013ca7b9)
    #19 itk::PoolMultiThreader::New() itkPoolMultiThreader.h:57 (ITKLabelMapTestDriver:x86_64+0x1013493c5)
    #20 itk::MultiThreaderBase::New() itkMultiThreaderBase.cxx:419 (ITKLabelMapTestDriver:x86_64+0x101348ef0)
    #21 itk::ProcessObject::ProcessObject() itkProcessObject.cxx:72 (ITKLabelMapTestDriver:x86_64+0x10132bf1a)
    #22 itk::ImageSource<itk::Image<unsigned char, 2u> >::ImageSource() itkImageSource.h:230 (ITKLabelMapTestDriver:x86_64+0x10000a020)
    #23 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.h:122 (ITKLabelMapTestDriver:x86_64+0x100009ef4)
    #24 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.hxx:36 (ITKLabelMapTestDriver:x86_64+0x100009d19)
    #25 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::New() itkImageFileReader.h:86 (ITKLabelMapTestDriver:x86_64+0x100008475)
    #26 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:62 (ITKLabelMapTestDriver:x86_64+0x100af8800)
    #27 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

  Thread T16 (tid=106450776, running) created by main thread at:
    #0 pthread_create <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x2933d)
    #1 std::__1::__libcpp_thread_create(_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:328 (ITKLabelMapTestDriver:x86_64+0x1013e7589)
    #2 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:368 (ITKLabelMapTestDriver:x86_64+0x1013e73cc)
    #3 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:360 (ITKLabelMapTestDriver:x86_64+0x1013e7300)
    #4 void std::__1::allocator<std::__1::thread>::construct<std::__1::thread, void (*)()>(std::__1::thread*, void (*&&)()) memory:1826 (ITKLabelMapTestDriver:x86_64+0x1013e72b8)
    #5 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::__construct<std::__1::thread, void (*)()>(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1718 (ITKLabelMapTestDriver:x86_64+0x1013e7268)
    #6 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::construct<std::__1::thread, void (*)()>(std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1561 (ITKLabelMapTestDriver:x86_64+0x1013e7118)
    #7 void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::emplace_back<void (*)()>(void (*&&)()) vector:1688 (ITKLabelMapTestDriver:x86_64+0x1013e0d12)
    #8 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:118 (ITKLabelMapTestDriver:x86_64+0x1013e0ac6)
    #9 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:108 (ITKLabelMapTestDriver:x86_64+0x1013e0f49)
    #10 itk::ThreadPool::GetInstance()::$_2::operator()() const itkThreadPool.cxx:83 (ITKLabelMapTestDriver:x86_64+0x1013e620b)
    #11 decltype(std::__1::forward<itk::ThreadPool::GetInstance()::$_2>(fp)()) std::__1::__invoke<itk::ThreadPool::GetInstance()::$_2>(itk::ThreadPool::GetInstance()::$_2&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e6103)
    #12 void std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::__execute<>(std::__1::__tuple_indices<>) mutex:622 (ITKLabelMapTestDriver:x86_64+0x1013e60d1)
    #13 std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::operator()() mutex:614 (ITKLabelMapTestDriver:x86_64+0x1013e6079)
    #14 void std::__1::__call_once_proxy<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >(void*) mutex:650 (ITKLabelMapTestDriver:x86_64+0x1013e5f19)
    #15 __tsan::(anonymous namespace)::call_once_callback_wrapper(void*) <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x69a0e)
    #16 itk::ThreadPool::GetInstance() itkThreadPool.cxx:79 (ITKLabelMapTestDriver:x86_64+0x1013e0681)
    #17 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:81 (ITKLabelMapTestDriver:x86_64+0x1013ca496)
    #18 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:82 (ITKLabelMapTestDriver:x86_64+0x1013ca7b9)
    #19 itk::PoolMultiThreader::New() itkPoolMultiThreader.h:57 (ITKLabelMapTestDriver:x86_64+0x1013493c5)
    #20 itk::MultiThreaderBase::New() itkMultiThreaderBase.cxx:419 (ITKLabelMapTestDriver:x86_64+0x101348ef0)
    #21 itk::ProcessObject::ProcessObject() itkProcessObject.cxx:72 (ITKLabelMapTestDriver:x86_64+0x10132bf1a)
    #22 itk::ImageSource<itk::Image<unsigned char, 2u> >::ImageSource() itkImageSource.h:230 (ITKLabelMapTestDriver:x86_64+0x10000a020)
    #23 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.h:122 (ITKLabelMapTestDriver:x86_64+0x100009ef4)
    #24 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.hxx:36 (ITKLabelMapTestDriver:x86_64+0x100009d19)
    #25 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::New() itkImageFileReader.h:86 (ITKLabelMapTestDriver:x86_64+0x100008475)
    #26 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:62 (ITKLabelMapTestDriver:x86_64+0x100af8800)
    #27 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

SUMMARY: ThreadSanitizer: data race itkImage.h:211 in itk::Image<unsigned char, 2u>::SetPixel(itk::Index<2u> const&, unsigned char const&)
==================
==================
WARNING: ThreadSanitizer: data race (pid=41828)
  Write of size 1 at 0x7bc00005cd56 by thread T10:
    #0 itk::Image<unsigned char, 2u>::SetPixel(itk::Index<2u> const&, unsigned char const&) itkImage.h:211 (ITKLabelMapTestDriver:x86_64+0x100055d59)
    #1 itk::LabelMapToLabelImageFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::ThreadedProcessLabelObject(itk::StatisticsLabelObject<unsigned char, 2u>*) itkLabelMapToLabelImageFilter.hxx:57 (ITKLabelMapTestDriver:x86_64+0x100587160)
    #2 itk::LabelMapFilter<itk::LabelMap<itk::StatisticsLabelObject<unsigned char, 2u> >, itk::Image<unsigned char, 2u> >::DynamicThreadedGenerateData(itk::ImageRegion<2u> const&) itkLabelMapFilter.hxx:113 (ITKLabelMapTestDriver:x86_64+0x1005869c8)
    #3 itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)::operator()(itk::ImageRegion<2u> const&) const itkImageSource.hxx:233 (ITKLabelMapTestDriver:x86_64+0x100013eb7)
    #4 decltype(std::__1::forward<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&>(fp)(std::__1::forward<itk::ImageRegion<2u> const&>(fp0))) std::__1::__invoke<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100013e33)
    #5 void std::__1::__invoke_void_return_wrapper<void>::__call<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&, itk::ImageRegion<2u> const&>(itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)&&&, itk::ImageRegion<2u> const&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100013db3)
    #6 std::__1::__function::__alloc_func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100013d63)
    #7 std::__1::__function::__func<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&), std::__1::allocator<itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData()::'lambda'(itk::ImageRegion<2u> const&)>, void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x1000128fc)
    #8 std::__1::__function::__value_func<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1000120b6)
    #9 std::__1::function<void (itk::ImageRegion<2u> const&)>::operator()(itk::ImageRegion<2u> const&) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x100011fe8)
    #10 void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)::operator()(long const*, unsigned long const*) const itkMultiThreaderBase.h:350 (ITKLabelMapTestDriver:x86_64+0x100011ed7)
    #11 decltype(std::__1::forward<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&>(fp)(std::__1::forward<long const*>(fp0), std::__1::forward<unsigned long const*>(fp0))) std::__1::__invoke<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x100011dfe)
    #12 void std::__1::__invoke_void_return_wrapper<void>::__call<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&, long const*, unsigned long const*>(void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)&&&, long const*&&, unsigned long const*&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x100011d48)
    #13 std::__1::__function::__alloc_func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1527 (ITKLabelMapTestDriver:x86_64+0x100011c78)
    #14 std::__1::__function::__func<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*), std::__1::allocator<void itk::MultiThreaderBase::ParallelizeImageRegion<2u>(itk::ImageRegion<2u> const&, std::__1::function<void (itk::ImageRegion<2u> const&)>, itk::ProcessObject*)::'lambda'(long const*, unsigned long const*)>, void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) functional:1651 (ITKLabelMapTestDriver:x86_64+0x100010640)
    #15 std::__1::__function::__value_func<void (long const*, unsigned long const*)>::operator()(long const*&&, unsigned long const*&&) const functional:1799 (ITKLabelMapTestDriver:x86_64+0x10135193a)
    #16 std::__1::function<void (long const*, unsigned long const*)>::operator()(long const*, unsigned long const*) const functional:2347 (ITKLabelMapTestDriver:x86_64+0x101349ec3)
    #17 itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5::operator()() const itkPoolMultiThreader.cxx:271 (ITKLabelMapTestDriver:x86_64+0x1013de1aa)
    #18 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(fp)()) std::__1::__invoke<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de111)
    #19 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__apply_functor<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&, std::__1::tuple<>&, std::__1::__tuple_indices<>, std::__1::tuple<>&&) functional:2644 (ITKLabelMapTestDriver:x86_64+0x1013de0c9)
    #20 std::__1::__bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<>, __is_valid_bind_return<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5, std::__1::tuple<>, std::__1::tuple<> >::value>::type std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>::operator()<>() functional:2677 (ITKLabelMapTestDriver:x86_64+0x1013de089)
    #21 decltype(std::__1::forward<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(fp)()) std::__1::__invoke<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&>(std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>&&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013de021)
    #22 std::__1::__packaged_task_func<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>, std::__1::allocator<std::__1::__bind<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5> >, void* ()>::operator()() future:1821 (ITKLabelMapTestDriver:x86_64+0x1013dd8a5)
    #23 std::__1::__packaged_task_function<void* ()>::operator()() const future:1998 (ITKLabelMapTestDriver:x86_64+0x1013d6cbf)
    #24 std::__1::packaged_task<void* ()>::operator()() future:2089 (ITKLabelMapTestDriver:x86_64+0x1013d6b6e)
    #25 std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()::operator()() const itkThreadPool.h:97 (ITKLabelMapTestDriver:x86_64+0x1013e0091)
    #26 decltype(std::__1::forward<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(fp)()) std::__1::__invoke<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e0021)
    #27 void std::__1::__invoke_void_return_wrapper<void>::__call<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&>(std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()&&&) __functional_base:349 (ITKLabelMapTestDriver:x86_64+0x1013dffb1)
    #28 std::__1::__function::__alloc_func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1527 (ITKLabelMapTestDriver:x86_64+0x1013dff71)
    #29 std::__1::__function::__func<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'(), std::__1::allocator<std::__1::future<std::__1::result_of<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5 ()>::type> itk::ThreadPool::AddWork<itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5>(itk::PoolMultiThreader::ParallelizeImageRegion(unsigned int, long const*, unsigned long const*, std::__1::function<void (long const*, unsigned long const*)>, itk::ProcessObject*)::$_5&&)::'lambda'()>, void ()>::operator()() functional:1651 (ITKLabelMapTestDriver:x86_64+0x1013de9ed)
    #30 std::__1::__function::__value_func<void ()>::operator()() const functional:1799 (ITKLabelMapTestDriver:x86_64+0x1013a6c84)
    #31 std::__1::function<void ()>::operator()() const functional:2347 (ITKLabelMapTestDriver:x86_64+0x1013a27e9)
    #32 itk::ThreadPool::ThreadExecute() itkThreadPool.cxx:211 (ITKLabelMapTestDriver:x86_64+0x1013e0e5a)
    #33 decltype(std::__1::forward<void (*)()>(fp)()) std::__1::__invoke<void (*)()>(void (*&&)()) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e7f76)
    #34 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()>&, std::__1::__tuple_indices<>) thread:342 (ITKLabelMapTestDriver:x86_64+0x1013e7e59)
    #35 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()> >(void*) thread:352 (ITKLabelMapTestDriver:x86_64+0x1013e760a)

  Previous write of size 1 at 0x7bc00005cd56 by thread T8:
    [failed to restore the stack]

  Location is heap block of size 65536 at 0x7bc000050000 allocated by main thread:
    #0 operator new[](unsigned long) <null>:5891680 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x6ed8b)
    #1 itk::ImportImageContainer<unsigned long, unsigned char>::AllocateElements(unsigned long, bool) const itkImportImageContainer.hxx:180 (ITKLabelMapTestDriver:x86_64+0x10001b2da)
    #2 itk::ImportImageContainer<unsigned long, unsigned char>::Reserve(unsigned long, bool) itkImportImageContainer.hxx:85 (ITKLabelMapTestDriver:x86_64+0x10001c3e5)
    #3 itk::Image<unsigned char, 2u>::Allocate(bool) itkImage.hxx:53 (ITKLabelMapTestDriver:x86_64+0x1000186f6)
    #4 itk::ImageSource<itk::Image<unsigned char, 2u> >::AllocateOutputs() itkImageSource.hxx:184 (ITKLabelMapTestDriver:x86_64+0x10000d752)
    #5 itk::ImageSource<itk::Image<unsigned char, 2u> >::GenerateData() itkImageSource.hxx:215 (ITKLabelMapTestDriver:x86_64+0x10000ea7a)
    #6 itk::ProcessObject::UpdateOutputData(itk::DataObject*) itkProcessObject.cxx:1708 (ITKLabelMapTestDriver:x86_64+0x1013344a8)
    #7 itk::DataObject::UpdateOutputData() itkDataObject.cxx:376 (ITKLabelMapTestDriver:x86_64+0x101370a4d)
    #8 itk::ImageBase<2u>::UpdateOutputData() itkImageBase.hxx:263 (ITKLabelMapTestDriver:x86_64+0x10001747a)
    #9 itk::ImageFileWriter<itk::Image<unsigned char, 2u> >::Write() itkImageFileWriter.hxx:284 (ITKLabelMapTestDriver:x86_64+0x1000580ad)
    #10 itk::ImageFileWriter<itk::Image<unsigned char, 2u> >::Update() itkImageFileWriter.h:178 (ITKLabelMapTestDriver:x86_64+0x1000568f5)
    #11 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:136 (ITKLabelMapTestDriver:x86_64+0x100af9088)
    #12 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

  Thread T10 (tid=106450770, running) created by main thread at:
    #0 pthread_create <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x2933d)
    #1 std::__1::__libcpp_thread_create(_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:328 (ITKLabelMapTestDriver:x86_64+0x1013e7589)
    #2 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:368 (ITKLabelMapTestDriver:x86_64+0x1013e73cc)
    #3 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:360 (ITKLabelMapTestDriver:x86_64+0x1013e7300)
    #4 void std::__1::allocator<std::__1::thread>::construct<std::__1::thread, void (*)()>(std::__1::thread*, void (*&&)()) memory:1826 (ITKLabelMapTestDriver:x86_64+0x1013e72b8)
    #5 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::__construct<std::__1::thread, void (*)()>(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1718 (ITKLabelMapTestDriver:x86_64+0x1013e7268)
    #6 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::construct<std::__1::thread, void (*)()>(std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1561 (ITKLabelMapTestDriver:x86_64+0x1013e7118)
    #7 void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::emplace_back<void (*)()>(void (*&&)()) vector:1688 (ITKLabelMapTestDriver:x86_64+0x1013e0d12)
    #8 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:118 (ITKLabelMapTestDriver:x86_64+0x1013e0ac6)
    #9 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:108 (ITKLabelMapTestDriver:x86_64+0x1013e0f49)
    #10 itk::ThreadPool::GetInstance()::$_2::operator()() const itkThreadPool.cxx:83 (ITKLabelMapTestDriver:x86_64+0x1013e620b)
    #11 decltype(std::__1::forward<itk::ThreadPool::GetInstance()::$_2>(fp)()) std::__1::__invoke<itk::ThreadPool::GetInstance()::$_2>(itk::ThreadPool::GetInstance()::$_2&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e6103)
    #12 void std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::__execute<>(std::__1::__tuple_indices<>) mutex:622 (ITKLabelMapTestDriver:x86_64+0x1013e60d1)
    #13 std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::operator()() mutex:614 (ITKLabelMapTestDriver:x86_64+0x1013e6079)
    #14 void std::__1::__call_once_proxy<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >(void*) mutex:650 (ITKLabelMapTestDriver:x86_64+0x1013e5f19)
    #15 __tsan::(anonymous namespace)::call_once_callback_wrapper(void*) <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x69a0e)
    #16 itk::ThreadPool::GetInstance() itkThreadPool.cxx:79 (ITKLabelMapTestDriver:x86_64+0x1013e0681)
    #17 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:81 (ITKLabelMapTestDriver:x86_64+0x1013ca496)
    #18 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:82 (ITKLabelMapTestDriver:x86_64+0x1013ca7b9)
    #19 itk::PoolMultiThreader::New() itkPoolMultiThreader.h:57 (ITKLabelMapTestDriver:x86_64+0x1013493c5)
    #20 itk::MultiThreaderBase::New() itkMultiThreaderBase.cxx:419 (ITKLabelMapTestDriver:x86_64+0x101348ef0)
    #21 itk::ProcessObject::ProcessObject() itkProcessObject.cxx:72 (ITKLabelMapTestDriver:x86_64+0x10132bf1a)
    #22 itk::ImageSource<itk::Image<unsigned char, 2u> >::ImageSource() itkImageSource.h:230 (ITKLabelMapTestDriver:x86_64+0x10000a020)
    #23 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.h:122 (ITKLabelMapTestDriver:x86_64+0x100009ef4)
    #24 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.hxx:36 (ITKLabelMapTestDriver:x86_64+0x100009d19)
    #25 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::New() itkImageFileReader.h:86 (ITKLabelMapTestDriver:x86_64+0x100008475)
    #26 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:62 (ITKLabelMapTestDriver:x86_64+0x100af8800)
    #27 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

  Thread T8 (tid=106450768, running) created by main thread at:
    #0 pthread_create <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x2933d)
    #1 std::__1::__libcpp_thread_create(_opaque_pthread_t**, void* (*)(void*), void*) __threading_support:328 (ITKLabelMapTestDriver:x86_64+0x1013e7589)
    #2 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:368 (ITKLabelMapTestDriver:x86_64+0x1013e73cc)
    #3 std::__1::thread::thread<void (*)(), void>(void (*&&)()) thread:360 (ITKLabelMapTestDriver:x86_64+0x1013e7300)
    #4 void std::__1::allocator<std::__1::thread>::construct<std::__1::thread, void (*)()>(std::__1::thread*, void (*&&)()) memory:1826 (ITKLabelMapTestDriver:x86_64+0x1013e72b8)
    #5 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::__construct<std::__1::thread, void (*)()>(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1718 (ITKLabelMapTestDriver:x86_64+0x1013e7268)
    #6 void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::construct<std::__1::thread, void (*)()>(std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (*&&)()) memory:1561 (ITKLabelMapTestDriver:x86_64+0x1013e7118)
    #7 void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::emplace_back<void (*)()>(void (*&&)()) vector:1688 (ITKLabelMapTestDriver:x86_64+0x1013e0d12)
    #8 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:118 (ITKLabelMapTestDriver:x86_64+0x1013e0ac6)
    #9 itk::ThreadPool::ThreadPool() itkThreadPool.cxx:108 (ITKLabelMapTestDriver:x86_64+0x1013e0f49)
    #10 itk::ThreadPool::GetInstance()::$_2::operator()() const itkThreadPool.cxx:83 (ITKLabelMapTestDriver:x86_64+0x1013e620b)
    #11 decltype(std::__1::forward<itk::ThreadPool::GetInstance()::$_2>(fp)()) std::__1::__invoke<itk::ThreadPool::GetInstance()::$_2>(itk::ThreadPool::GetInstance()::$_2&&) type_traits:4361 (ITKLabelMapTestDriver:x86_64+0x1013e6103)
    #12 void std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::__execute<>(std::__1::__tuple_indices<>) mutex:622 (ITKLabelMapTestDriver:x86_64+0x1013e60d1)
    #13 std::__1::__call_once_param<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >::operator()() mutex:614 (ITKLabelMapTestDriver:x86_64+0x1013e6079)
    #14 void std::__1::__call_once_proxy<std::__1::tuple<itk::ThreadPool::GetInstance()::$_2&&> >(void*) mutex:650 (ITKLabelMapTestDriver:x86_64+0x1013e5f19)
    #15 __tsan::(anonymous namespace)::call_once_callback_wrapper(void*) <null>:5891728 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x69a0e)
    #16 itk::ThreadPool::GetInstance() itkThreadPool.cxx:79 (ITKLabelMapTestDriver:x86_64+0x1013e0681)
    #17 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:81 (ITKLabelMapTestDriver:x86_64+0x1013ca496)
    #18 itk::PoolMultiThreader::PoolMultiThreader() itkPoolMultiThreader.cxx:82 (ITKLabelMapTestDriver:x86_64+0x1013ca7b9)
    #19 itk::PoolMultiThreader::New() itkPoolMultiThreader.h:57 (ITKLabelMapTestDriver:x86_64+0x1013493c5)
    #20 itk::MultiThreaderBase::New() itkMultiThreaderBase.cxx:419 (ITKLabelMapTestDriver:x86_64+0x101348ef0)
    #21 itk::ProcessObject::ProcessObject() itkProcessObject.cxx:72 (ITKLabelMapTestDriver:x86_64+0x10132bf1a)
    #22 itk::ImageSource<itk::Image<unsigned char, 2u> >::ImageSource() itkImageSource.h:230 (ITKLabelMapTestDriver:x86_64+0x10000a020)
    #23 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.h:122 (ITKLabelMapTestDriver:x86_64+0x100009ef4)
    #24 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::ImageFileReader() itkImageFileReader.hxx:36 (ITKLabelMapTestDriver:x86_64+0x100009d19)
    #25 itk::ImageFileReader<itk::Image<unsigned char, 2u>, itk::DefaultConvertPixelTraits<unsigned char> >::New() itkImageFileReader.h:86 (ITKLabelMapTestDriver:x86_64+0x100008475)
    #26 itkStatisticsUniqueLabelMapFilterTest1(int, char**) itkStatisticsUniqueLabelMapFilterTest1.cxx:62 (ITKLabelMapTestDriver:x86_64+0x100af8800)
    #27 main ITKLabelMapTestDriver.cxx:513 (ITKLabelMapTestDriver:x86_64+0x100002473)

SUMMARY: ThreadSanitizer: data race itkImage.h:211 in itk::Image<unsigned char, 2u>::SetPixel(itk::Index<2u> const&, unsigned char const&)
==================
Trying writer->Update()
<DartMeasurement name="ImageError cthead1Label-label-statistics-unique-labelmap-baseline1.png" type="numeric/double">14</DartMeasurement>
<DartMeasurement name="ImageError" type="numeric/double">14</DartMeasurement>
<DartMeasurement name="ImageError Minimum" type="numeric/double">82</DartMeasurement>
<DartMeasurement name="ImageError Maximum" type="numeric/double">82</DartMeasurement>
<DartMeasurement name="ImageError Mean" type="numeric/double">82</DartMeasurement>
<DartMeasurementFile name="DifferenceImage" type="image/png">/Users/sean/external/ITK-test-bin/Testing/Temporary/itkStatisticsUniqueLabelMapFilterTest1.png.diff.png</DartMeasurementFile>
<DartMeasurementFile name="BaselineImage" type="image/png">/Users/sean/external/ITK-test-bin/Testing/Temporary/itkStatisticsUniqueLabelMapFilterTest1.png.base.png</DartMeasurementFile>
<DartMeasurementFile name="TestImage" type="image/png">/Users/sean/external/ITK-test-bin/Testing/Temporary/itkStatisticsUniqueLabelMapFilterTest1.png.test.png</DartMeasurementFile>
<DartMeasurement name="BaselineImageName" type="text/string">cthead1Label-label-statistics-unique-labelmap-baseline1.png</DartMeasurement>
<DartMeasurement name="ImageError cthead1Label-label-statistics-unique-labelmap-dilate-baseline1.png" type="numeric/double">0</DartMeasurement>
<DartMeasurement name="BaselineImageName" type="text/string">cthead1Label-label-statistics-unique-labelmap-dilate-baseline1.png</DartMeasurement>
ThreadSanitizer: reported 2 warnings
Abort trap: 6
```



Discussion / hints:
That may be the long standing issue with that test/filter! Nice find!
There's a long-standing issue?  Is there another ticket to relate this one to?
It might have gotten resolved at some point, or the test stopped failing "randomly. There was an issue.... I'm unsure of the state to be honest. But there is mention of it in the code:
https://github.com/InsightSoftwareConsortium/ITK/blob/828453d1bf61c487310d2d8c9570093e08798a40/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx#L139

https://github.com/InsightSoftwareConsortium/ITK/commit/a18b3cf00e3812c3831efecd0703e73f0134ec0b#diff-ce29fb0f5bbe68109294658b036c1a46f17abed19ce9168df44958670be4bf09

From back in the JIRA days 😃 
Most recent nightly failure: https://open.cdash.org/test/552477773. I think there was a continuous build failure just a few days ago (I am too lazy to search for it).
Great @seanm !

>I think there was a continuous build failure just a few days ago 

The test has been failing on and off, e.g. latest failure on the `master` Azure Pipelines Windows build:
https://open.cdash.org/viewTest.php?onlyfailed&buildid=7657330
https://open.cdash.org/test/579122229
I've gone through all the TSan failures, and the following all basically have the same bug:

- itkErodeObjectMorphologyImageFilterTest
- itkStatisticsUniqueLabelMapFilterTest1
- itkStatisticsUniqueLabelMapFilterTest2
- itkParallelSparseFieldLevelSetImageFilterTest
- itkNarrowBandImageFilterBaseTest
- SLICFixture.Blank2DImage
- itkSLICImageFilterTest3


Fix patch:
diff --git a/Modules/Filtering/LabelMap/ITKKWStyleOverwrite.txt b/Modules/Filtering/LabelMap/ITKKWStyleOverwrite.txt
index 833fbdf5696..3ea0f336e71 100644
--- a/Modules/Filtering/LabelMap/ITKKWStyleOverwrite.txt
+++ b/Modules/Filtering/LabelMap/ITKKWStyleOverwrite.txt
@@ -2,4 +2,5 @@ test/*\.cxx Namespace Disable
 test/itkAttributePositionLabelMapFilterTest1.cxx Namespace Disable
 test/itkShapeLabelMapFilterGTest.cxx Namespace Disable
 test/itkStatisticsLabelMapFilterGTest.cxx Namespace Disable
+test/itkUniqueLabelMapFiltersGTest.cxx Namespace Disable
 test/itkShapeLabelObjectAccessorsTest1.cxx SemicolonSpace Disable
diff --git a/Modules/Filtering/LabelMap/include/itkAttributeUniqueLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkAttributeUniqueLabelMapFilter.hxx
index 133d1266c57..11545e267bf 100644
--- a/Modules/Filtering/LabelMap/include/itkAttributeUniqueLabelMapFilter.hxx
+++ b/Modules/Filtering/LabelMap/include/itkAttributeUniqueLabelMapFilter.hxx
@@ -111,6 +111,8 @@ AttributeUniqueLabelMapFilter<TImage, TAttributeAccessor>::GenerateData()
       }
     }
 
+    assert(newMainLine || (idx[0] >= prevIdx[0]));
+
     if (newMainLine)
     {
       // just push the line
@@ -121,7 +123,7 @@ AttributeUniqueLabelMapFilter<TImage, TAttributeAccessor>::GenerateData()
       OffsetValueType prevLength = prev.line.GetLength();
       OffsetValueType length = l.line.GetLength();
 
-      if (prevIdx[0] + prevLength >= idx[0])
+      if (prevIdx[0] + prevLength > idx[0])
       {
         // the lines are overlapping. We need to choose which line to keep.
         // the label, the only "attribute" to be guaranteed to be unique, is
@@ -193,7 +195,7 @@ AttributeUniqueLabelMapFilter<TImage, TAttributeAccessor>::GenerateData()
           // keep the previous one. If the previous line fully overlap the
           // current one,
           // the current one is fully discarded.
-          if (prevIdx[0] + prevLength > idx[0] + length)
+          if (prevIdx[0] + prevLength >= idx[0] + length)
           {
             // discarding the current line - just do nothing
           }
@@ -202,9 +204,15 @@ AttributeUniqueLabelMapFilter<TImage, TAttributeAccessor>::GenerateData()
             IndexType newIdx = idx;
             newIdx[0] = prevIdx[0] + prevLength;
             OffsetValueType newLength = idx[0] + length - newIdx[0];
-            l.line.SetIndex(newIdx);
-            l.line.SetLength(newLength);
-            lines.push_back(l);
+
+            if (newLength > 0)
+            {
+              l.line.SetIndex(newIdx);
+              l.line.SetLength(newLength);
+              // The front of this line is trimmed, it may occur after a line in the queue
+              // so the queue is used for the proper ordering.
+              pq.push(l);
+            }
           }
         }
       }
diff --git a/Modules/Filtering/LabelMap/include/itkShapeUniqueLabelMapFilter.h b/Modules/Filtering/LabelMap/include/itkShapeUniqueLabelMapFilter.h
index 9fdaf98df0a..8ff188ab566 100644
--- a/Modules/Filtering/LabelMap/include/itkShapeUniqueLabelMapFilter.h
+++ b/Modules/Filtering/LabelMap/include/itkShapeUniqueLabelMapFilter.h
@@ -177,6 +177,8 @@ class ITK_TEMPLATE_EXPORT ShapeUniqueLabelMapFilter : public InPlaceLabelMapFilt
         }
       }
 
+      assert(newMainLine || (idx[0] >= prevIdx[0]));
+
       if (newMainLine)
       {
         // just push the line
@@ -187,7 +189,7 @@ class ITK_TEMPLATE_EXPORT ShapeUniqueLabelMapFilter : public InPlaceLabelMapFilt
         OffsetValueType prevLength = prev.line.GetLength();
         OffsetValueType length = l.line.GetLength();
 
-        if (prevIdx[0] + prevLength >= idx[0])
+        if (prevIdx[0] + prevLength > idx[0])
         {
           // the lines are overlapping. We need to choose which line to keep.
           // the label, the only "attribute" to be guaranteed to be unique, is
@@ -244,6 +246,7 @@ class ITK_TEMPLATE_EXPORT ShapeUniqueLabelMapFilter : public InPlaceLabelMapFilt
             prevLength = idx[0] - prevIdx[0];
             if (prevLength != 0)
             {
+              assert(prevIdx[0] <= idx[0]);
               lines.back().line.SetLength(idx[0] - prevIdx[0]);
             }
             else
@@ -259,7 +262,7 @@ class ITK_TEMPLATE_EXPORT ShapeUniqueLabelMapFilter : public InPlaceLabelMapFilt
             // keep the previous one. If the previous line fully overlap the
             // current one,
             // the current one is fully discarded.
-            if (prevIdx[0] + prevLength > idx[0] + length)
+            if (prevIdx[0] + prevLength >= idx[0] + length)
             {
               // discarding the current line - just do nothing
             }
@@ -268,9 +271,14 @@ class ITK_TEMPLATE_EXPORT ShapeUniqueLabelMapFilter : public InPlaceLabelMapFilt
               IndexType newIdx = idx;
               newIdx[0] = prevIdx[0] + prevLength;
               OffsetValueType newLength = idx[0] + length - newIdx[0];
-              l.line.SetIndex(newIdx);
-              l.line.SetLength(newLength);
-              lines.push_back(l);
+              if (newLength > 0)
+              {
+                l.line.SetIndex(newIdx);
+                l.line.SetLength(newLength);
+                // The front of this line is trimmed, it may occur after a line in the queue
+                // so the queue is used for the proper ordering.
+                priorityQueue.push(l);
+              }
             }
           }
         }


Test patch:
diff --git a/Modules/Filtering/LabelMap/test/CMakeLists.txt b/Modules/Filtering/LabelMap/test/CMakeLists.txt
index dac23bd4f7c..0e15f959ea8 100644
--- a/Modules/Filtering/LabelMap/test/CMakeLists.txt
+++ b/Modules/Filtering/LabelMap/test/CMakeLists.txt
@@ -1569,14 +1569,10 @@ itk_add_test(
   --compare
   DATA{Baseline/cthead1Label-label-statistics-unique-labelmap-baseline1.png}
   ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterTest1.png
-  --compare
-  DATA{Baseline/cthead1Label-label-statistics-unique-labelmap-dilate-baseline1.png}
-  ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterDilationStability1.png
   itkStatisticsUniqueLabelMapFilterTest1
   DATA{${ITK_DATA_ROOT}/Input/cthead1Label.png}
   DATA{${ITK_DATA_ROOT}/Input/cthead1.png}
   ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterTest1.png
-  ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterDilationStability1.png
   0
   100)
 itk_add_test(
@@ -1587,19 +1583,17 @@ itk_add_test(
   --compare
   DATA{Baseline/cthead1Label-label-statistics-unique-labelmap-baseline2.png}
   ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterTest2.png
-  --compare
-  DATA{Baseline/cthead1Label-label-statistics-unique-labelmap-dilate-baseline2.png}
-  ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterDilationStability2.png
   --compareNumberOfPixelsTolerance
   35
   itkStatisticsUniqueLabelMapFilterTest1
   DATA{${ITK_DATA_ROOT}/Input/cthead1Label.png}
   DATA{${ITK_DATA_ROOT}/Input/cthead1.png}
   ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterTest2.png
-  ${ITK_TEST_OUTPUT_DIR}/itkStatisticsUniqueLabelMapFilterDilationStability2.png
   1
   100)
 
-set(ITKLabelMapGTests itkShapeLabelMapFilterGTest.cxx itkStatisticsLabelMapFilterGTest.cxx)
+set(ITKLabelMapGTests itkShapeLabelMapFilterGTest.cxx
+        itkStatisticsLabelMapFilterGTest.cxx
+        itkUniqueLabelMapFiltersGTest.cxx)
 
 creategoogletestdriver(ITKLabelMap "${ITKLabelMap-Test_LIBRARIES}" "${ITKLabelMapGTests}")
diff --git a/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx b/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx
index c98f058a9ba..5d0a660fd1e 100644
--- a/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx
+++ b/Modules/Filtering/LabelMap/test/itkStatisticsUniqueLabelMapFilterTest1.cxx
@@ -29,16 +29,47 @@
 #include "itkGrayscaleDilateImageFilter.h"
 #include "itkObjectByObjectLabelMapFilter.h"
 
+template <typename TLabelMap>
+int
+CheckLabelMapOverlap(TLabelMap * labelMap)
+{
+  int exitCode = EXIT_SUCCESS;
+
+  for (auto & labelObject : labelMap->GetLabelObjects())
+  {
+    // Manually check each label object against all other label objects, to ensure that no two label objects share an
+    // index.
+    for (itk::SizeValueType lineNumber = 0; lineNumber < labelObject->GetNumberOfLines(); ++lineNumber)
+    {
+      auto line = labelObject->GetLine(lineNumber);
+      auto idx = line.GetIndex();
+      ITK_TEST_EXPECT_TRUE(line.GetLength() <= labelObject->GetNumberOfPixels());
+      for (itk::SizeValueType lengthIndex = 0; lengthIndex < line.GetLength(); ++lengthIndex)
+      {
+        for (auto & checkObject : labelMap->GetLabelObjects())
+        {
+          if (checkObject != labelObject && checkObject->HasIndex(idx))
+          {
+            std::cerr << "Label: " << int(labelObject->GetLabel()) << " and " << int(checkObject->GetLabel())
+                      << " has index " << idx << std::endl;
+            exitCode = EXIT_FAILURE;
+          }
+        }
+        ++idx[0];
+      }
+    }
+  }
+  return exitCode;
+}
+
 int
 itkStatisticsUniqueLabelMapFilterTest1(int argc, char * argv[])
 {
-  // ToDo: remove dilationOutput once the JIRA issue 3370 has been solved
-  // Then, argc != 6
-  if (argc != 7)
+  if (argc != 6)
   {
     std::cerr << "Missing parameters." << std::endl;
     std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
-    std::cerr << " input feature output dilationOutput";
+    std::cerr << " input feature output";
     std::cerr << " reverseOrdering attribute";
     std::cerr << std::endl;
     return EXIT_FAILURE;
@@ -46,9 +77,8 @@ itkStatisticsUniqueLabelMapFilterTest1(int argc, char * argv[])
   const char *       inputImage = argv[1];
   const char *       featureImage = argv[2];
   const char *       outputImage = argv[3];
-  const char *       dilationOutput = argv[4];
-  const bool         reverseOrdering = std::stoi(argv[5]);
-  const unsigned int attribute = std::stoi(argv[6]);
+  const bool         reverseOrdering = std::stoi(argv[4]);
+  const unsigned int attribute = std::stoi(argv[5]);
 
   constexpr unsigned int Dimension = 2;
 
@@ -123,6 +153,15 @@ itkStatisticsUniqueLabelMapFilterTest1(int argc, char * argv[])
 
   itk::SimpleFilterWatcher watcher(unique, "filter");
 
+  ITK_TRY_EXPECT_NO_EXCEPTION(unique->Update());
+
+  int exitCode = CheckLabelMapOverlap(unique->GetOutput());
+
+  if (exitCode == EXIT_FAILURE)
+  {
+    std::cerr << "Overlap detected in the label map." << std::endl;
+  }
+
   using LabelMapToImageFilterType = itk::LabelMapToLabelImageFilter<LabelMapType, ImageType>;
   auto labelMapToImageFilter = LabelMapToImageFilterType::New();
   labelMapToImageFilter->SetInput(unique->GetOutput());
@@ -135,14 +174,7 @@ itkStatisticsUniqueLabelMapFilterTest1(int argc, char * argv[])
 
   ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update());
 
-
-  // WARNING: TEMPORARY: JIRA ISSUE 3370
-  // Writing an additional output of just the dilated label
-  writer->SetInput(grayscaleDilateFilter->GetOutput());
-  writer->SetFileName(dilationOutput);
-  writer->UseCompressionOn();
-
   ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update());
 
-  return EXIT_SUCCESS;
+  return exitCode;
 }
diff --git a/Modules/Filtering/LabelMap/test/itkUniqueLabelMapFiltersGTest.cxx b/Modules/Filtering/LabelMap/test/itkUniqueLabelMapFiltersGTest.cxx
new file mode 100644
index 00000000000..ae1c3957cfb
--- /dev/null
+++ b/Modules/Filtering/LabelMap/test/itkUniqueLabelMapFiltersGTest.cxx
@@ -0,0 +1,309 @@
+/*=========================================================================
+ *
+ *  Copyright NumFOCUS
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *         https://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *=========================================================================*/
+
+#include "itkGTest.h"
+
+#include "itkImage.h"
+#include "itkLabelImageToStatisticsLabelMapFilter.h"
+#include "itkImageFileWriter.h"
+#include <algorithm>
+
+
+#include "itkLabelImageToLabelMapFilter.h"
+#include "itkObjectByObjectLabelMapFilter.h"
+#include "itkShapeLabelObjectAccessors.h"
+#include "itkFlatStructuringElement.h"
+#include "itkBinaryDilateImageFilter.h"
+#include "itkLabelUniqueLabelMapFilter.h"
+#include "itkTestingHashImageFilter.h"
+#include "itksys/SystemTools.hxx"
+#include "itkTestDriverIncludeRequiredFactories.h"
+
+
+namespace
+{
+
+class UniqueLabelMapFixture : public ::testing::Test
+{
+public:
+  UniqueLabelMapFixture() = default;
+  ~UniqueLabelMapFixture() override = default;
+
+protected:
+  void
+  SetUp() override
+  {
+    RegisterRequiredFactories();
+  }
+  void
+  TearDown() override
+  {}
+
+  std::string
+  GetTestName() const
+  {
+    return ::testing::UnitTest::GetInstance()->current_test_info()->name();
+  }
+
+  template <unsigned int D, typename TPixelType = unsigned short>
+  struct FixtureUtilities
+  {
+    static const unsigned int Dimension = D;
+
+    using LabelPixelType = TPixelType;
+    using LabelImageType = itk::Image<LabelPixelType, Dimension>;
+    using IndexType = typename LabelImageType::IndexType;
+
+    using LabelObjectType = itk::StatisticsLabelObject<LabelPixelType, Dimension>;
+
+    using LabelMapType = itk::LabelMap<itk::LabelObject<LabelPixelType, Dimension>>;
+
+
+    static typename LabelImageType::Pointer
+    CreateLabelImage(const std::vector<IndexType> & indices)
+    {
+      const size_t size = 25;
+      auto         image = LabelImageType::New();
+
+      typename LabelImageType::SizeType imageSize;
+      imageSize.Fill(size);
+      image->SetRegions(typename LabelImageType::RegionType(imageSize));
+      image->Allocate();
+      image->FillBuffer(0);
+
+      for (LabelPixelType id = 0; id < indices.size(); ++id)
+      {
+        image->SetPixel(indices[id], id + 1);
+      }
+      return image;
+    }
+
+    static typename LabelMapType::Pointer
+    LabelMapFromLabelImage(const LabelImageType * image, unsigned int dilateRadius = 0)
+    {
+      using ToLabelMapType = itk::LabelImageToLabelMapFilter<LabelImageType>;
+      auto toLabelMap = ToLabelMapType::New();
+      toLabelMap->SetInput(image);
+
+      if (dilateRadius == 0)
+      {
+        toLabelMap->Update();
+        return toLabelMap->GetOutput();
+      }
+
+      using KernelType = itk::FlatStructuringElement<Dimension>;
+      using DilateType = itk::BinaryDilateImageFilter<LabelImageType, LabelImageType, KernelType>;
+      auto                          dilate = DilateType::New();
+      typename KernelType::SizeType rad;
+      rad.Fill(dilateRadius);
+      dilate->SetKernel(KernelType::Ball(rad));
+
+
+      using OIType = itk::ObjectByObjectLabelMapFilter<LabelMapType, LabelMapType, DilateType>;
+      auto oi = OIType::New();
+      oi->SetInput(toLabelMap->GetOutput());
+      oi->SetFilter(dilate);
+      oi->SetPadSize(rad);
+
+      oi->Update();
+
+      return oi->GetOutput();
+    }
+  };
+
+  template <typename TLabelMap>
+  static typename itk::Image<typename TLabelMap::LabelObjectType::LabelType, TLabelMap::ImageDimension>::Pointer
+  LabelMapToLabelImage(TLabelMap * labelMap)
+  {
+    using ImageType = itk::Image<typename TLabelMap::LabelObjectType::LabelType, TLabelMap::ImageDimension>;
+    using L2IType = itk::LabelMapToLabelImageFilter<TLabelMap, ImageType>;
+    auto l2i = L2IType::New();
+    l2i->SetInput(labelMap);
+    l2i->Update();
+    return l2i->GetOutput();
+  }
+
+
+  template <typename TLabelMap>
+  void
+  CheckLabelMapOverlap(TLabelMap * labelMap)
+  {
+    for (auto & labelObject : labelMap->GetLabelObjects())
+    {
+      // Manually check each label object against all other label objects, to ensure that no two label objects share an
+      // index.
+      for (itk::SizeValueType lineNumber = 0; lineNumber < labelObject->GetNumberOfLines(); ++lineNumber)
+      {
+        auto line = labelObject->GetLine(lineNumber);
+        auto idx = line.GetIndex();
+        ASSERT_LE(line.GetLength(), labelObject->Size());
+        for (itk::SizeValueType lengthIndex = 0; lengthIndex < line.GetLength(); ++lengthIndex)
+        {
+          for (auto & checkObject : labelMap->GetLabelObjects())
+          {
+            if (checkObject != labelObject)
+            {
+              EXPECT_FALSE(checkObject->HasIndex(idx))
+                << "Label: " << int(labelObject->GetLabel()) << " and " << int(checkObject->GetLabel()) << " has index "
+                << idx << std::endl;
+            }
+          }
+          ++idx[0];
+        }
+      }
+    }
+  }
+
+  template <typename TImageType>
+  static std::string
+  MD5Hash(const TImageType * image)
+  {
+
+    using HashFilter = itk::Testing::HashImageFilter<TImageType>;
+    auto hasher = HashFilter::New();
+    hasher->SetInput(image);
+    hasher->InPlaceOff();
+    hasher->Update();
+    return hasher->GetHash();
+  }
+};
+} // namespace
+
+
+TEST_F(UniqueLabelMapFixture, EmptyImage)
+{
+  const std::vector<typename FixtureUtilities<2>::IndexType> indices = {};
+  auto                                                       image = FixtureUtilities<2>::CreateLabelImage(indices);
+  auto labelMap = FixtureUtilities<2>::LabelMapFromLabelImage(image.GetPointer(), 15);
+
+  auto filter = itk::LabelUniqueLabelMapFilter<typename decltype(labelMap)::ObjectType>::New();
+  filter->SetInput(labelMap);
+
+  CheckLabelMapOverlap(filter->GetOutput());
+  filter->Update();
+
+  auto out = LabelMapToLabelImage(filter->GetOutput());
+
+  // check the hash of out, should be all zeros
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "393017b9101a884b66d64849d99a7d05");
+}
+
+
+TEST_F(UniqueLabelMapFixture, OneLabel)
+{
+  const std::vector<typename FixtureUtilities<2>::IndexType> indices = { { 10, 10 } };
+  auto                                                       image = FixtureUtilities<2>::CreateLabelImage(indices);
+  auto labelMap = FixtureUtilities<2>::LabelMapFromLabelImage(image.GetPointer(), 0);
+
+  auto filter = itk::LabelUniqueLabelMapFilter<typename decltype(labelMap)::ObjectType>::New();
+  filter->SetInput(labelMap);
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  auto out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), MD5Hash(image.GetPointer()));
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "9c8ee8f2fe887fd6d2393d6416df3fb6");
+}
+
+
+TEST_F(UniqueLabelMapFixture, OnesLabel)
+{
+  const std::vector<typename FixtureUtilities<2>::IndexType> indices = { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
+                                                                         { 0, 4 }, { 2, 4 }, { 0, 5 } };
+  auto                                                       image = FixtureUtilities<2>::CreateLabelImage(indices);
+  auto labelMap = FixtureUtilities<2>::LabelMapFromLabelImage(image.GetPointer(), 0);
+
+  auto filter = itk::LabelUniqueLabelMapFilter<typename decltype(labelMap)::ObjectType>::New();
+  filter->SetInput(labelMap);
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  auto out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), MD5Hash(image.GetPointer()));
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "220048b56395d98a8f20a5b1733bdde6");
+}
+
+
+TEST_F(UniqueLabelMapFixture, Dilate1)
+{
+  const std::vector<typename FixtureUtilities<2>::IndexType> indices = { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
+                                                                         { 0, 4 }, { 2, 4 }, { 0, 10 } };
+  auto                                                       image = FixtureUtilities<2>::CreateLabelImage(indices);
+  auto labelMap = FixtureUtilities<2>::LabelMapFromLabelImage(image.GetPointer(), 1);
+
+  auto filter = itk::LabelUniqueLabelMapFilter<typename decltype(labelMap)::ObjectType>::New();
+  filter->SetInput(labelMap);
+  filter->InPlaceOff();
+  filter->ReverseOrderingOff();
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  auto out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "8bfc8570ee203fa68be18fe055cf389d");
+  itk::WriteImage(out.GetPointer(), GetTestName() + "_off.png");
+
+  filter->ReverseOrderingOn();
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "bef76c79168969548f1a8090d46b5f7e");
+  itk::WriteImage(out.GetPointer(), GetTestName() + "_on.png");
+}
+
+
+TEST_F(UniqueLabelMapFixture, Dilate2)
+{
+  const std::vector<typename FixtureUtilities<2>::IndexType> indices = { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 },
+                                                                         { 0, 4 }, { 2, 4 }, { 0, 5 } };
+  auto                                                       image = FixtureUtilities<2>::CreateLabelImage(indices);
+  auto labelMap = FixtureUtilities<2>::LabelMapFromLabelImage(image.GetPointer(), 2);
+
+  auto filter = itk::LabelUniqueLabelMapFilter<typename decltype(labelMap)::ObjectType>::New();
+  filter->SetInput(labelMap);
+  filter->InPlaceOff();
+  filter->ReverseOrderingOff();
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  auto out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "02ec62c193413dd82cb0feaee1ee0b12");
+  itk::WriteImage(out.GetPointer(), GetTestName() + "_off.png");
+
+
+  filter->ReverseOrderingOn();
+  filter->Update();
+
+  CheckLabelMapOverlap(filter->GetOutput());
+
+  out = LabelMapToLabelImage(filter->GetOutput());
+
+  EXPECT_EQ(MD5Hash(out.GetPointer()), "1c6901199b01ac095511792f447578a3");
+
+  itk::WriteImage(out.GetPointer(), GetTestName() + "_on.png");
+}