<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I agree with all of the suggestions given but I think that it's
    worth mentioning that templated C++ code requires much more
    processing than non-templated code, partly because you can't hide
    anything in .cpp files. Everything must be in headers. When the code
    is compiled a class is created for every every specific type (such
    as pixel type) and then these are compiled so it is easy to make
    very long compile times.<br>
    <br>
    If I have been working with a piece of code and think that I have
    more headers included than I need, I comment out the whole block and
    then try to compile it. I then uncomment one by one only those
    necessary to allow the code to compile.<br>
    <br>
    Tim<br>
    <br>
    <div class="moz-cite-prefix">On 13-03-11 08:43 AM, Bradley Lowekamp
      wrote:<br>
    </div>
    <blockquote
      cite="mid:497228D6-5A78-47DA-B805-CAD301130494@mail.nih.gov"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      If you are gcc, you can look into "ccache" while it does not make
      the compilation go faster, it caches the output so when you
      compile again it doesn't have to do all the work. It really a huge
      help when you are moving between branches in a project like ITK or
      SimpleITK. I am not sure how much it'll help for your case.
      <div><br>
      </div>
      <div>Brad<br>
        <div><br>
        </div>
        <div><br>
          <div>
            <div>On Mar 11, 2013, at 7:34 AM, Bill Lorensen &lt;<a
                moz-do-not-send="true"
                href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;
              wrote:</div>
            <br class="Apple-interchange-newline">
            <blockquote type="cite">
              <meta http-equiv="Content-Type" content="text/html;
                charset=UTF-8">
              As you said, reduce the number of pixel types for
              development.<br>
              <br>
              <div class="gmail_quote">On Mon, Mar 11, 2013 at 4:21 AM,
                Ariel Hernán Curiale <span dir="ltr">&lt;<a
                    moz-do-not-send="true"
                    href="mailto:curiale@gmail.com" target="_blank">curiale@gmail.com</a>&gt;</span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div style="word-wrap:break-word">Hi Saurabh,
                    <div><br>
                    </div>
                    <div>Thanks four your tips. I'm using all the
                      headers. I was thinking to use only one pixel type
                      (for develop) with the hope to reduce the
                      compiling time.</div>
                    <div><br>
                      <div>
                        <span
style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                          <div
style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal">Thank
                            again.</div>
                          <div
style="font-style:normal;font-size:medium;font-family:Helvetica;font-weight:normal">__________________________________<br>
                            <font color="#b7bfc5">|</font> Ariel Hernán
                            Curiale Ph.D Student<br>
                            <font color="#b7bfc5">|</font> ETSI
                            Telecomunicación<br>
                            <font color="#b7bfc5">|</font> Universidad
                            de Valladolid<br>
                            <font color="#b7bfc5">|</font> Campus Miguel
                            Delibes<br>
                            <font color="#b7bfc5">|</font> 47011
                            Valladolid, Spain<br>
                            <font color="#b7bfc5">|</font> Phone:
                            983-423000 ext. 5590</div>
                          <font
style="font-family:Helvetica;font-size:medium;font-weight:normal;font-style:normal"
                            color="#b7b7b7">|</font> Web: <a
                            moz-do-not-send="true"
                            href="http://www.curiale.com.ar/"
                            target="_blank"><font color="#084ebe">www.curiale.com.ar</font></a><br>
                          <font
style="font-family:Helvetica;font-size:medium;font-weight:normal;font-style:normal"
                            color="#b7b7b7">|</font>_________________________________
                        </span>
                      </div>
                      <br>
                      <div>
                        <div>El 11/03/2013, a las 00:50, Saurabh Garg
                          escribió:</div>
                        <div>
                          <div class="h5"><br>
                            <blockquote type="cite">
                              <div>Hi Ariel,</div>
                              <div> </div>
                              <div>I had similar problem. There are
                                couple of things you can do. Try to
                                remove the ITK header files which you
                                are not using anymore. As you mention,
                                you are already compiling the modified
                                files only. Try to split the code
                                further over more files/modules, if you
                                can. For Instance, I see, you are using
                                different optimizers. Are you using all
                                of them or testing the performance
                                with different optimizer. In later case,
                                I would protect the code with #ifdef and
                                #endif, so that you can exclude the
                                code/header files which you don't need
                                for the current run.</div>
                              <div> </div>
                              <div> </div>
                              <div>HTH,</div>
                              <div>Saurabh<br>
                                <br>
                              </div>
                              <div class="gmail_quote">On Sun, Mar 10,
                                2013 at 2:31 PM, Ariel Hernán Curiale <span
                                  dir="ltr">&lt;<a
                                    moz-do-not-send="true"
                                    href="mailto:curiale@gmail.com"
                                    target="_blank">curiale@gmail.com</a>&gt;</span>
                                wrote:<br>
                                <blockquote class="gmail_quote"
                                  style="margin:0px 0px 0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
                                  <div>Hi,
                                    <div>. <br>
                                    </div>
                                    <div>I'm looking for some tips about
                                      how can I reduce the compilation
                                      time. I created some
                                      libraries Metric1.a, Metric2.a,
                                      Metric3.a, BlockMatching.a and
                                      MyRegistration.a to compile just
                                      the modified code and not all of
                                      it.</div>
                                    <div><br>
                                    </div>
                                    <div>In my code, I use this main
                                      class:</div>
                                    <div><br>
                                    </div>
                                    <div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">#include
&lt;itkSymmetricForcesDemonsRegistrationFilter.h&gt;</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">#include
&lt;itkMultiResolutionPDEDeformableRegistration.h&gt;</font></div>
                                    </div>
                                    <div style="font:11px/normal
                                      Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">#include
&lt;itkBSplineInterpolateImageFunction.h&gt;</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <font face="Helvetica" size="3">#include
&lt;itkMultiResolutionImageRegistrationMethod.h&gt;</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">#include
&lt;itkMultiResolutionPyramidImageFilter.h&gt;</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <div style="font:11px/normal
                                          Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                            face="Helvetica" size="3">#include
&lt;itkBSplineTransform.h&gt;</font></div>
                                        <div style="font:11px/normal
                                          Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                            face="Helvetica" size="3">#include
&lt;itkRegularStepGradientDescentOptimizer.h&gt;</font></div>
                                        <div style="font:11px/normal
                                          Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                          <font face="Helvetica"
                                            size="3">#include
                                            &lt;itkLBFGSBOptimizer.h&gt;</font></div>
                                        <div style="font:11px/normal
                                          Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                            face="Helvetica" size="3">#include
&lt;itkConjugateGradientOptimizer.h&gt;</font></div>
                                        <div style="font:11px/normal
                                          Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                          <div style="font:11px/normal
                                            Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                              face="Helvetica" size="3">#include
&lt;itkLinearInterpolateImageFunction.h&gt;</font></div>
                                          <div style="font:11px/normal
                                            Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                              face="Helvetica" size="3">#include
&lt;itkInterpolateImageFunction.h&gt;</font></div>
                                          <div style="font:11px/normal
                                            Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                            <font face="Helvetica"
                                              size="3">#include
                                              &lt;itkResampleImageFilter.h&gt;</font></div>
                                          <div style="font:11px/normal
                                            Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                            <div style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                              <font face="Helvetica"
                                                size="3">#include
                                                &lt;itkRecursiveMultiResolutionPyramidImageFilter.h&gt;</font></div>
                                            <div style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                              <div
                                                style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                <font face="Helvetica"
                                                  size="3">#include
                                                  &lt;itkCovariantVector.h&gt;</font></div>
                                              <div
                                                style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                <div
                                                  style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                  <font face="Helvetica"
                                                    size="3">#include
                                                    &lt;itkMeanSquaresImageToImageMetric.h&gt;</font></div>
                                                <div
                                                  style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                  <div
                                                    style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                    <font
                                                      face="Helvetica"
                                                      size="3">#include
&lt;itkBinaryDilateImageFilter.h&gt;</font></div>
                                                  <div
                                                    style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                    <div
                                                      style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                      <font
                                                        face="Helvetica"
                                                        size="3">#include
&lt;itkResampleImageFilter.h&gt;</font></div>
                                                    <div
                                                      style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                                        face="Helvetica"
                                                        size="3">#include
&lt;itkExtractImageFilter.h&gt;</font></div>
                                                    <div
                                                      style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                      <div
                                                        style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                                          face="Helvetica"
                                                          size="3">#include
&lt;itkWarpImageFilter.h&gt;</font></div>
                                                      <div
                                                        style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                        <div
                                                          style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                                          face="Helvetica"
                                                          size="3">#include
&lt;itkMultiResolutionPDEDeformableRegistration.h&gt;</font></div>
                                                        <div
                                                          style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                          <div
                                                          style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                                          face="Helvetica"
                                                          size="3">#include
&lt;itkRescaleIntensityImageFilter.h&gt;</font></div>
                                                          <div
                                                          style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                                          face="Helvetica"
                                                          size="3">#include
&lt;itkBinaryThresholdImageFilter.h&gt;</font></div>
                                                        </div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                              <div
                                                style="font:11px/normal
Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                                <font face="Helvetica"
                                                  size="3">#include
                                                  &lt;itkImageRandomConstIteratorWithIndex.h&gt;</font></div>
                                              <div
                                                style="font:11px/normal
Monaco;margin:0px;color:rgb(255,255,255);font-size-adjust:none;font-stretch:normal"><span
style="text-decoration:underline"><br>
                                                </span></div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div>Also, I work with different
                                      types of pixels in 2D, 3D and 4D:</div>
                                    <div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">unsigned
                                          char</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">char</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <font face="Helvetica" size="3">unsigned
                                          short</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">short</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <font face="Helvetica" size="3">unsigned
                                          int</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">int</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <font face="Helvetica" size="3">unsigned
                                          long</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">long</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                        <font face="Helvetica" size="3">float</font></div>
                                      <div style="font:11px/normal
                                        Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                          face="Helvetica" size="3">double</font></div>
                                    </div>
                                    <div style="font:11px/normal
                                      Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                      <font face="Helvetica" size="3"><br>
                                      </font></div>
                                    <div style="font:11px/normal
                                      Monaco;margin:0px;font-size-adjust:none;font-stretch:normal"><font
                                        face="Helvetica" size="3"><br>
                                      </font></div>
                                    <div style="font:11px/normal
                                      Monaco;margin:0px;font-size-adjust:none;font-stretch:normal">
                                      <span
                                        style="font-family:Helvetica;font-size:medium">The
                                        main problem is that the code
                                        takes too much time to compile
                                        (I use itk-4.3,  vtk-5.10 and
                                        gcc 4.2). If anyone could give
                                        me some tips about how can I
                                        reduce the compiling time it
                                        would be really useful.</span></div>
                                    <div><br>
                                    </div>
                                    <div>In the CMakeList.txt I link the
                                      libraries and the main code with
                                      ${ITK_LIBRARIES} (I couldn't find
                                      the ITKRegistrationCommon library
                                      to use just this library).</div>
                                    <div><br>
                                      <div>
                                        <div><span
style="text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-variant:normal;word-spacing:0px;white-space:normal;border-collapse:separate"><span
style="text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-variant:normal;word-spacing:0px;white-space:normal;border-collapse:separate">
                                              <div
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal">
                                                <div
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal">Regards,</div>
                                                <div
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal">__________________________________<br>
                                                  <font color="#b7bfc5">|</font> Ariel
                                                  Hernán Curiale Ph.D
                                                  Student<br>
                                                  <font color="#b7bfc5">|</font> ETSI
                                                  Telecomunicación<br>
                                                  <font color="#b7bfc5">|</font> Universidad
                                                  de Valladolid<br>
                                                  <font color="#b7bfc5">|</font> Campus
                                                  Miguel Delibes<br>
                                                  <font color="#b7bfc5">|</font> 47011
                                                  Valladolid, Spain<br>
                                                  <font color="#b7bfc5">|</font> Phone:
                                                  983-423000 ext. 5590</div>
                                                <div><font
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal"
                                                    color="#b7b7b7">|</font> Web: <a
moz-do-not-send="true" href="http://www.curiale.com.ar/" target="_blank"><font
                                                      color="#084ebe">www.curiale.com.ar</font></a><br>
                                                  <font
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal"
                                                    color="#b7b7b7">|</font><span
style="font-family:Helvetica;font-size:medium;font-style:normal;font-weight:normal">_________________________________</span></div>
                                              </div>
                                            </span></span></div>
                                      </div>
                                      <br>
                                    </div>
                                  </div>
                                  <br>
                                  _____________________________________<br>
                                  Powered by <a moz-do-not-send="true"
                                    href="http://www.kitware.com/"
                                    target="_blank">www.kitware.com</a><br>
                                  <br>
                                  Visit other Kitware open-source
                                  projects at<br>
                                  <a moz-do-not-send="true"
                                    href="http://www.kitware.com/opensource/opensource.html"
                                    target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                                  <br>
                                  Kitware offers ITK Training Courses,
                                  for more information visit:<br>
                                  <a moz-do-not-send="true"
                                    href="http://www.kitware.com/products/protraining.php"
                                    target="_blank">http://www.kitware.com/products/protraining.php</a><br>
                                  <br>
                                  Please keep messages on-topic and
                                  check the ITK FAQ at:<br>
                                  <a moz-do-not-send="true"
                                    href="http://www.itk.org/Wiki/ITK_FAQ"
                                    target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
                                  <br>
                                  Follow this link to
                                  subscribe/unsubscribe:<br>
                                  <a moz-do-not-send="true"
                                    href="http://www.itk.org/mailman/listinfo/insight-users"
                                    target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
                                  <br>
                                </blockquote>
                              </div>
                              <br>
                            </blockquote>
                          </div>
                        </div>
                      </div>
                      <br>
                    </div>
                  </div>
                  <br>
                  _____________________________________<br>
                  Powered by <a moz-do-not-send="true"
                    href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
                  <br>
                  Visit other Kitware open-source projects at<br>
                  <a moz-do-not-send="true"
                    href="http://www.kitware.com/opensource/opensource.html"
                    target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                  <br>
                  Kitware offers ITK Training Courses, for more
                  information visit:<br>
                  <a moz-do-not-send="true"
                    href="http://www.kitware.com/products/protraining.php"
                    target="_blank">http://www.kitware.com/products/protraining.php</a><br>
                  <br>
                  Please keep messages on-topic and check the ITK FAQ
                  at:<br>
                  <a moz-do-not-send="true"
                    href="http://www.itk.org/Wiki/ITK_FAQ"
                    target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
                  <br>
                  Follow this link to subscribe/unsubscribe:<br>
                  <a moz-do-not-send="true"
                    href="http://www.itk.org/mailman/listinfo/insight-users"
                    target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
                  <br>
                </blockquote>
              </div>
              <br>
              <br clear="all">
              <div><br>
              </div>
              -- <br>
              Unpaid intern in BillsBasement at noware dot com<br>
              _____________________________________<br>
              Powered by <a moz-do-not-send="true"
                href="http://www.kitware.com">www.kitware.com</a><br>
              <br>
              Visit other Kitware open-source projects at<br>
              <a moz-do-not-send="true"
                href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
              <br>
              Kitware offers ITK Training Courses, for more information
              visit:<br>
              <a moz-do-not-send="true"
                href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br>
              <br>
              Please keep messages on-topic and check the ITK FAQ at:<br>
              <a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
              <br>
              Follow this link to subscribe/unsubscribe:<br>
              <a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_____________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Kitware offers ITK Training Courses, for more information visit:
<a class="moz-txt-link-freetext" href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a>

Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Tim Allman, Ph.D.
35 Margaret Street,
Guelph Ontario N1E 5R6
Canada
</pre>
  </body>
</html>