<div dir="ltr">Dear RTK.User,<div><br></div>I'm using python wrapped version of RTK.<br><div><br></div><div>I used the only example of that for reconstruction.It works perfectly.</div><span style="color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif;font-size:13px">The problem is that I need to simulate an artifact on projection 2D images, so first I got each 2D images of stack reiImage by <b>srtk.GetArrayFromImage(reiI<wbr>mage) </b>and
 then I applied a polynomial on that to simulate an artifact.NOW need to
 extract these artifacted-images again to the simpleRTK image to be able
 to reconstruct it at the end. I thought maybe <b>srtk.GetImageFromArray</b> w<wbr>orks, but it doesn't.<br></span><pre style="white-space:pre-wrap;font-family:"dejavu sans mono";font-size:11.3pt"><span class="gmail-im"><div style="color:rgb(0,0,0)"><div class="gmail-m_2514016107710297388gmail-im">rei.SetAxis(semiprincipalaxis)<br>rei.SetGeometry( geometry )<br>reiImage = rei.Execute(source)<br><br></div></div></span><span class="gmail-m_2514016107710297388gmail-im" style="color:rgb(0,0,0)">sampleList = []<br><span style="color:rgb(0,0,128);font-weight:bold">for </span>rcount <span style="color:rgb(0,0,128);font-weight:bold">in </span><span style="color:rgb(0,0,128)">range</span>(<span style="color:rgb(0,0,255)">0</span>,<span style="color:rgb(0,0,255)">127</span>):<br>    outputName = <span style="color:rgb(0,128,0);font-weight:bold">'/home/PycharmProjects/test/<wbr>Sample'</span>+ <span style="color:rgb(0,0,128)">str</span>(rcount)<br>    <span style="color:rgb(128,128,128);font-style:italic">#plt.imsave(outputName, srtk.GetArrayFromImage(reiImag<wbr>e [:,rcount,:]),  cmap='gray')<br></span><span style="color:rgb(128,128,128);font-style:italic">    </span>sampleList.append(srtk.GetArra<wbr>yFromImage(reiImage [:,rcount,:]))<br><br></span><font color="#000000">test = np.zeros(np.shape(sampleList[</font><span style="color:rgb(0,0,255)">0</span><font color="#000000"><wbr>]),</font><span style="color:rgb(102,0,153)">dtype</span><font color="#000000">=np.float32)<br><br>bhImages = []<br></font><span style="color:rgb(0,0,128);font-weight:bold">for </span><font color="#000000">reiImage1 </font><span style="color:rgb(0,0,128);font-weight:bold">in </span><font color="#000000">sampleList:</font><span class="gmail-m_2514016107710297388gmail-im" style="color:rgb(0,0,0)"><br>    <span style="color:rgb(128,128,128);font-style:italic">#img = plt.imread('/home/PycharmProje<wbr>cts/reiOutput/Sample%d'%k)<br></span></span><span style="color:rgb(128,128,128);font-style:italic">    #modifiedImg = sampleList[k]<br></span><span style="color:rgb(128,128,128);font-style:italic">    </span><font color="#000000">artifactedreiImg= np.zeros(np.shape(reiImage1),</font><span style="color:rgb(102,0,153)">d<wbr>type</span><font color="#000000">=np.float32)<br>    </font><span style="color:rgb(0,0,128);font-weight:bold">for </span><font color="#000000">i </font><span style="color:rgb(0,0,128);font-weight:bold">in </span><span style="color:rgb(0,0,128)">range </span><font color="#000000">(reiImage1.shape[</font><span style="color:rgb(0,0,255)">0</span><font color="#000000">]):<br>        </font><span style="color:rgb(0,0,128);font-weight:bold">for </span><font color="#000000">j </font><span style="color:rgb(0,0,128);font-weight:bold">in </span><span style="color:rgb(0,0,128)">range </span><font color="#000000">(reiImage1.shape[</font><span style="color:rgb(0,0,255)">1</span><font color="#000000">]):<br>            a = reiImage1[i, j]<br>            b = (</font><span style="color:rgb(0,0,255)">0.00000000018308 </span><font color="#000000">* </font><span style="color:rgb(0,0,128)">pow</span><font color="#000000">(a, </font><span style="color:rgb(0,0,255)">4</span><font color="#000000">)) - (</font><span style="color:rgb(0,0,255)">0.000000117480729 </span><font color="#000000">* </font><span style="color:rgb(0,0,128)">pow</span><font color="#000000">(a, </font><span style="color:rgb(0,0,255)">3</span><font color="#000000">)) + (</font><span style="color:rgb(0,0,255)">0.00001747041637 </span><font color="#000000">* </font><span style="color:rgb(0,0,128)">pow</span><font color="#000000">(a, </font><span style="color:rgb(0,0,255)">2</span><font color="#000000">)) + </font><span style="color:rgb(0,0,255)">1.000021291118193 </span><font color="#000000">* a<br>       </font><span style="color:rgb(128,128,128);font-style:italic"><br></span><span style="color:rgb(128,128,128);font-style:italic">            </span><font color="#000000">artifactedreiImg[i, j] = b<br><br>    artifactedreiImg = artifactedreiImg.astype(np.flo<wbr>at32)</font><span class="gmail-m_2514016107710297388gmail-im" style="color:rgb(0,0,0)"><br>   </span><span style="color:rgb(128,128,128);font-style:italic"><br></span><span style="color:rgb(128,128,128);font-style:italic">    </span><font color="#000000">bhImages.append(artifactedreiI<wbr>mg.astype(np.float32))</font><span class="gmail-m_2514016107710297388gmail-im" style="color:rgb(0,0,0)"><br>    <span style="color:rgb(128,128,128);font-style:italic">#plt.imsave(outputName, artifactedreiImg, cmap='gray')<br></span></span><font color="#000000"><br></font><b style="background-color:rgb(255,255,255)"><font color="#ff0000"><span style="font-style:italic">for i,artifactedImage in enumerate(bhImages): <br></span><span style="font-style:italic">bhImage[:,i,:]= srtk.GetImageFromArray(<wbr>artifactedImage[:,:])</span></font></b></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:11.3pt">in last lines I tried to get the stack of artifacted images like reiImage and then paste bhImage instead of reiImage for the reconstruction part. But I got this eror message:TypeError: 'tuple' object does not support item assignment<br><br>First I tried to change the reiImage but it seems its unwritable.</pre><div class="gmail_extra">Best regards,</div><div class="gmail_extra">Sareh Borhani</div></div>