-
-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wip explicit instantiation #1
Closed
hjmjohnson
wants to merge
7
commits into
InsightSoftwareConsortium:master
from
hjmjohnson:WIP_ExplicitInstantiation
Closed
Wip explicit instantiation #1
hjmjohnson
wants to merge
7
commits into
InsightSoftwareConsortium:master
from
hjmjohnson:WIP_ExplicitInstantiation
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kwrobot
pushed a commit
that referenced
this pull request
Nov 30, 2012
This addresses bug reported here: https://itk.icts.uiowa.edu/jira/browse/HISTITK-812 The problem comes up because the ImageSeriesReader re-uses one instance of the ImageIO to read all files, and the GDCMImageIO uses its own in-built MetaDataDictionary to record all the DICOM tags. It was populating the dictionary without first clearing it, so if file #1 had a particular DICOM tag, but file #2 did not, the tag would still show up in the MetaDataDictionary for file #2. This is fixed by adding a Clear method to MetaDataDictionary, and calling it in GDCMImageio::GetImageInformation before populating the MetaDataDictionary with DICOM tags. Change-Id: I26c6c16719ceb848ae69f6220fa3c78d524a8316
In order to profile external applicstion built upon itk efficiently, ITK core libary should be built in an optimized mode, and only your application components that need debugging should be built with debug instrumentation. It was found that the itkIndex was the largest peformance bottle neck because it was only defined in the header, and therefore it was not possible to separate the optimization of the itkIndex class from the algorithm that needed debugging. By putting the itkIndex<3u> implementation in a highly optimized separate compilation unit, the real performance issues of the external application becomes much easier to debug. In order to get extern templates to work it is REQUIRED that the definition of the member functions occurs outside of the class. Any definition of member functions that occur inside the class are always assumed to be inline and are therefore ignored by the "extern template", thus they are compiled into every compilation unit ignoring the benefits of separate one-time comiplation. Change-Id: Ia806af7a0deb183a1b292f08e107433a16494bbf
Change-Id: I624425a0e0edb77405c36166ec99f0fd78a8c2f2
In the ITK toolkit, promote a more consistent naming scheme for types by standardizing on the C99 stdint.h types. By using these more consistently named types, it will be easier uniquely define explicit instantiation and wrappping types. For example on most platforms char = unisgned char = uint8_t Which one of those should be wrapped? Change-Id: I4dfbfefe98fe06b4d0e7a3f0010d29385c101982
Change-Id: Ida355399dd4d5f5b9e3ed54100696a3b6c7d72d6
Move some code around to allow some of the itkOffset and itkSize to be explicitly instantiated. Change-Id: I93bb902a7ede03724117695c0f565c2fa29f50ab
Change-Id: If1b7a63e817c718e934d4f58547a6dd326d3c193
Change-Id: Id09bcc878eac5947623045e840ce4066368b0d68
kwrobot
pushed a commit
that referenced
this pull request
Oct 9, 2013
For Coverity scan : CID 1081375 (#1 of 1): Uninitialized scalar variable (UNINIT) 25. uninit_use_in_call: Using uninitialized value "*transformMatrix" when calling "MetaObject::TransformMatrix(double const *)". Change-Id: I6b82c9b73f8aa52fc6e16604f9caf748c7384664
kwrobot
pushed a commit
that referenced
this pull request
Oct 11, 2013
Coverity Scan: CID 1081055 (#1 of 1): Out-of-bounds access (OVERRUN) 41. overrun-call: Overrunning callee's array of size 4 by passing argument "op" (which evaluates to 4) in call to "itk::FixedArray<itk::Neighborhood<double, 2u, itk::NeighborhoodAllocator<double> >, 4u>::operator [](unsigned int)".[hide details] Change-Id: I96715fc7674d7adb7dc0becfa68f2aa541a3fb1a
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1081076 (#1 of 8): Resource leak (RESOURCE_LEAK) All 8 leaks were similiar. labelLine was not being removed for EXIT_FAILURE. Change-Id: Idefc8cb9b9d6afaaa47424d2182f803961ba1d57
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1081073 (#1 of 84): Resource leak (RESOURCE_LEAK) All 4 leaks were similiar. low, high and lowhigh were not being removed for EXIT_FAILURE. Change-Id: I16985608942d6ac089719c7ba4135f34f2c7f3c1
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1103571 (#1 of 1): Uninitialized scalar variable (UNINIT) 11. uninit_use: Using uninitialized value "NW". switch statement did not have a default:. Added default: that throws exception with an informative message. Change-Id: Ic176d180ebd518cfa2509b12c5f8af2140e6685b
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1103201 (#1 of 1): Unbounded source buffer (STRING_SIZE) string_size: Passing string "argv[2]" of unknown size to "sprintf(char *, char const *, ...)". Replaced sprintf with ostringstream. Change-Id: Id06d694ff36c025c248d7357cc78eef523bb719d
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1106738 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING) Its a good practice to use memcpy over strncpy for non-null terminated char sequences. Change-Id: Icd4373c0528e46f007dba5f3246eb9538ef11867
kwrobot
pushed a commit
that referenced
this pull request
Nov 7, 2013
CID 1106758 (#1 of 1): Out-of-bounds access (OVERRUN) It is preferred to use std::string constructors with count the c-string length as opposed to manually specifying the length with is error prone. Change-Id: Iad6ccb87fb9fba90bf6c13db26284d50662999b2
kwrobot
pushed a commit
that referenced
this pull request
Nov 8, 2013
CID 1103098 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING) buffer_size_warning: Calling strncpy with a maximum size argument of 2049 bytes on destination array "curImage->filename" of size 2049 bytes might leave the destination string unterminated. Change-Id: I2ed96404b9b2374a84406d6ea3d46b70006ae6a5
kwrobot
pushed a commit
that referenced
this pull request
Nov 8, 2013
CID 1103199 (#1 of 4): Destination buffer too small (STRING_OVERFLOW) string_overflow: You might overrun the 35 byte destination string "hdr->hospital" by writing 2049 bytes from "tmpStr" CID 1103199 (#2 of 4): Destination buffer too small (STRING_OVERFLOW) string_overflow: You might overrun the 32 byte destination string "hdr->scanId" by writing 2049 bytes from "tmpStr". CID 1103199 (#3 of 4): Destination buffer too small (STRING_OVERFLOW) string_overflow: You might overrun the 32 byte destination string "hdr->patientId" by writing 2049 bytes from "tmpStr". CID 1103199 (#4 of 4): Destination buffer too small (STRING_OVERFLOW) string_overflow: You might overrun the 32 byte destination string "hdr->date" by writing 2049 bytes from "tmpStr". In all cases, strcpy was replaced with strncpy. Change-Id: I9955d3c34970b89dfddaa233dfbcb8943166f1be
kwrobot
pushed a commit
that referenced
this pull request
Nov 11, 2013
Fix covertity bug reported as: CID 1081081 (#1 of 8): Resource leak (RESOURCE_LEAK) 8. leaked_storage: Variable "quadEdge1" going out of scope leaks the storage it points to. Change-Id: Ieb026e5d4917524396a783d3504c3f893790087e
kwrobot
pushed a commit
that referenced
this pull request
Nov 11, 2013
Fix two resource leaks reported by Coverity: CID 1081083 (#1 of 1): Resource leak (RESOURCE_LEAK) 7. leaked_storage: Variable "array" going out of scope leaks the storage it points to CID 1081082 (#1 of 1): Resource leak (RESOURCE_LEAK) 14. leaked_storage: Variable "matrix" going out of scope leaks the storage it points to. Change-Id: Ib96e618c4239ec82d90f5822a1b5f5812d9067aa
kwrobot
referenced
this pull request
in Kitware/ITK
Feb 21, 2014
From Coverity: CID 1175336 (#1 of 1): Unchecked dynamic_cast (FORWARD_NULL) 4. var_deref_model: Passing null pointer "optimizer" to function "itk::RegularStepGradientDescentBaseOptimizer::GetCurrentIteration() const", which dereferences it. (The dereference happens because this is a virtual function call.) Change-Id: Ie49596c0db7b413f37cdce4bb2332360f535588e
hjmjohnson
referenced
this pull request
in BRAINSia/ITK
May 10, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
hjmjohnson
referenced
this pull request
in BRAINSia/ITK
May 12, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
hjmjohnson
referenced
this pull request
in BRAINSia/ITK
May 14, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
hjmjohnson
referenced
this pull request
in BRAINSia/ITK
May 14, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
hjmjohnson
referenced
this pull request
in BRAINSia/ITK
May 16, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
kwrobot
pushed a commit
that referenced
this pull request
May 22, 2014
A temporary jacobian value was always created for and resized at every iteration of the program call. This was increadibly in-efficient during registrations and was the #1 time consuming portion of the code for many registration examples. The new function: ComputeJacobianWithRespectToParametersCachedTemporaries was created to allow for improved performance. Change-Id: Ic405b9d26c5fdf3660941372e9bb9814c2792143
Should this pull request be closed?? |
jcfr
added a commit
to jcfr/ITK
that referenced
this pull request
Dec 16, 2015
…tern". This commit updates explicit instantiation to use "extern" keyword similarly to what was done in InsightSoftwareConsortium/ITK@b72726c (BUG: Explicitly instantiate common MetaDataObjects). By using the recommended approach for template instantiation, this commit should also fix TransformReadWriteTest where TransformIO failed to be successfully instantiated. Here is the error that was reported when the was compiled on MacOSX using clang-6.0: libc++abi.dylib: terminating with uncaught exception of type itk::ExceptionObject: /scratch/dashboards/MacOSX-clang6/ITK/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx:212: itk::ERROR: TransformFileWriterTemplate(0x7fa552100f10): The input of writer should be whether a double precision or a single precision transform type. Called from TransformFileWriterTemplate<double,double$ It also updates IOTransformDCMTK remote module to include a similar fix. Note InsightSoftwareConsortium#1: To shut up the following warning from gcc, context specific "pragma GCC diagnostic" preprocessor instructions have been added: warning: type attributes ignored after type is already defined [-Wattributes] This is most likely specific to gcc (see issue #39159), and at the time of this commit there were no resolution or information about gcc version where the "problem" is addressed. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159 For that reason, the "pragma GCC diagnostic" is applied in-conditionally of the gcc version being used. Note InsightSoftwareConsortium#2: While "extern" is only part of the c++ standard starting with c++11 (see section 14.7.2 of the standard), it is supported by Visual Studio 2008, GCC and Clang using compiler specific extension in earlier version: * Visual Studio 2008: https://msdn.microsoft.com/en-us/library/by56e477(v=vs.90).aspx * Gcc: https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/Template-Instantiation.html#Template-Instantiation * Clang (since v2.9): http://clang.llvm.org/cxx_status.html For completeness, initial draft of the "extern" keyword were first introduced in 2003 [1] and then revised in 2006 [2], and ultimately standardized in c++11 [3]: [1] N1448: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1448.pdf [2] N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm [3] N3242: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/ See InsightSoftwareConsortium#3393 Suggested-by: Bradley Lowekamp <blowekamp@mail.nih.gov> Co-authored-by: Bradley Lowekamp <blowekamp@mail.nih.gov> Change-Id: I2e3ca2843c500b9bb60bbffc5f3629bc5be0a6fd
kwrobot
pushed a commit
that referenced
this pull request
Dec 17, 2015
…tern". This commit updates explicit instantiation to use "extern" keyword similarly to what was done in b72726c (BUG: Explicitly instantiate common MetaDataObjects). By using the recommended approach for template instantiation, this commit should also fix TransformReadWriteTest where TransformIO failed to be successfully instantiated. Here is the error that was reported when the was compiled on MacOSX using clang-6.0: libc++abi.dylib: terminating with uncaught exception of type itk::ExceptionObject: /scratch/dashboards/MacOSX-clang6/ITK/Modules/IO/TransformBase/src/itkTransformFileWriterSpecializations.cxx:212: itk::ERROR: TransformFileWriterTemplate(0x7fa552100f10): The input of writer should be whether a double precision or a single precision transform type. Called from TransformFileWriterTemplate<double,double$ It also updates IOTransformDCMTK remote module to include a similar fix. Note #1: To shut up the following warning from gcc, context specific "pragma GCC diagnostic" preprocessor instructions have been added: warning: type attributes ignored after type is already defined [-Wattributes] This is most likely specific to gcc (see issue #39159), and at the time of this commit there were no resolution or information about gcc version where the "problem" is addressed. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159 For that reason, the "pragma GCC diagnostic" is applied in-conditionally of the gcc version being used. Note #2: While "extern" is only part of the c++ standard starting with c++11 (see section 14.7.2 of the standard), it is supported by Visual Studio 2008, GCC and Clang using compiler specific extension in earlier version: * Visual Studio 2008: https://msdn.microsoft.com/en-us/library/by56e477(v=vs.90).aspx * Gcc: https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/Template-Instantiation.html#Template-Instantiation * Clang (since v2.9): http://clang.llvm.org/cxx_status.html For completeness, initial draft of the "extern" keyword were first introduced in 2003 [1] and then revised in 2006 [2], and ultimately standardized in c++11 [3]: [1] N1448: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1448.pdf [2] N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm [3] N3242: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/ See #3393 Suggested-by: Bradley Lowekamp <blowekamp@mail.nih.gov> Co-authored-by: Bradley Lowekamp <blowekamp@mail.nih.gov> Change-Id: I2e3ca2843c500b9bb60bbffc5f3629bc5be0a6fd
kwrobot
pushed a commit
that referenced
this pull request
Apr 25, 2017
Allow external modules to be reported about the values the ITK BUILD_EXAMPLES and BUILD_DOCUMENTATION flags have so that building their own examples and documentation can be dependent on the general ITK options. This patch is motivated by the discussion about PR #1 in https://github.com/InsightSoftwareConsortium/ITKPrincipalComponentAnalysis Change-Id: Ib829b9c7fcde4568888f08b4bba09d9e1a2f7431
kwrobot
pushed a commit
that referenced
this pull request
Aug 15, 2017
Bradley Lowekamp (7): BUG: Always request the full input image ENH: replace run-time check of dimension with concept check ENH: Prefer raw pointers in pipeline methods ENH: Prefer FillBuffer over iterator loop ENH: Remove unneeded negative input COMP: Fix warning about variable index being shadowed Merge pull request #3 from blowekamp/FixShadowWarning Francois Budin (2): Merge pull request #1 from blowekamp/PipelineFixesAndImprovements Merge pull request #2 from blowekamp/Improvements Change-Id: Ica14efa46f5ee2ef7d38ab9b22999f69f98b3eb6
kwrobot
pushed a commit
that referenced
this pull request
Aug 17, 2017
Bradley Lowekamp (7): BUG: Always request the full input image ENH: replace run-time check of dimension with concept check ENH: Prefer raw pointers in pipeline methods ENH: Prefer FillBuffer over iterator loop ENH: Remove unneeded negative input COMP: Fix warning about variable index being shadowed Merge pull request #3 from blowekamp/FixShadowWarning Francois Budin (2): Merge pull request #1 from blowekamp/PipelineFixesAndImprovements Merge pull request #2 from blowekamp/Improvements Change-Id: Ica14efa46f5ee2ef7d38ab9b22999f69f98b3eb6
muschellij2
pushed a commit
to muschellij2/ITK
that referenced
this pull request
Oct 18, 2018
Added The new fixes for windows
HastingsGreer
pushed a commit
to HastingsGreer/ITK
that referenced
this pull request
Feb 8, 2019
…tialObjectsV5-ImageSpatialObject BUG: ImageSpatialObject's BoundingBox broken if not axis aligned
1 task
2 tasks
Leengit
referenced
this pull request
in dzenanz/ITK
Mar 3, 2021
7 tasks
tbirdso
added a commit
to tbirdso/ITK
that referenced
this pull request
Nov 10, 2021
tbirdso
added a commit
to tbirdso/ITK
that referenced
this pull request
Nov 12, 2021
fbordignon
added a commit
to fbordignon/ITK
that referenced
this pull request
Jan 20, 2023
Hello, I was having trouble with an external python calling the itk function as shared below. The ?? sometimes indicates a callback but to be sure I searched all instances of H5VL_group_close and only H5G__close_cb was calling it and it is currently unmangled. I will test this soon and report back. <details> ``` #0 0x00007febfdaa8b49 in itk_H5CX_get_vol_wrap_ctx () from /home/gabriel/g/bin/../lib/GeoSlicer-5.1/libitkhdf5-shared-5.3.so.1 InsightSoftwareConsortium#1 0x00007febfdd23a44 in itk_H5VL_set_vol_wrapper () from /home/gabriel/g/bin/../lib/GeoSlicer-5.1/libitkhdf5-shared-5.3.so.1 InsightSoftwareConsortium#2 0x00007febfdd1870b in itk_H5VL_group_close () from /home/gabriel/g/bin/../lib/GeoSlicer-5.1/libitkhdf5-shared-5.3.so.1 InsightSoftwareConsortium#3 0x00007febfdb4b11d in ?? () from /home/gabriel/g/bin/../lib/GeoSlicer-5.1/libitkhdf5-shared-5.3.so.1 InsightSoftwareConsortium#4 0x00007fead7b7d480 in H5I_dec_ref () from /home/gabriel/g/lib/Python/lib/python3.9/site-packages/h5py/../h5py.libs/libhdf5-346dbfc8.so.200.1.0 InsightSoftwareConsortium#5 0x00007fead7b7d544 in H5I_dec_app_ref () from /home/gabriel/g/lib/Python/lib/python3.9/site-packages/h5py/../h5py.libs/libhdf5-346dbfc8.so.200.1.0 InsightSoftwareConsortium#6 0x00007fead7b79fd1 in H5Idec_ref () from /home/gabriel/g/lib/Python/lib/python3.9/site-packages/h5py/../h5py.libs/libhdf5-346dbfc8.so.200.1.0 ``` </details>
thewtex
added a commit
that referenced
this pull request
Mar 21, 2024
In 03c8176 a concept check was added that the sobel operator uses a signed pixel type. On Linux aarch64, ❯ c++ --version c++ (Debian 12.2.0-14) 12.2.0 ❯ uname -a Linux deb 6.1.0-18-arm64 #1 SMP Debian 6.1.76-1 (2024-02-01) aarch64 GNU/Linux char is unsigned, which causes the concept check to fail. Switch `char` to `signed char`.
seanm
added a commit
that referenced
this pull request
Apr 29, 2024
Found with thread sanitizer (TSan) running the `itkANTSNeighborhoodCorrelationImageToImageRegistrationTest` unit test. There was already a `m_ANTSAssociateOnceFlag` flag for use with `std::call_once`, so I just used that in this place too (it's already used elsewhere). Partial backtrace from TSan: ``` WARNING: ThreadSanitizer: data race (pid=79176) Write of size 8 at 0x000108f02240 by thread T2: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) Previous write of size 8 at 0x000108f02240 by thread T14: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) ```
seanm
added a commit
that referenced
this pull request
May 30, 2024
Found with thread sanitizer (TSan) running the `itkANTSNeighborhoodCorrelationImageToImageRegistrationTest` unit test. There was already a `m_ANTSAssociateOnceFlag` flag for use with `std::call_once`, so I just used that in this place too (it's already used elsewhere). Partial backtrace from TSan: ``` WARNING: ThreadSanitizer: data race (pid=79176) Write of size 8 at 0x000108f02240 by thread T2: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) Previous write of size 8 at 0x000108f02240 by thread T14: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) ```
seanm
added a commit
to seanm/ITK
that referenced
this pull request
Jul 28, 2024
Found with thread sanitizer (TSan) running the `itkANTSNeighborhoodCorrelationImageToImageRegistrationTest` unit test. There was already a `m_ANTSAssociateOnceFlag` flag for use with `std::call_once`, so I just used that in this place too (it's already used elsewhere). Partial backtrace from TSan: ``` WARNING: ThreadSanitizer: data race (pid=79176) Write of size 8 at 0x000108f02240 by thread T2: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) InsightSoftwareConsortium#1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) InsightSoftwareConsortium#2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) InsightSoftwareConsortium#3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) InsightSoftwareConsortium#4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) Previous write of size 8 at 0x000108f02240 by thread T14: #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50) InsightSoftwareConsortium#1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0) InsightSoftwareConsortium#2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c) InsightSoftwareConsortium#3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228) InsightSoftwareConsortium#4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE THIS... IT IS NOT READY