<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hello Bradley,<br>
    <br>
    On my side, I found myself needing this for some smoothing filters
    which did not support VectorImage out of the box :<br>
    <br>
    itk::MeanImageFilter<br>
    itk::DiscreteGaussianImageFilter<br>
    itk::GradientAnisotropicDiffusionImageFilter<br>
    <br>
    And I think you can add to the list MedianImageFilter, and the other
    variations of AnisotropicDiffusion filters.<br>
    <br>
    Julien<br>
    <br>
    Le 27/04/2011 14:57, Bradley Lowekamp a &eacute;crit&nbsp;:
    <blockquote
      cite="mid:7C989268-D281-4653-96F0-2A3B469A7AFA@mail.nih.gov"
      type="cite">Hello David,
      <div><br>
      </div>
      <div>We are implementing this independent per component filtering
        in SimpleITK for VectorImages.</div>
      <div><br>
      </div>
      <div>I am curious as to what filters you are finding it useful to
        run on a per component basis, so that we can try to get those
        implemented in SimpleITK.</div>
      <div><br>
      </div>
      <div>Here is a sample of how we are doing it, it sounds like the
        same way you are doing it:</div>
      <div><br>
      </div>
      <div>
        <div>template &lt;class TImageType&gt; Image</div>
        <div>LogImageFilter::ExecuteInternalVectorImage ( const
          Image&amp; inImage1 )</div>
        <div>{</div>
        <div>&nbsp;&nbsp;// Define the input and output image types</div>
        <div>&nbsp;&nbsp;typedef TImageType &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InputImageType;</div>
        <div>&nbsp;&nbsp;typedef typename InputImageType::InternalPixelType &nbsp; &nbsp; &nbsp;
          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ComponentType;</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;typedef typename itk::Image&lt;ComponentType,
          InputImageType::ImageDimension&gt; ComponentImageType;</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;typedef InputImageType OutputImageType;</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;// Get the pointer to the ITK image contained in image1</div>
        <div>&nbsp;&nbsp;typename InputImageType::ConstPointer image1 =</div>
        <div>&nbsp;&nbsp; &nbsp;dynamic_cast &lt;const InputImageType*&gt; (
          inImage1.GetImageBase() );</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;// Check that ITK image pointer was properly retrieved</div>
        <div>&nbsp;&nbsp;if ( image1.IsNull() )</div>
        <div>&nbsp;&nbsp; &nbsp;{</div>
        <div>&nbsp;&nbsp; &nbsp;sitkExceptionMacro( "Unexpected template dispatch
          error!" );</div>
        <div>&nbsp;&nbsp; &nbsp;}</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;typedef itk::VectorIndexSelectionCastImageFilter&lt;
          InputImageType, OutputImageType &gt; ComponentExtratorType;</div>
        <div>&nbsp;&nbsp;typename ComponentExtratorType::Pointer extractor =
          ComponentExtratorType::New();</div>
        <div>&nbsp;&nbsp;extractor-&gt;SetInput( image1 );</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;typedef
          itk::ImageToVectorImageFilter&lt;ComponentImageType&gt;
          ToVectorFilterType;</div>
        <div>&nbsp;&nbsp;typename ToVectorFilterType::Pointer toVector =
          ToVectorFilterType::New();</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;unsigned int numComps =
          image1-&gt;GetNumberOfComponentsPerPixel();</div>
        <div>&nbsp;&nbsp;for ( unsigned int i = 0; i &lt; numComps; ++i )</div>
        <div>&nbsp;&nbsp; &nbsp;{</div>
        <div>&nbsp;&nbsp; &nbsp;extractor-&gt;SetIndex( i );</div>
        <div>&nbsp;&nbsp; &nbsp;extractor-&gt;Update();</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;Image tmp =
          this-&gt;ExecuteInternal&lt;ComponentImageType&gt;( Image(
          extractor-&gt;GetOutput() ) );</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;typename ComponentImageType::ConstPointer tempITKImage
          =</div>
        <div>&nbsp;&nbsp; &nbsp; &nbsp;dynamic_cast &lt;const ComponentImageType*&gt; (
          tmp.GetImageBase() );</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp; &nbsp;toVector-&gt;SetNthInput( i, tempITKImage );</div>
        <div>&nbsp;&nbsp; &nbsp;}</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;toVector-&gt;Update();</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;return Image( toVector-&gt;GetOutput() );</div>
        <div>}</div>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
        <div>
          <div>On Apr 26, 2011, at 9:07 PM, David Doria wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">Lately I've needed to run some filters
            on a VectorImage. The filters only work on single channel
            inputs. To get around this, my process to filter each
            channel separately has been:<br>
            <br>
            1) Use VectorIndexSelectionCastImageFilter to decompose the
            image into its separate channels<br>
            2) In a loop, run a filter on each channel<br>
            3) Use ImageToVectorImageFilter to assemble the output from
            the output of the filter on each channel.<br>
            <br>
            Is this a reasonable process? Is a more automated way to do
            this?<br>
            <br clear="all">
            Thanks,<br>
            <br>
            David<br>
            <span>&lt;ATT00001..txt&gt;</span></blockquote>
        </div>
        <br>
        <div>
          <span class="Apple-style-span" style="font-size: 12px;">
            <p style="margin: 0px;"><font style="font: 12px Helvetica;"
                face="Helvetica" size="3">========================================================</font></p>
            <p style="margin: 0px;"><font style="font: 12px Helvetica;"
                face="Helvetica" size="3">Bradley Lowekamp<span
                  class="Apple-converted-space">&nbsp;</span><span
                  class="Apple-converted-space">&nbsp;</span></font></p>
            <p style="margin: 0px;"><font class="Apple-style-span"
                face="Arial"><span class="Apple-style-span"
                  style="font-family: Arial;"><span
                    class="Apple-style-span" style="font-family: Arial;">Lockheed
                    Martin&nbsp;</span></span></font><font style="font: 12px
                Helvetica;" face="Helvetica" size="3">Contractor for</font></p>
            <p style="margin: 0px;"><font style="font: 12px Helvetica;"
                face="Helvetica" size="3">Office of High Performance
                Computing and Communications</font></p>
            <p style="margin: 0px;"><font style="font: 12px Helvetica;"
                face="Helvetica" size="3">National Library of Medicine<span
                  class="Apple-converted-space">&nbsp;</span></font></p>
            <p style="margin: 0px;"><font style="font: 12px Helvetica;"
                face="Helvetica" size="3"><a moz-do-not-send="true"
                  href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p>
            <br class="Apple-interchange-newline">
          </span>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_____________________________________
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.html">http://www.kitware.com/products/protraining.html</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>
  </body>
</html>