[Insight-users] Filtering all channels of a VectorImage

Julien Malik julien.malik at c-s.fr
Wed Apr 27 09:17:05 EDT 2011


Hello Bradley,

On my side, I found myself needing this for some smoothing filters which 
did not support VectorImage out of the box :

itk::MeanImageFilter
itk::DiscreteGaussianImageFilter
itk::GradientAnisotropicDiffusionImageFilter

And I think you can add to the list MedianImageFilter, and the other 
variations of AnisotropicDiffusion filters.

Julien

Le 27/04/2011 14:57, Bradley Lowekamp a écrit :
> Hello David,
>
> We are implementing this independent per component filtering in 
> SimpleITK for VectorImages.
>
> 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.
>
> Here is a sample of how we are doing it, it sounds like the same way 
> you are doing it:
>
> template <class TImageType> Image
> LogImageFilter::ExecuteInternalVectorImage ( const Image& inImage1 )
> {
>   // Define the input and output image types
>   typedef TImageType                                                   
>                                  InputImageType;
>   typedef typename InputImageType::InternalPixelType                   
>       ComponentType;
>
>   typedef typename itk::Image<ComponentType, 
> InputImageType::ImageDimension> ComponentImageType;
>
>   typedef InputImageType OutputImageType;
>
>   // Get the pointer to the ITK image contained in image1
>   typename InputImageType::ConstPointer image1 =
>     dynamic_cast <const InputImageType*> ( inImage1.GetImageBase() );
>
>   // Check that ITK image pointer was properly retrieved
>   if ( image1.IsNull() )
>     {
>     sitkExceptionMacro( "Unexpected template dispatch error!" );
>     }
>
>   typedef itk::VectorIndexSelectionCastImageFilter< InputImageType, 
> OutputImageType > ComponentExtratorType;
>   typename ComponentExtratorType::Pointer extractor = 
> ComponentExtratorType::New();
>   extractor->SetInput( image1 );
>
>   typedef itk::ImageToVectorImageFilter<ComponentImageType> 
> ToVectorFilterType;
>   typename ToVectorFilterType::Pointer toVector = 
> ToVectorFilterType::New();
>
>   unsigned int numComps = image1->GetNumberOfComponentsPerPixel();
>   for ( unsigned int i = 0; i < numComps; ++i )
>     {
>     extractor->SetIndex( i );
>     extractor->Update();
>
>     Image tmp = this->ExecuteInternal<ComponentImageType>( Image( 
> extractor->GetOutput() ) );
>
>     typename ComponentImageType::ConstPointer tempITKImage =
>       dynamic_cast <const ComponentImageType*> ( tmp.GetImageBase() );
>
>     toVector->SetNthInput( i, tempITKImage );
>     }
>
>   toVector->Update();
>
>   return Image( toVector->GetOutput() );
> }
>
>
>
> On Apr 26, 2011, at 9:07 PM, David Doria wrote:
>
>> 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:
>>
>> 1) Use VectorIndexSelectionCastImageFilter to decompose the image 
>> into its separate channels
>> 2) In a loop, run a filter on each channel
>> 3) Use ImageToVectorImageFilter to assemble the output from the 
>> output of the filter on each channel.
>>
>> Is this a reasonable process? Is a more automated way to do this?
>>
>> Thanks,
>>
>> David
>> <ATT00001..txt>
>
> ========================================================
>
> Bradley Lowekamp
>
> Lockheed Martin Contractor for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine
>
> blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>
>
>
>
>
> _____________________________________
> 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.html
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110427/46a7a277/attachment.htm>


More information about the Insight-users mailing list