[Insight-users] Beginner question: accessing types in classes (python)
Rick Giuly
rgiuly at gmail.com
Wed Feb 25 01:18:26 EST 2009
Hello all,
I'm attempting to write the FastMarching example from the ITK guide in
python, and I have run into a problem.
Could someone inform me on what is the proper syntax, in python, for
accessing a type (like NodeContainer) which is inside of a class (like
FastMarchingImageFilter). I have my attempted guess at the syntax shown
below but it did not seem to work.
Any help is appreciated
-Rick
-------------------------------------
Abbreviated C++ code, from page 535-538 of the ITK software guide
typedef float InternalPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
typedef itk::FastMarchingImageFilter< InternalImageType,
InternalImageType > FastMarchingFilterType;
typedef FastMarchingFilterType::NodeContainer NodeContainer;
// trying to reproduce this line in python
NodeContainer::Pointer seeds = NodeContainer::New();
-------------------------------------
Code that I tried in python:
image_type = itk.Image[itk.F, 3]
seeds =
itk.FastMarchingImageFilter[image_type,image_type].NodeContainer.New()
-------------------------------------
Error message I received:
Traceback (most recent call last):
File
"C:\data\m\eclipse_workspace\blobcenter\test_files\test_FastMarchingImageFilter.py",
line 14, in <module>
seeds = itk.FastMarchingImageFilter[image_type,
image_type].NodeContainer.New()
AttributeError: type object 'itkFastMarchingImageFilterIF3IF3' has no
attribute 'NodeContainer'
More information about the Insight-users
mailing list