[Insight-users] Re: ITK Wrapping to Python : instantiating an Index and setting its
value
Luis Ibanez
luis . ibanez at kitware . com
Mon, 29 Sep 2003 15:48:24 -0400
Hi Mauricio,
You can instantiate Index<> variables in Python
by using the following expression
myIndex = itkIndex3()
where "3" stands for the dimension.
This is equivalent to the C++ expresion
itk::Index<3> myIndex;
Then, for getting access to the elements of the
index you can use the methods
GetElement()
SetElement()
as
myIndex.SetElement( 0, 130 )
myIndex.SetElement( 1, 215 )
myIndex.SetElement( 2, 167 )
for defining the index {130,215,167}.
The index elements can be read with
myIndex.GetElement( 0 )
myIndex.GetElement( 1 )
myIndex.GetElement( 2 )
For the Connfidence connected filter you
can then do
myFilter = itkConfidenceConnectedImageFilterUS3US3_New()
myFilter.AddSeed( myIndex )
Regards,
Luis
---------------------------------------
Maurício Caliggiuri Inforçati wrote:
> Hi, Luis
>
> I´m using ITK on Python, with VTK, and everything seems to be perfectly.
> But, I´m trying to implement a region growing segmentation with
> ConnectedThresholdImageFilter and so I need to set a seed.
> My problem is that this seed must be itkIndex (mustn´t it?) and I can´t
> get a itkIndex object on python since in InsightToolkit module there is
> not something like itkIndex_New, just like other classes, as
> ConnectedThresholdImageFilter.
> How can I instanciate a itkIndex and set a value for it?
>
> thanks for helping,
>
> Mauricio Inforçati
>
> -----------------------------------------
> Ministério da Ciência e Tecnologia
> Centro de Pesquisas Renato Archer
> http://www . cenpra . gov . br
> -----------------------------------------