[ITK-users] Python Bindings, Templates, and ConfidenceConnectedImageFilter

Michka Popoff michkapopoff at gmail.com
Fri Jun 12 11:26:25 EDT 2015


Hi

one good way to know which types are available is to use the 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.

I am not in front on a computer so please check this out yourself. Looking at the code we wrap float combinations here:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/RegionGrowing/wrapping/itkConfidenceConnectedImageFilter.wrap

Michka



Envoyé de mon iPhone

> Le 12 juin 2015 à 17:03, Porter, Justin <porterj at wusm.wustl.edu> a écrit :
> 
> Hey all,
> 
> 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!
> 
> 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.
> 
>> Traceback (most recent call last):
>>   File "simple_region_growing_segmentation.py", line 169, in <module>
>>     sys.exit(main(sys.argv))
>>   File "simple_region_growing_segmentation.py", line 154, in main
>>     args.seed)
>>   File "simple_region_growing_segmentation.py", line 98, in attach_connect
>>     ccif = ConfidenceConnectedImageFilter[IMG_F, IMG_F].New()
>>   File "/home/jporter/usr/local/ITK/bin/Wrapping/Generators/Python/itkTemplate.py", line 263, in __getitem__
>>     (str(parameters), self.__name__))
>> KeyError: "itkTemplate : No template (<class 'itkImagePython.itkImageF3'>, <class 'itkImagePython.itkImageF3'>) for the itk::ConfidenceConnectedImageFilter class"
> 
> I’m pretty sure I built the bindings appropriately to get float support:
> 
>> 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 
> 
> Interestingly, I can 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 ConfidenceConnected example segmentation script does just that.
> 
> I’d love to hear thought/suggestions as to how I can proceed!
> 
> Cheers,
> Justin
>  
> 
> 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.
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150612/0f2270af/attachment-0001.html>


More information about the Insight-users mailing list