[Insight-users] Python ITK,
minimum and maximum computation : Get a fish and learn to fish
Zachary Pincus
zpincus at stanford.edu
Wed Apr 12 13:26:16 EDT 2006
There is also 'plain vanilla' way to do this (without using nice
convenience functions in WrapITK). I'll mention it because it's
always good to know what's going on under the hood. This is: use the
GetMinimum() and GetMaximum() methods of the filter.
How do you find out useful methods like this? Several ways:
(1) Go to the ITK doxygen, e.g.
http://www.itk.org/Doxygen/html/classes.html
then look at the class in question:
http://www.itk.org/Doxygen/html/
classitk_1_1MinimumMaximumImageCalculator.html
and note it has methods:
GetMinimum() and GetMaximum()
(2) After a while, you'll get a feel for the ITK convention of
accessing any variable that you might want from a class via a 'Get'
method. So you could type:
myfilter.Get[TAB]
in ipython to see what all variables, etc., you can query from the
filter.
(3) If the filter is called MinimumMaximumImageCalculator, you could
even probably guess (once you are familiar enough with the ITK
conventions; it'll come in time) that there ought to be methods
GetMinimum and GetMaximum.
Zach
On Apr 12, 2006, at 8:15 AM, Gaetan Lehmann wrote:
>
> Hi,
>
> WrapITK comes with some functions to make common task like this one
> easier:
>
> 1> import itk
>
> 2> reader = itk.ImageFileReader.IUC3.New(FileName="/home/glehmann/
> analyse/granex/emb-01ZOOM.tif")
>
> 3> itk.range(reader)
> 3> (0, 255)
>
>
> If you have applied the optional patches, you can use the "print"
> command on an ITK object. Without the optional patch, you can use
> itk.echo() function (print is a reserved word in python)
>
> 4> print reader
> <snip>
>
> 5> itk.echo(reader)
> <snip>
>
>
> For more info, with ipython, the class name followed by "?" will
> display you the man page of the class
>
> 6> itk.ImageFileReader?
>
> Or you can found more doc in the ITK doxygen pages: http://
> www.itk.org/Doxygen/html/hierarchy.html
>
> Gaetan
>
>
>
> On Wed, 12 Apr 2006 12:48:48 +0200, Vincent Page <vpage at univ-ag.fr>
> wrote:
>
>> Hi,
>> I would like to print the minimum and maximum
>> of an image. It looks like
>> "MinimumMaximumImageCalculator" would help.
>>
>> What I did is (whith a little help of the TAB with the interpreter)
>>
>> ------------------------------
>>
>> affiche = itk.MinimumMaximumImageCalculator.IF2.New(myFilter)
>> affiche.Compute()
>> affiche.Print()
>> ------------------------------
>>
>> This doesn't work because of the Print method which takes two (?)
>> arguments
>> (or one, the other probably being the name of the method....)
>>
>> So I had a look into the sources and found no Print method in the
>> MinimumMax... class.
>> I guess it is inherited from elsewhere....
>>
>> So my questions :
>> - How can I use this ?
>> - Where can I find some docs, specially when playing with WrapITK
>> and python ?
>>
>> The Itk software Guide did not talk about the last 3 filters I
>> needed,
>> and I would like to find another solution than email constantly
>> the insight-users list...
>>
>> Best regards,
>> Vincent.
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list