<div dir="ltr"><div><div>thanks for the fast reply. <br><br>Oops, it seems i missed that there is a backward operation of GetArrayFromImage, i.e. GetImageFromArray..<br></div>However, forward still doesn't work for me.<br></div>This example code<br><div><div><div><div><br>% geometry<br>g = py.SimpleRTK.ThreeDCircularProjectionGeometry();<br>for i=0:359,<br> g.AddProjection(500,1000,i);<br>end<br><br>% what projects<br>cube1 = zeros(128,128,128);<br>cube = single(cube1);<br><br>cube(17:112,17:112,17:112) = 1;<br>cube(33:96,33:96,33:96) = 0;<br><br>data_size = size(cube);<br>result = py.numpy.reshape(cube(:)', int32(fliplr(size(transpose))));<br>volume = py.SimpleRTK.GetImageFromArray(result);<br><br>const = py.SimpleRTK.ConstantImageSource();<br>const.SetSpacing(py.list([1,1,1]));<br>const.SetSize(py.list(int32(data_size)));<br>const.SetOrigin(py.list([-64.5,-64.5,-64.5]));<br>volume_meta = const.Execute();<br><br>volume.CopyInformation(volume_meta);<br><br>% projections<br> <br>const2 = py.SimpleRTK.ConstantImageSource();<br>const2.SetSpacing(py.list([1,1,1]));<br>const2.SetSize(py.list(int32([512,1,360])));<br>const2.SetOrigin(py.list([-255.5,0,0]));<br>proj = const2.Execute();<br><br>% forward<br><br>forward = py.SimpleRTK.JosephForwardProjectionImageFilter();<br>forward.SetGeometry(g);<br>proj = forward.Execute(proj, img);<br><br></div><div>caused the following error :<br>Error using SimpleRTK>Execute (line 6218)<br>Python Error: RuntimeError: Exception thrown in SimpleRTK JosephForwardProjectionImageFilter_Execute:<br>$RTK_BUILD$/SimpleRTK-build/Code/BasicFilters/src/srtkJosephForwardProjectionImageFilter.cxx:100:<br>srtk::ERROR: Image2 for JosephForwardProjectionImageFilter doesnt match type or dimension!<br></div><div><br></div><div>I tried different types of cube, but with no success. <br><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 23, 2017 at 11:01 PM, Simon Rit <span dir="ltr"><<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Julia,<br>
I would have used<br>
volume = py.GetImageFromArray(result)<br>
instead of your last line. Does this work? If it does, then you have<br>
to be sure that you set correctly the origin, spacing and direction<br>
(the ITK meta information). One way to do this if you already have an<br>
image with the correct meta information would be to use<br>
py.volume.CopyInformation(<wbr>volume)<br>
Simon<br>
<div><div class="h5"><br>
On Thu, Mar 23, 2017 at 11:14 AM, Julia Semyakishkina<br>
<<a href="mailto:prekrasnaya1985@gmail.com">prekrasnaya1985@gmail.com</a>> wrote:<br>
> Hello.<br>
> In matlab example from <a href="http://wiki.openrtk.org/index.php/SimpleRTK" rel="noreferrer" target="_blank">http://wiki.openrtk.org/index.<wbr>php/SimpleRTK</a> volume<br>
> which is projected generates in SheppLoganPhantomFilter(). But i have my own<br>
> volume, that is stored in matlab regular matrix for example.<br>
><br>
> What i want to do:<br>
> forward = py.<wbr>JosephForwardProjectionImageFi<wbr>lter();<br>
> forward.SetGeometry(g);<br>
> projs = forward.Execute(projs, volume);<br>
><br>
> The problem is to initialize the volume parameter.<br>
> By this code<br>
> data_size = size(matimg);<br>
> transpose = matimg';<br>
> result=py.numpy.reshape(<wbr>transpose(:)', int32(data_size));<br>
> volume = py.Image.fromarray(result);<br>
><br>
> i store volume in type of py.Image, but in Execute() method i have to pass<br>
> py.SimpleRTK.SimpleRTK.Image type. So, is there way to do such convertation<br>
> ? Or is there some another way to init py.SimpleRTK.SimpleRTK.Image with my<br>
> own matlab data ?<br>
><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Rtk-users mailing list<br>
> <a href="mailto:Rtk-users@public.kitware.com">Rtk-users@public.kitware.com</a><br>
> <a href="http://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/rtk-users</a><br>
><br>
</blockquote></div><br></div>