[Insight-users] Any convieniant way to
Siavash khallaghi
siavashk at ece.ubc.ca
Tue Sep 10 00:28:36 EDT 2013
It seems that you are trying to perform convolution in ITK. Have you
tried using this class and write a wrapper around it?
http://www.itk.org/Doxygen/html/classitk_1_1ConvolutionImageFilter.html
Siavash
On 9/9/2013 7:13 PM, shiwei wrote:
> Hi,All~
> Now I ran into some problems is that I need to use the
> Itk::meanImageFilter to prosess an Image, and I did it ,then I need to
> visit some Lines of the Pixels in the Image, If I use an
> Iterator,however, I need at least 2 more iterators to do my work
> because I have to visit two LInes of the Image simultaneously. So I
> convert the Itk image to matrix that I can easily process the task.
> Here are the matlab code of my task:
> * for i = 1:20*
> * MMt1=conv22(MMt1,4); //MMT1 is the Image *
> * end*
> * function ss1=conv22(MMt1,Ls)*
> [nxx,nyy]=size(MMt1);
> ss1=MMt1;
> ss=conv2(MMt1,1/(2*Ls+1)^2*ones(2*Ls+1,2*Ls+1)) ;
>
> ss1(Ls+1:nxx-Ls,Ls+1:nyy-Ls)=ss(2*Ls+1:nxx,2*Ls+1:nyy);
> for i=1:Ls
> ss1(i,:)=.5*(ss1(i,:)+ss1(i+1,:));
> ss1(nxx-i+1,:)=.5*(ss1(nxx-i+1,:)+ss1(nxx-i,:));
> end
> for i=1:Ls
> ss1(:,i)=.5*(ss1(:,i)+ss1(:,i+1));
> ss1(:,nyy-i+1)=.5*(ss1(:,nyy-i+1)+ss1(:,nyy-i));
> end
>
> Now I alreay have the ITK code for the*function
> conv22*,however, the real problem is about the *for loop "for
> 1=1:20"*, because I did the meanimageFiltering uses the itkclass,but
> then I convet the itk::images to matrix, now if I want to do the *for
> loop "for 1=1:20",* Do I need to convert the matrix back to images for
> Itk::MeanImageFilter? Or the Filter can have some way to read a matrix?
>
> If I write the code like this ,It will be very compelx for every
> loop I have to conver between matrix and images! Do you have more
> convieniant way to do this task? Or some Filters can read the matrix
> and to do the MeanImageFiltering? Thank you !
>
>
>
>
> _____________________________________
> 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.php
>
> 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/20130909/572abe12/attachment.htm>
More information about the Insight-users
mailing list