<div dir="ltr">Finally just found the error ...<br><br>We had somewhere deep in our code the following lines ...<div>#ifndef ThreadIdType<br>#define ThreadIdType int<br>#endif<br><br>Depending on the code tested, that was picked at the first place, thus messing with the new ITK API !<br><br>Sorry for the noise, everything back in order<br><br>Thanks for the support<br><br>Simon<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-03 15:22 GMT+01:00 Simon ESNEAULT <span dir="ltr"><<a href="mailto:simon.esneault@gmail.com" target="_blank">simon.esneault@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bradley,<br><br>Thanks for your answer. You're right it can not be the export otherwise it would not link.<br>Plus, I can now reproduce the exact same exception at runtime on OSX (10.10, XCode 6) with our framework updated and build against ITK 4.6.1<br><br>I've search all copies of ResampleFilter and the only one left on the computers (Win and OSX) are the one from ITK 4.6.1. It must be something else !<br><br>Here is what we do with cmake :<br><br><div><span style="white-space:pre-wrap">    </span>set( Itk_INCLUDE_DIR ${CMAKE_BINARY_DIR}/../externals/ITK-4.6.1/${OS_NAME}/include ) </div><div><span style="white-space:pre-wrap">    </span>set( Itk_LIBRARY_DIR ${CMAKE_BINARY_DIR}/../externals/ITK-4.6.1/${OS_NAME}/lib/${CMAKE_BUILD_TYPE} )</div><div><span style="white-space:pre-wrap">     </span>set( Itk_LIBRARIES </div><div><span style="white-space:pre-wrap">              </span>ITKBiasCorrection-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKBioCell-4.6</div><div><span style="white-space:pre-wrap">           </span>ITKCommon-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKDICOMParser-4.6</div><div><span style="white-space:pre-wrap">               </span>itkdouble-conversion-4.6</div><div><span style="white-space:pre-wrap">         </span>ITKEXPAT-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKFEM-4.6</div><div><span style="white-space:pre-wrap">               </span>itkgdcmCommon-4.6</div><div><span style="white-space:pre-wrap">                </span>itkgdcmDICT-4.6</div><div><span style="white-space:pre-wrap">          </span>itkgdcmDSED-4.6</div><div><span style="white-space:pre-wrap">          </span>itkgdcmIOD-4.6</div><div><span style="white-space:pre-wrap">           </span>itkgdcmjpeg12-4.6</div><div><span style="white-space:pre-wrap">                </span>itkgdcmjpeg16-4.6</div><div><span style="white-space:pre-wrap">                </span>itkgdcmjpeg8-4.6</div><div><span style="white-space:pre-wrap">         </span>itkgdcmMSFF-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKgiftiio-4.6</div><div><span style="white-space:pre-wrap">           </span>itkhdf5-4.6</div><div><span style="white-space:pre-wrap">              </span>itkhdf5_cpp-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKIOBioRad-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKIOBMP-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOCSV-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOGDCM-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOGE-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKIOGIPL-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOHDF5-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOImageBase-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKIOIPL-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOJPEG-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOLSM-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOMesh-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOMeta-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOMRC-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIONIFTI-4.6</div><div><span style="white-space:pre-wrap">           </span>ITKIONRRD-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOPNG-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOSiemens-4.6</div><div><span style="white-space:pre-wrap">         </span>ITKIOSpatialObjects-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKIOStimulate-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKIOTIFF-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKIOTransformBase-4.6</div><div><span style="white-space:pre-wrap">           </span>ITKIOTransformHDF5-4.6</div><div><span style="white-space:pre-wrap">           </span>ITKIOTransformInsightLegacy-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKIOTransformMatlab-4.6</div><div><span style="white-space:pre-wrap">         </span>ITKIOVTK-4.6</div><div><span style="white-space:pre-wrap">             </span>ITKIOXML-4.6</div><div><span style="white-space:pre-wrap">             </span>itkjpeg-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKKLMRegionGrowing-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKLabelMap-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKMesh-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKMetaIO-4.6</div><div><span style="white-space:pre-wrap">            </span>itkNetlibSlatec-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKniftiio-4.6</div><div><span style="white-space:pre-wrap">           </span>ITKNrrdIO-4.6</div><div><span style="white-space:pre-wrap">            </span>itkopenjpeg-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKOptimizers-4.6</div><div><span style="white-space:pre-wrap">                </span>ITKOptimizersv4-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKPath-4.6</div><div><span style="white-space:pre-wrap">              </span>itkpng-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKPolynomials-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKQuadEdgeMesh-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKSpatialObjects-4.6</div><div><span style="white-space:pre-wrap">            </span>ITKStatistics-4.6</div><div><span style="white-space:pre-wrap">                </span>itksys-4.6</div><div><span style="white-space:pre-wrap">               </span>itktiff-4.6</div><div><span style="white-space:pre-wrap">              </span>itkv3p_lsqr-4.6</div><div><span style="white-space:pre-wrap">          </span>itkv3p_netlib-4.6</div><div><span style="white-space:pre-wrap">                </span>itkvcl-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKVideoCore-4.6</div><div><span style="white-space:pre-wrap">         </span>ITKVideoIO-4.6</div><div><span style="white-space:pre-wrap">           </span>itkvnl-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKVNLInstantiation-4.6</div><div><span style="white-space:pre-wrap">          </span>itkvnl_algo-4.6</div><div><span style="white-space:pre-wrap">          </span>ITKVTK-4.6</div><div><span style="white-space:pre-wrap">               </span>ITKWatersheds-4.6</div><div><span style="white-space:pre-wrap">                </span>itkzlib-4.6</div><div><span style="white-space:pre-wrap">              </span>ITKznz-4.6</div><div><span style="white-space:pre-wrap">       </span>)<br><br>And later on, <br><div>include_directories( ${Itk_INCLUDE_DIR} )</div><div>link_directories( ${Itk_LIBRARY_DIR} )<br>target_link_libraries( my_exec ${Itk_LIBRARIES} )<br>or target_link_libraries( my_lib ${Itk_LIBRARIES} )<br><br>After that we Register Itk factories as stated in the first mail.<br>Is this sufficient?<br>Can this be responsible of such a behavior ?<br><br>Simon<br><br></div></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">2014-12-02 15:45 GMT+01:00 Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello Simon,<div><br></div><div>If you don't have your exports correct it'd likely result in a link error.</div><div><br></div><div>Given the error message you report, it sounds like you are using an old version of the ResampleFilter. I'd look into seeing if there are old copies of ITK 3.20 laying around that may be included in your project. You can not use mix symbols and includes from different version of ITK.</div><div><br></div><div>Brad</div><div><div><div><br><div><div>On Dec 2, 2014, at 4:51 AM, Simon ESNEAULT <<a href="mailto:simon.esneault@gmail.com" target="_blank">simon.esneault@gmail.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Bill,<br><br>Thanks for your reply. I have downloaded and executed succesfully the Upsampling example (<a href="http://itk.org/Wiki/ITK/Examples/ImageProcessing/Upsampling" target="_blank">http://itk.org/Wiki/ITK/Examples/ImageProcessing/Upsampling</a>), using the version of ITK (4.6.1) we used in the framework.<div><br>It appears our problem is probably related with our framework architecture, and some dll import/export on windows. We wrapped all our ITK code in a library WrapItk.dll. And there are some others libraries, all of them can make use of native ITK code or wrapped ITK code. This used to work fine with ITK 3.20.1, but it's seems broken in 4.6.1. </div><div><br></div><div>Not only the Resample filter raise an exception but all the MultiThreaded filter in ITK. When debugging, we go through itk::ResampleImageFilter::BeforeThreadedGenerateData() just fine, and somehow, when ThreadedGenerateData() is called we fall back in the mother class ImageSource method, hence raising the exception.</div><div><br></div><div>Anyone know how to use properly ITK code with multiple DLL's on windows ? ie having an image loaded with ITK code from one DLL, and some ITK filter executed in another DLL without trouble ?<br>We use that sort of mechanism to export functions properly between DLLs.</div><div>#if SOME_DLL_DEFINITIONS</div><div>#define MY_EXPORT __declspec(dllexport)<div>#else</div><div>#define MY_EXPORT __declspec(dllimport)</div><br>I will try to sum things up in scheme  if that can help ...<br><br>Thanks <br>Simon<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-01 14:51 GMT+01:00 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Very strange.<br>
<br>
Could you try building and running this example:<br>
<a href="http://itk.org/Wiki/ITK/Examples/ImageProcessing/ResampleImageFilter" target="_blank">http://itk.org/Wiki/ITK/Examples/ImageProcessing/ResampleImageFilter</a><br>
<br>
Bill<br>
<div><br>
On Mon, Dec 1, 2014 at 7:53 AM, Simon ESNEAULT <<a href="mailto:simon.esneault@gmail.com" target="_blank">simon.esneault@gmail.com</a>> wrote:<br>
> Hello ITK community<br>
><br>
> After the migration from ITK 3.20.1 to ITK 4.6.1, I'm getting a runtime<br>
> exception when using itk::ResampleImageFilter in our framework. The output<br>
> looks like this :<br>
><br>
> Problem during Resample filtering:<br>
> D:\Dev\DevCpp-Qt5\cmake-externals\ITK\src\Modules\Core\Common\src\itkMultiThreader.cxx:358:<br>
> itk::ERROR: MultiThreader(31CAAD18): Exception occurred during<br>
> SingleMethodExecute<br>
> c:\dev\Dev_qt5\externals\itk-4.6.1\win32\include\itkImageSource.hxx:267:<br>
> itk::ERROR: ResampleImageFilter(31AC2E90): Subclass should override this<br>
> method!!!<br>
> The signature of ThreadedGenerateData() has been changed in ITK v4 to use<br>
> the new ThreadIdType.<br>
> ResampleImageFilter::ThreadedGenerateData() might need to be updated to used<br>
> it.<br>
><br>
> That is weird, because the itkResampleImageFilter is the one delivered with<br>
> ITK 4.6.1, so it must have followed the API changed ...<br>
><br>
> The context is :<br>
> Visual Studio 2013 community, 32 bit build, ITK build in shared library<br>
> mode. That's quite a big project, with VTK, Qt, OpenCV, DCMTK, zlib ...<br>
> I'm not using cmake in the usual way (ie no find_package(ITK)<br>
> include(${ITK_USE_FILE}) ) but we list the libraries and includes. I know<br>
> there are some factories to register in that case, we're doing this in the<br>
> main.cpp :<br>
> itk::TransformFactoryBase::RegisterDefaultTransforms();<br>
> itk::PNGImageIOFactory::RegisterOneFactory();<br>
> itk::MetaImageIOFactory::RegisterOneFactory();<br>
> itk::NrrdImageIOFactory::RegisterOneFactory();<br>
><br>
> Am I missing some others factories to register in order to run properly the<br>
> resampleImageFilter ?<br>
> Anyone else had a similar runtime exception with a native ITK filte, or know<br>
> what would raise such an exception ?<br>
><br>
> Thanks<br>
><br>
> --<br>
> ------------------------------------------------------------------<br>
> Simon Esneault<br>
> ------------------------------------------------------------------<br>
><br>
</div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br>
><br>
<span><font color="#888888"><br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>------------------------------------------------------------------<br>Simon Esneault<div>------------------------------------------------------------------</div></div>
</div></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://kitware.com/products/protraining.php" target="_blank">http://kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/insight-developers" target="_blank">http://public.kitware.com/mailman/listinfo/insight-developers</a><br></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div>------------------------------------------------------------------<br>Simon Esneault<div>------------------------------------------------------------------</div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">------------------------------------------------------------------<br>Simon Esneault<div>------------------------------------------------------------------</div></div>
</div></div>