[Insight-users] Specializing ITK classes into libraries to speed up compilation

Parag Chandra pchandra@radonc.unc.edu
Thu, 13 Feb 2003 15:34:00 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0044_01C2D375.54A44000
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hey all,

I have noticed that the more ITK classes I include in my program, the =
longer my program takes to build. In fact, the build time seems to be =
pretty constant even if I do something as simple as adding a comment to =
the main source file, and I suspect this is because all the ITK classes =
have to be constantly recompiled. What I have started to do is create a =
library of classes that are simple specializations of the ITK classes =
that I use, templated over the only type of image that I use (<double, =
2>). So I have a set of classes sort of like this:

namespace aks {
namespace double2 {
class Image : public itk::Image<double, 2>
{
// define standard class typedefs, New macro, default constructor
};

class ImageReader : public itk::ImageFileReader<aks::double2::Image>
{=20
// define standard class typedefs, New macro, default constructor
};

etc.
}
}

that I can then compile into a library. It works, but I have only done =
this for a couple of classes so far, so I do not see any noticeable =
speedup in compilation time just yet. What I was wondering is if anyone =
else out there has tried something like this and could comment before I =
(potentially) waste my time in vain. I think at one point there was even =
some discussion on the ITK mailing list regarding this sort of thing, =
but I don't think anything ever came of it so maybe others have already =
decided it's not worth the time.

Thanks,
Parag Chandra
------=_NextPart_000_0044_01C2D375.54A44000
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hey all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have noticed that the more ITK =
classes I include=20
in my program, the longer my program takes to build. In fact, the build =
time=20
seems to be pretty constant even if&nbsp;I do something as simple as =
adding a=20
comment to the main source file, and I suspect this is because all the =
ITK=20
classes have to be constantly recompiled. What I have started to do is =
create a=20
library of classes that are simple specializations of the ITK classes =
that I=20
use, templated over the only type of image that I use (&lt;double, =
2&gt;). So I=20
have a set of classes sort of like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>namespace aks {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>namespace double2 {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>class Image : public =
itk::Image&lt;double,=20
2&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>// define standard class typedefs, New =
macro,=20
default constructor</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>};</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class ImageReader : public=20
itk::ImageFileReader&lt;aks::double2::Image&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{=20
<DIV><FONT face=3DArial size=3D2>// define standard class typedefs, New =
macro,=20
default constructor</FONT></DIV>};</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>etc.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>that I can then compile into&nbsp;a =
library. It=20
works, but I have only done this for a couple of classes so far, so I do =
not see=20
any noticeable speedup in compilation time just yet. What I was =
wondering is if=20
anyone else out there has tried something like this and could comment =
before I=20
(potentially) waste my time in vain. I think at one point there was even =
some=20
discussion on the ITK mailing list regarding this sort of thing, but I =
don't=20
think anything ever came of it so maybe others have already decided it's =
not=20
worth the time.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Parag =
Chandra</FONT></DIV></BODY></HTML>

------=_NextPart_000_0044_01C2D375.54A44000--