[Insight-users] Setting Radius in python - Median Filter

Peter peter.bloomfield at camhpet.ca
Wed Apr 6 16:06:15 EDT 2011


Hi Gaëtan,

I started off using WrapITK rather than CSwig, but read when building it in cmake-gui I saw the following
	"WrapITK is an experimental system for wrapping ITK. It is tested on Linux, Mac OS and Solaris, but is known to have
	some problems on some Windows platforms."
so I went back to CSwig.
I work/develop in linux, but really want to have the python scripts that run on both linux and windows.

I am trying to use ITK V3.20.0

Cheers

Peter



On Wednesday, April 06, 2011, Gaëtan Lehmann wrote:
> Hi Peter,
> 
> You may want to try WrapITK instead of the older CSwig wrapping.
> With WrapITK, you line
> 
>    image_filter.SetRadius( 5 )
> 
> should work, and be equivalent to the solution you found.
> 
> You can use it by turning on USE_WRAP_ITK while building ITK.
> 
> Regards,
> 
> Gaëtan
> 
> Le 5 avr. 11 à 21:52, Peter a écrit :
> > Sorry for this, but found the solution
> > 
> > 	sizeRadius = itk.itkSize
> > 	sizeRadius.SetElement
> > 
> > Peter
> > 
> > On Tuesday, April 05, 2011, Peter wrote:
> >> Hi,
> >> 
> >> I am new to itk and I apologise for this basic question.
> >> 
> >> I have compiled itk v3.20.0 for python using CableSwig from the cvs
> >> repository and all installed without error.
> >> 
> >> I have a simple program where I want to apply a median filter to a
> >> data aet
> >> and I use the following image_filter =
> >> itk.itkMedianImageFilterF3F3_New()
> >> 
> >> 	image_filter.SetRadius( 5 )
> >> 
> >> but I get the following error
> >> 
> >> 	Traceback (most recent call last):
> >> 	  File "/home/peter/Src/Python/Py_Scripts/itk_chk.py", line 21, in
> >> 
> >> <module> image_filter.SetRadius( 5 )
> >> 
> >> 	  File "/usr/local/lib/InsightToolkit/itkMedianImageFilter.py",
> >> 
> >> line 1145,
> >> in SetRadius def SetRadius(*args): return
> >> _itkMedianImageFilter
> >> .itkMedianImageFilterF3F3_Pointer_SetRadius(*args)
> >> TypeError: Expected a pointer
> >> How do I pass the '5' as a pointer?
> >> 
> >> Any help will be greatlyu appreciated,
> >> 
> >> Peter
> >> _____________________________________
> >> 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.html
> >> 
> >> 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://www.itk.org/mailman/listinfo/insight-users
> > 
> > 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.html
> > 
> > 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://www.itk.org/mailman/listinfo/insight-users


-- 
Peter M. Bloomfield
Physicist,
PET Centre,
Centre for Addiction and Mental Health,
250 College St.,
Toronto, Ontario,
Canada M5T 1R8
Tel: 416 535 8501 Ext. 4243


More information about the Insight-users mailing list