[Insight-users] Code integration and code design - Question

Matt McCormick matt.mccormick at kitware.com
Mon Nov 12 15:13:28 EST 2012


Hi Alex,

>
> thank you for your suggestions.
>
> What stephane meant to say is that the external third party library is made
> of only 1 file of C Code which include many functions. Those functions
> manipulate points coordinates.

I think if it is worthwhile to keep the library around instead of
refactoring it into ITK code, then it should be worthwhile to put in
its own module.   In general, we are trying to reduce the dependence
on third party code merged into the repository.  Maintenance, not
conflicting with system versions, and upgrades are all burdens that
must be handled after the code has been merged.

>
> ITK wrappers have been written as templated function to allow to re-use Mesh
> / Cells / Points types and call those C functions. However, we do not have
> written classes for that (functors).
> Our questions boils down to: shall we take a VTK style approach with a bunch
> of static inlined function laying inside one single class (vtk::Math), or an
> ITK approach where we will need to have one functor class (and thus a
> separate file) for each?

In general, ITK design is more of an a C++ object-oriented design than
a number of small utility functions common in C code.  In terms on
reusibility and style, ITK uses one file per class.  There are some
current exceptions with some functors, but there is a desire to make
this more consistent.

>
> Additionally, we were wondering if it would be OK to just copy the C code in
> the corresponding functor file, to avoid having an external library with a
> single file? What is preferred in this case?

Effort was made to prevent nesting third party code within pure-ITK
modules, and we should try to maintain this clean separation.

Thanks,
Matt



>
> We know already in which module the itk Classes should be.
>
> best regards,
>
> alex.
>
>
> On Mon, Nov 12, 2012 at 11:56 PM, Matt McCormick
> <matt.mccormick at kitware.com> wrote:
>>
>> Hi Stephane,
>>
>> Thanks for making contributions to the ITK community.
>>
>> Regarding how to contribute new code, unless it is modifications to
>> existing classes, the preferred method is the creation of
>> External/Remote modules as described here:
>>
>>
>> http://insightsoftwareconsortium.github.com/ITKBarCamp-doc/ITK/ConstructITKModule/index.html
>>
>> http://www.itk.org/Wiki/ITK/Policy_and_Procedures_for_Adding_Remote_Modules
>>
>> This is preferred as opposed to forking the main repository for a
>> number of reasons.
>>
>> Regarding the third party library usage: the general process is to
>> create a new Module for each third party library.  If the library is
>> very small, it may be worthwhile to re-write it in ITK style instead.
>>
>> >  * Our code file contain several small inline function that are all in
>> > one .cxx file.
>>  > 1 - Can we keep all the function into one file? Is there already
>> one such file in ITK that already >gather small inline function?
>> >  2 - Keep the aspect of 1 file = 1 class, and do one class for each
>> > small function in our code?
>>
>> ITK uses an C++ object-orientated design, so re-factoring to be
>> consistent with ITK style may be necessary.
>>
>> HTH,
>> Matt
>>
>> On Mon, Nov 12, 2012 at 8:56 AM, Steffan <ulysse.rigaud at gmail.com> wrote:
>> > Hi everybody,
>> >
>> > We have an insight journal (http://hdl.handle.net/10380/3329) that we
>> > would
>> > like to integrate into ITK, and we are currently starting to merge them
>> > into
>> > our fork version of ITK to test.
>> > We have two questions, concerning the integration into the different
>> > module
>> > of ITK and on code design in ITK
>> >
>> > * To test the orientation of vectors, we are using a library in C that
>> > we
>> > have wrap into some ITK function. This library is a single file, done by
>> > Jonathan Shewchuk (http://www.cs.cmu.edu/~quake/robust.html) under
>> > public
>> > domain.
>> > Where should we integrate this library in ITK?
>> >   1 - In ThirdParty folder? As it is a third party library, external to
>> > ITK,
>> > and not in C++. CONS: it may be too much for only 1 file.
>> >   2 - Directly in Core/Mesh | Core/QuadEdgeMesh? This library is only on
>> > file and is use for geometrical exact orientation product mainly to be
>> > used
>> > into Mesh or QuadEdgeMesh filters. CONS: it is not an ITK/C++ files.
>> >   3 - Or we could integrate all the library into our wrappers class and
>> > then
>> > integrate our class into ITK (Mesh or QuadEdgeMesh folder for the reason
>> > explained in 2).
>> >
>> > * Our code file contain several small inline function that are all in
>> > one
>> > .cxx file.
>> >   1 - Can we keep all the function into one file? Is there already one
>> > such
>> > file in ITK that already gather small inline function?
>> >   2 - Keep the aspect of 1 file = 1 class, and do one class for each
>> > small
>> > function in our code?
>> >
>> > I hope my questions are clear enough.
>> >
>> > Thanks.
>> > Regards,
>> > --
>> > Stephane
>> >
>> > _____________________________________
>> > 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.php
>> >
>> > 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
>> >
>> _____________________________________
>> 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.php
>>
>> 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
>
>


More information about the Insight-users mailing list