<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;" class="">
Brad,
<div class=""><br class="">
</div>
<div class="">I wondered if that might not be what’s going on here, but was thrown off by the fact that the examples output in a float format. Looking back for the ReplaceValue call you mentioned, I can’t help but notice that the ReplaceValue is actually 255
(iirc, the maximum size of a UC?)… so why output in float at all?</div>
<div class=""><br class="">
</div>
<div class="">It seems like the best thing that could happen is what you expect (i.e. you actually get 255 in your float, which persists when you cast back to UC before writing), except that you run the risk of numerical instability. OTOH, maybe I’d rather
trust the professional converting object with my conversions rather than the ConfidenceConnectedImageFilter? Like I said, I’m new to ITK… what’s the best practice here?</div>
<div class=""><br class="">
</div>
<div class="">Thanks again for your help! It would have taken me probably a couple of days to figure this out on my own...</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Justin</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jun 12, 2015, at 12:05 PM, Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov" class="">blowekamp@mail.nih.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Justin,
<div class=""><br class="">
</div>
<div class="">The output of the ConfidenceConnectedImageFilter is a binary image. The output image only has 2 value the background ( 0 ) and the "ReplaceValue". While the templated code with a float output pixel would allow you to set the replace value to say
an approximation of PI, the output image would still just have two value. Using a unsigned char output pixel type works for most normal cases. If not casting the output is not too hard.</div>
<div class=""><br class="">
</div>
<div class="">Brad</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class="">On Jun 12, 2015, at 12:37 PM, Porter, Justin <<a href="mailto:porterj@wusm.wustl.edu" class="">porterj@wusm.wustl.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Thanks for your quick and helpful response!</div>
<div class=""><br class="">
</div>
<div class="">Whatever version of ITK I am running has the GetTypes method, and it looks like ConfidenceConnectedImageFilter allows 2 and 3 dimensional doubles, floats, SS, and UC on the input end, but only 2 and 3 dimensional UC and SS as output types.</div>
<div class=""><br class="">
</div>
<div class="">The output from ConfidenceConnectedImageFilter.GetTypes():</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""></div>
<blockquote type="cite" class="">
<div class=""><itkTemplate itk::ConfidenceConnectedImageFilter></div>
<div class="">Options:</div>
<div class=""> [<class 'itkImagePython.itkImageD2'>, <class 'itkImagePython.itkImageSS2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageD2'>, <class 'itkImagePython.itkImageUC2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageD3'>, <class 'itkImagePython.itkImageSS3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageD3'>, <class 'itkImagePython.itkImageUC3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageF2'>, <class 'itkImagePython.itkImageSS2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageF2'>, <class 'itkImagePython.itkImageUC2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageF3'>, <class 'itkImagePython.itkImageSS3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageF3'>, <class 'itkImagePython.itkImageUC3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageSS2'>, <class 'itkImagePython.itkImageSS2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageSS2'>, <class 'itkImagePython.itkImageUC2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageSS3'>, <class 'itkImagePython.itkImageSS3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageSS3'>, <class 'itkImagePython.itkImageUC3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageUC2'>, <class 'itkImagePython.itkImageSS2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageUC2'>, <class 'itkImagePython.itkImageUC2'>]</div>
<div class=""> [<class 'itkImagePython.itkImageUC3'>, <class 'itkImagePython.itkImageSS3'>]</div>
<div class=""> [<class 'itkImagePython.itkImageUC3'>, <class 'itkImagePython.itkImageUC3'>]</div>
</blockquote>
<div class=""><br class="">
</div>
</div>
<div class="">Is this by design? In the example script, both the input and the output for ConfidenceConnectedImageFilter are 3d floats…</div>
<div class=""><br class="">
</div>
<div class="">If not, I would be happy to try to fix the issue and commit a fix if there are guidelines somewhere for doing so.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Justin</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Jun 12, 2015, at 10:26 AM, Michka Popoff <<a href="mailto:michkapopoff@gmail.com" class="">michkapopoff@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="auto" class="">
<div class="">Hi</div>
<div class=""><br class="">
</div>
<div class="">one good way to know which types are available is to use the <span style="background-color: rgba(255, 255, 255, 0);" class="">GetTypes method on your template (before calling New). This method way introduced in 4.7 or after, I don't remember.
But it is definitively available in 4.8 rc 1.</span></div>
<div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class="">
</span></div>
<div class="">I am not in front on a computer so please check this out yourself. Looking at the code we wrap float combinations here:</div>
<div class=""><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/RegionGrowing/wrapping/itkConfidenceConnectedImageFilter.wrap" class="">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/RegionGrowing/wrapping/itkConfidenceConnectedImageFilter.wrap</a></div>
<div class=""><br class="">
</div>
<div class="">Michka</div>
<div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class="">
</span></div>
<div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class="">
</span></div>
<div class=""><br class="">
Envoyé de mon iPhone</div>
<div class=""><br class="">
Le 12 juin 2015 à 17:03, Porter, Justin <<a href="mailto:porterj@wusm.wustl.edu" class="">porterj@wusm.wustl.edu</a>> a écrit :<br class="">
<br class="">
</div>
<blockquote type="cite" class="">
<div class="">Hey all,
<div class=""><br class="">
</div>
<div class="">I’m just getting started with ITK, and I’m using the python bindings, which are really awesome. It looks like it was a fair bit of work to get such a heavily templated library to work in Python, but it’s really nice to be able to build scripts
in python!</div>
<div class=""><br class="">
</div>
<div class="">I set out to reimplement Slicer’s “Simple Region Growing Segmentation” using ITK-Python, but I keep getting an error when I try to define a ConfidenceConnectedImageFilter template on a 3d float (and double, too). IMG_F == itk.Image[itk.F, 3] elsewhere
in the script.</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""></div>
</div>
<blockquote type="cite" class="">
<div class="">
<div class="">Traceback (most recent call last):</div>
<div class=""> File "simple_region_growing_segmentation.py", line 169, in <module></div>
<div class=""> sys.exit(main(sys.argv))</div>
<div class=""> File "simple_region_growing_segmentation.py", line 154, in main</div>
<div class=""> args.seed)</div>
<div class=""> File "simple_region_growing_segmentation.py", line 98, in attach_connect</div>
<div class=""> ccif = ConfidenceConnectedImageFilter[IMG_F, IMG_F].New()</div>
<div class=""> File "/home/jporter/usr/local/ITK/bin/Wrapping/Generators/Python/itkTemplate.py", line 263, in __getitem__</div>
<div class=""> (str(parameters), self.__name__))</div>
<div class="">KeyError: "itkTemplate : No template (<class 'itkImagePython.itkImageF3'>, <class 'itkImagePython.itkImageF3'>) for the itk::ConfidenceConnectedImageFilter class"</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">I’m pretty sure I built the bindings appropriately to get float support:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""></div>
</div>
<blockquote type="cite" class="">
<div class="">
<div class="">cmake -DITK_USE_REVIEW=ON -DITK_WRAP_PYTHON=ON -DBUILD_SHARED_LIBS=ON -DITK_LEGACY_SILENT=ON -DITK_WRAP_float=ON -DITK_WRAP_rgb_unsigned_char=ON -DITK_WRAP_vector_double=ON -DITK_WRAP_complex_double=ON -DITK_WRAP_double=ON </div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Interestingly, I <i class="">can</i> build a CurvatureFlowImageFilter or a CastImageFilter templated against 3d floats. I can also instantiate a ConfidenceConnectedImageFilter templated against itk.UC (presumably unsigned char?). That made me
think that it’s not possible to build a ConfidenceConnectedImageFilter templated on floats, but the <a href="http://www.itk.org/Doxygen/html/Examples_2Segmentation_2ConfidenceConnected_8cxx-example.html#_a5" class="">ConfidenceConnected</a> example segmentation
script does just that.</div>
<div class=""><br class="">
</div>
<div class="">I’d love to hear thought/suggestions as to how I can proceed!</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Justin</div>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"" class=""><o:p class=""></o:p></span>
<div class=""><br class="webkit-block-placeholder">
</div>
<div class=""></div>
<p class="MsoNormal"><o:p class=""> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center" class="">
</div>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray" class="">The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the
intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender
via telephone or return mail.</span></p>
</div>
</blockquote>
<blockquote type="cite" class="">
<div class=""><span class="">_____________________________________</span><br class="">
<span class="">Powered by <a href="http://www.kitware.com/" class="">www.kitware.com</a></span><br class="">
<span class=""></span><br class="">
<span class="">Visit other Kitware open-source projects at</span><br class="">
<span class=""><a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a></span><br class="">
<span class=""></span><br class="">
<span class="">Kitware offers ITK Training Courses, for more information visit:</span><br class="">
<span class=""><a href="http://www.kitware.com/products/protraining.php" class="">http://www.kitware.com/products/protraining.php</a></span><br class="">
<span class=""></span><br class="">
<span class="">Please keep messages on-topic and check the ITK FAQ at:</span><br class="">
<span class=""><a href="http://www.itk.org/Wiki/ITK_FAQ" class="">http://www.itk.org/Wiki/ITK_FAQ</a></span><br class="">
<span class=""></span><br class="">
<span class="">Follow this link to subscribe/unsubscribe:</span><br class="">
<span class=""><a href="http://public.kitware.com/mailman/listinfo/insight-users" class="">http://public.kitware.com/mailman/listinfo/insight-users</a></span><br class="">
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
<span style="font-size:10.0pt;font-family:"Arial","sans-serif"" class=""><o:p class=""></o:p></span>
<div class=""><br class="webkit-block-placeholder">
</div>
<div class=""></div>
<p class="MsoNormal"><o:p class=""> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center" class="">
</div>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray" class="">The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the
intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender
via telephone or return mail.</span></p>
</div>
_____________________________________<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" class="">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>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<span style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p></o:p></span>
<p></p>
<div></div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray">The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended
recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone
or return mail.</span></p>
</body>
</html>