<!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 écrit :
<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 <class TImageType> Image</div>
<div>LogImageFilter::ExecuteInternalVectorImage ( const
Image& inImage1 )</div>
<div>{</div>
<div> // Define the input and output image types</div>
<div> typedef TImageType
InputImageType;</div>
<div> typedef typename InputImageType::InternalPixelType
ComponentType;</div>
<div><br>
</div>
<div> typedef typename itk::Image<ComponentType,
InputImageType::ImageDimension> ComponentImageType;</div>
<div><br>
</div>
<div> typedef InputImageType OutputImageType;</div>
<div><br>
</div>
<div> // Get the pointer to the ITK image contained in image1</div>
<div> typename InputImageType::ConstPointer image1 =</div>
<div> dynamic_cast <const InputImageType*> (
inImage1.GetImageBase() );</div>
<div><br>
</div>
<div> // Check that ITK image pointer was properly retrieved</div>
<div> if ( image1.IsNull() )</div>
<div> {</div>
<div> sitkExceptionMacro( "Unexpected template dispatch
error!" );</div>
<div> }</div>
<div><br>
</div>
<div> typedef itk::VectorIndexSelectionCastImageFilter<
InputImageType, OutputImageType > ComponentExtratorType;</div>
<div> typename ComponentExtratorType::Pointer extractor =
ComponentExtratorType::New();</div>
<div> extractor->SetInput( image1 );</div>
<div><br>
</div>
<div> typedef
itk::ImageToVectorImageFilter<ComponentImageType>
ToVectorFilterType;</div>
<div> typename ToVectorFilterType::Pointer toVector =
ToVectorFilterType::New();</div>
<div><br>
</div>
<div> unsigned int numComps =
image1->GetNumberOfComponentsPerPixel();</div>
<div> for ( unsigned int i = 0; i < numComps; ++i )</div>
<div> {</div>
<div> extractor->SetIndex( i );</div>
<div> extractor->Update();</div>
<div><br>
</div>
<div> Image tmp =
this->ExecuteInternal<ComponentImageType>( Image(
extractor->GetOutput() ) );</div>
<div><br>
</div>
<div> typename ComponentImageType::ConstPointer tempITKImage
=</div>
<div> dynamic_cast <const ComponentImageType*> (
tmp.GetImageBase() );</div>
<div><br>
</div>
<div> toVector->SetNthInput( i, tempITKImage );</div>
<div> }</div>
<div><br>
</div>
<div> toVector->Update();</div>
<div><br>
</div>
<div> return Image( toVector->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><ATT00001..txt></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"> </span><span
class="Apple-converted-space"> </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 </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"> </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>