<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>There could also be some symbol resolution issues/ conflicts. Are you using shared libraries? What is the output of otool -L? What GUI library are you using? What C++ library (libc++ vs libstdc++)? Are you consistently using the same c++ library? If you set the <span style="font-family: Menlo; font-size: 11px;">CMAKE_OSX_DEPLOYMENT_TARGET to 10.8 you can easily use libstdc++ by default.</span></div><div><br></div><div>I see a use of a "lock" in your code. What do you have going on with threads?</div><div><br></div><div>HTH,</div><div>Brad</div><div><br><div><div>On Oct 28, 2015, at 7:57 AM, Michael Jackson <<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Nope. It does not help. I’m going to add some more information and see where that takes the discussion. We are trying to integrate ITK into our project DREAM.3D (<a href="http://github.com/dream3d" class="">github.com/dream3d</a>) which uses a plugin system to load user developed data analysis filters. The failure mode we are seeing is when 2 filters, in different plugins, use the same ITK code. The DREAM.3D plugin that contains the DREAM.3D Filter that gets loaded first will run through without issues. The second DREAM.3D Plugin that contains the second DREAM.3D Filter will fail with the exception message. The ITK code is exactly the same except for the name of the c++ class that holds the code. We have replicated this on OS X 10.9 and 10.10. We can NOT replicate the issue on Windows (VS2013) or Linux (Clang 3.6). We have it down to a fairly simple DREAM.3D test case but not an ITK test case. After moving some codes around and moving some of our looping code inside the “try-catch” block we finally started seeing the exception messages. I am hoping we are just using ITK incorrectly and OS X is just exposing the incorrect use. The weird part is that we get the correct results on the other systems so it is not like the other platforms have a silent failure.<div class=""><br class=""></div><div class="">Thanks for any help.<br class=""><div apple-content-edited="true" class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">--</div><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Mike Jackson [<a href="mailto:mike.jackson@bluequartz.net" class="">mike.jackson@bluequartz.net</a>]<br class=""><br class=""></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 27, 2015, at 6:22 PM, Matt McCormick <<a href="mailto:matt.mccormick@kitware.com" class="">matt.mccormick@kitware.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi Mike,<br class=""><br class="">Does calling<br class=""><br class=""> UpdateLargestPossibleRegion()<br class=""><br class="">instead of<br class=""><br class=""> Update()<br class=""><br class="">help?<br class=""><br class="">Matt<br class=""><br class="">On Tue, Oct 27, 2015 at 5:59 PM, Michael Jackson<br class=""><<a href="mailto:mike.jackson@bluequartz.net" class="">mike.jackson@bluequartz.net</a>> wrote:<br class=""><blockquote type="cite" class="">I have been struggling with this error all afternoon and I just can not “see” what I am doing wrong. I am getting the following exception message from our program:<br class=""><br class="">Failed to execute itk::SignedMaurerDistanceMapImage filter for Feature 9. Error Message returned from ITK:<br class=""> itk::ERROR: MultiThreader(0x7fb53486e200): Exception occurred during SingleMethodExecute<br class="">/Users/Shared/DREAM3D_SDK/InsightToolkit-4.7.2/Modules/Core/Common/include/itkImageConstIterator.h:211:<br class="">itk::ERROR: Region ImageRegion (0x12e6f6730)<br class=""> Dimension: 3<br class=""> Index: [0, 0, 0]<br class=""> Size: [64, 64, 4]<br class=""> is outside of buffered region ImageRegion (0x7fb53c0a8040)<br class=""> Dimension: 3<br class=""> Index: [0, 0, 0]<br class=""> Size: [0, 0, 0]<br class=""><br class="">So what are the reasons that this can happen? Basically we creating an unsigned char image where we fill in the pixels, then run the Itk filter on each unsigned char image. Finally we want to copy the final output data into one of our own arrays. I will post the code under here. Any help is greatly appreciated.<br class=""><br class=""> size_t iDims[3] = { 0, 0, 0 };<br class=""> float origin[3] = { 0.0f, 0.0f, 0.0f };<br class=""> float resolution[3] = { 0.0f, 0.0f, 0.0f };<br class=""><br class=""> image->getDimensions(iDims);<br class=""> image->getOrigin(origin);<br class=""> image->getResolution(resolution);<br class=""><br class=""> int32_t numFeatures = m_SignedDistanceFields.size();<br class=""><br class=""> typedef itk::Image<unsigned char, 3> BoolImageType;<br class=""> typedef itk::Image<float, 3> FloatImageType;<br class=""> std::vector<BoolImageType::Pointer> booleanFeatureImages(numFeatures);<br class=""> BoolImageType::IndexType start;<br class=""> BoolImageType::SizeType size;<br class=""> BoolImageType::RegionType region;<br class=""><br class=""> start.Fill(0);<br class=""><br class=""> size[0] = iDims[0];<br class=""> size[1] = iDims[1];<br class=""> size[2] = iDims[2];<br class=""><br class=""> region.SetIndex(start);<br class=""> region.SetSize(size);<br class=""><br class=""> for (int32_t i = 0; i < numFeatures; i++)<br class=""> {<br class=""> BoolImageType::Pointer tmpBoolImage = BoolImageType::New();<br class=""> tmpBoolImage->SetRegions(region);<br class=""> tmpBoolImage->Allocate();<br class=""> tmpBoolImage->SetOrigin(origin);<br class=""> tmpBoolImage->SetSpacing(resolution);<br class=""> tmpBoolImage->FillBuffer(0);<br class=""> booleanFeatureImages[i] = tmpBoolImage;<br class=""> }<br class=""><br class=""> size_t zStride = 0;<br class=""> size_t yStride = 0;<br class=""> size_t index = 0;<br class=""><br class=""> for (size_t z = 0; z < iDims[2]; z++)<br class=""> {<br class=""> zStride = z * iDims[1] * iDims[2];<br class=""> for (size_t y = 0; y < iDims[1]; y++)<br class=""> {<br class=""> yStride = y * iDims[0];<br class=""> for (size_t x = 0; x < iDims[0]; x++)<br class=""> {<br class=""> index = zStride + yStride + x;<br class=""> BoolImageType::IndexType pixelIndex;<br class=""> pixelIndex[0] = x;<br class=""> pixelIndex[1] = y;<br class=""> pixelIndex[2] = z;<br class=""> if (x == y && y == z) { booleanFeatureImages[0]->SetPixel(pixelIndex, 255); }<br class=""> booleanFeatureImages[m_FeatureIds[index]]->SetPixel(pixelIndex, 255);<br class=""> }<br class=""> }<br class=""> }<br class=""> // Compute signed distance field for each Feature<br class=""> typedef itk::SignedMaurerDistanceMapImageFilter<BoolImageType, FloatImageType> SignedMaurerFilter;<br class=""><br class=""> for (int32_t i = 0; i < numFeatures; i++)<br class=""> {<br class=""> if (getCancel() == true) { return; }<br class=""> SignedMaurerFilter::Pointer signedDistMap = SignedMaurerFilter::New();<br class=""> float* tmpDistField = m_SignedDistanceFields[i].lock()->getPointer(0);<br class=""> signedDistMap->SetInsideIsPositive(false);<br class=""> signedDistMap->SetSquaredDistance(true);<br class=""> signedDistMap->SetUseImageSpacing(true);<br class=""> signedDistMap->SetInput(booleanFeatureImages[i]);<br class=""> try<br class=""> {<br class=""> signedDistMap->Update();<br class=""><br class=""> for (size_t z = 0; z < iDims[2]; z++)<br class=""> {<br class=""> zStride = z * iDims[1] * iDims[2];<br class=""> for (size_t y = 0; y < iDims[1]; y++)<br class=""> {<br class=""> yStride = y * iDims[0];<br class=""> for (size_t x = 0; x < iDims[0]; x++)<br class=""> {<br class=""> index = zStride + yStride + x;<br class=""> BoolImageType::IndexType pixelIndex;<br class=""> pixelIndex[0] = x;<br class=""> pixelIndex[1] = y;<br class=""> pixelIndex[2] = z;<br class=""> FloatImageType::Pointer out = signedDistMap->GetOutput();<br class=""> out->SetBufferedRegion(region);<br class=""> tmpDistField[index] = out->GetPixel(pixelIndex);<br class=""> }<br class=""> }<br class=""> }<br class=""> }<br class=""> catch (itk::ExceptionObject& err)<br class=""> {<br class=""> setErrorCondition(-5);<br class=""> QString ss = QObject::tr("Failed to execute itk::SignedMaurerDistanceMapImage filter for Feature %1. Error Message returned from ITK:\n %2").arg(i).arg(err.GetDescription());<br class=""> notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());<br class=""> }<br class=""> }<br class="">--<br class="">Mike Jackson<br class="">BlueQuartz Software, LLC<br class="">[e]: <a href="mailto:mike.jackson@bluequartz.net" class="">mike.jackson@bluequartz.net</a><br class=""><br class="">_____________________________________<br class="">Powered by <a href="http://www.kitware.com/" class="">www.kitware.com</a><br class=""><br class="">Visit other Kitware open-source projects at<br class=""><a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Kitware offers ITK Training Courses, for more information visit:<br class=""><a href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br class=""><br class="">Please keep messages on-topic and check the ITK FAQ at:<br class="">http://www.itk.org/Wiki/ITK_FAQ<br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class="">http://public.kitware.com/mailman/listinfo/insight-users<br class=""></blockquote></div></blockquote></div><br class=""></div></div>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://public.kitware.com/mailman/listinfo/insight-users<br>_______________________________________________<br>Community mailing list<br>Community@itk.org<br>http://public.kitware.com/mailman/listinfo/community<br></blockquote></div><br></div></body></html>