[ITK] How to check the functions in the ITK documentation

Luis Ibanez luis.ibanez at kitware.com
Sat May 10 08:52:28 EDT 2014


There are some cases in which methods are implemented via Macros.

This is done with the purpose of improving consistency and simplicity
in the code, but come at the price of sometimes not seeing directly
where the code is implemented.

The typical examples are the

          itkSetMacro(  variablename, type )
          itkGetMacro(  variablename, type )

That are used in most ITK classes to implement Get / Set methods.



For the particular case of the SetFileName method,
it helps to look at the Macro

     itkSetGetDecoratedInputMacro(FileName, std::string);


in the documentation at:

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageFileReader.html#a3d0bb0e7bd412a76f92f71acdb42bff2


You will find it used in line 130 of the itkImageFileReader.h file:

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/ImageBase/include/itkImageFileReader.h#L130


You will find this macro defined in turn in:

         ITK/Modules/Core/Common/include/itkMacro.h

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkMacro.h#L808

 808 #define itkSetGetDecoratedInputMacro(name, type)  \
 809   itkSetDecoratedInputMacro(name, type)           \
 810   itkGetDecoratedInputMacro(name, type)


Then, if you follow the itkSetDecoratedInputMacro() in line 758

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkMacro.h#L758

where the macro defines (in this case) the functions:

         SetFileNameInput()

         SetFileName()


by the lines


759:    virtual void Set##name##Input( ...

768:     virtual void Set##name( ....


where "name" is the argument of the macro,
and in this particular case it corresponds to "FileName".



In principle, we can adjust the configuration of the Doxygen
documentation to expand this macros in the HTML pages,
reflecting better what the compiler gets to see, after the
macros have been used to generate code.


This is done in the file:

ITK/Utilities/Doxygen/doxygen.config.in

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Doxygen/doxygen.config.in#L1961




---------------------------------------


Hope this helps,


    Thanks

         Luis





On Sat, May 10, 2014 at 6:15 AM, Michka Popoff <michkapopoff at gmail.com>wrote:

> Hi
>
> I merged your two questions in one topic, so I can answer the two at once.
>
> In the class ImageFileReader, there is no SetFileName method. But the
> documentation states:
> *This source object is a general filter to read data from a variety of
> file formats. It works with a ImageIOBase subclass to actually do the
> reading of the data.*
>
> So if you go the ImageIOBase [1] class definition, you will find the
> SetFileName method. This can be confusing at the beginning, but when you
> don’t find a method somewhere (and this is often the case for most of
> projects you’ll find around, not only ITK), think to look at the parent
> class and the child/subclass. Often the methods are defined somewhere else.
>
>
> For the Update() call, this is related to the ITK pipeline. Some detailed
> description can be found here [2]. There is also one article here [3] that
> is more readable, or there is a section (13.3) in the ITK software guide
> here [4].
>
> Finally, we have a nice set of examples here [5] which show you how to use
> the ITK pipeline. This should help you getting started.
>
>
> [1] http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageIOBase.html
> [2] http://www.itk.org/Doxygen/html/classitk_1_1DataObject.html
> [3] http://www.kitware.com/media/html/IOStreamingInITK.html
> [4] http://www.itk.org/ItkSoftwareGuide.pdf
> [5] http://itk.org/ITKExamples/
>
>
> On 9 mai 2014, at 22:45, Simplicity Peace <simplicitypeacescm at gmail.com>
> wrote:
>
> Hello,
>
> For instance, I tried to look for the functions of the class
> "ImageFileReader". In the ITK software guide, a function called
> "SetFileName" was used. I thought of looking for the functions that come
> under that class here<http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageFileReader.html#pub-methods>,
> but couldn't find that "SetFileName" function. Am I searching in the wrong
> place?
>
> Thanks.
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
>
> Hello,
>
> I'm new to `ITK`. I just want to ask, what does `Update()` mean? For
> example, I found that I had to use it with an `ImageFileReader`. Why is
> that?
>
> Thanks.
>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140510/d24fe87c/attachment-0002.html>


More information about the Community mailing list