[Insight-users] Any convieniant way to

shiwei swingsw89 at 163.com
Mon Sep 9 22:13:59 EDT 2013


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 !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130910/bab30e52/attachment.htm>


More information about the Insight-users mailing list