Hi Agata, <br><br>Please find attached the working code.<br><br>Here is the hierarchy that you may want to keep in mind:<br><br><ul><li>One TPS transform has two PointSets</li><li>One PointSet has a PointContainer</li><li>
One PointContainer have PointIterators (const and non-const)</li></ul><br>You can get points from a PointSet by using GetPointid)<br><br>    PointType  point = pointSet-&gt;GetPoint( pointId );<br><br>or you can get them from the PointContainer by using GetElement(id)<br>
<br>    PointType  point = pointContainer-&gt;GetElement( pointId );<br>
<br>or you can get them via Iterators from the PointContainer<br><br>    PointConstIterator pointItr = pointContainer-&gt;Begin();<br>    PointType  point = pointItr.Value();<br>   
++pointItr;<br>   ...etc...<br><br>Note that you shouldn&#39;t use &quot;int&quot; or &quot;short&quot; or &quot;long&quot; for the <br>PointId type. One must use PointIdType (which is typedefed<br>from the ElementIdentifier type), this is very important if you<br>
are working on 64 bits.<br><br><br>The attached code shows you both ways of doing this <br>at the end of the file.<br><br>The key lines of code are:<br><br><br><span style="font-family:courier new,monospace">  TPSTransformType::InputPointType  trackerPointSourcePosition;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">  TPSTransformType::OutputPointType trackerPointNewPosition;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Test transforming the input landmark themselves</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">  for( PointIdType i = 0; i &lt; sourceLandMarks-&gt;GetNumberOfPoints(); i++ )</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    trackerPointSourcePosition = sourceLandMarks-&gt;GetPoint(i);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    trackerPointNewPosition = tps-&gt;TransformPoint(trackerPointSourcePosition);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    transformed_points_container-&gt;InsertElement(i,trackerPointNewPosition);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;Input &quot; &lt;&lt; trackerPointSourcePosition &lt;&lt; &quot; : &quot;;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;Output &quot; &lt;&lt; trackerPointNewPosition &lt;&lt; std::endl;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">
<br><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  // Do the same using Iterators</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  std::cout &lt;&lt; std::endl &lt;&lt; &quot;Now using Iterators &quot; &lt;&lt; std::endl;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  PointConstIterator inputPointItr = sourceLandMarkContainer-&gt;Begin();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  PointConstIterator inputPointEnd = sourceLandMarkContainer-&gt;End();</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">  PointIdType pointId = itk::NumericTraits&lt; PointIdType &gt;::Zero;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">  while( inputPointItr != inputPointEnd )</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    trackerPointNewPosition = tps-&gt;TransformPoint(inputPointItr.Value());</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    transformed_points_container-&gt;InsertElement(pointId,trackerPointNewPosition);</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;Input &quot; &lt;&lt; inputPointItr.Value() &lt;&lt; &quot; : &quot;;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    std::cout &lt;&lt; &quot;Output &quot; &lt;&lt; trackerPointNewPosition &lt;&lt; std::endl;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">    ++inputPointItr;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">
<br><br><br><br><br> Hope this helps,<br><br>      Luis<br><br><br>------------------------------------------------------------<br><div class="gmail_quote">On Sat, Aug 18, 2012 at 12:17 PM, Agata Krasoń <span dir="ltr">&lt;<a href="mailto:agatakrason@gmail.com" target="_blank">agatakrason@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Luis,<div><br></div><div>I am trying to use tps transformation in ITK.</div><div>...</div><div>I created sources and target points.</div>
<div>I made Tps transformation.</div>

<div>I need to receive points after registration</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>...</div></blockquote><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I have a problem with iterators.</div><div>I would appreciate for any help please. </div>

<div><br></div><div><div>int main(int argc, char* argv[])</div><div>{</div><div><br></div><div><span style="white-space:pre-wrap">        </span>double tab[30] = </div><div><span style="white-space:pre-wrap">        </span>{</div>
<div><span style="white-space:pre-wrap">        </span> // Tracker</div><div><span style="white-space:pre-wrap">        </span>-81.29,-31.07,<span style="white-space:pre-wrap">        </span>-770.58, </div>
<div>    -83.11,<span style="white-space:pre-wrap">        </span>-21.26,<span style="white-space:pre-wrap">        </span>-822.64,</div><div>    -93.45,<span style="white-space:pre-wrap">        </span>-32.44,<span style="white-space:pre-wrap">        </span>-858.72,</div>

<div>    -68.08,<span style="white-space:pre-wrap">        </span>-126.89,-813.07,</div><div>    -61.04,<span style="white-space:pre-wrap">        </span>75.74,<span style="white-space:pre-wrap">        </span>-808.36,</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span> // Image</div><div>    140.6,<span style="white-space:pre-wrap">        </span>230.7,<span style="white-space:pre-wrap">        </span>-30.5,</div>
<div>    140.2,<span style="white-space:pre-wrap">        </span>231.7,<span style="white-space:pre-wrap">        </span>-71.1,</div><div>    144.8,<span style="white-space:pre-wrap">        </span>235.9,<span style="white-space:pre-wrap">        </span>-116.1,</div>

<div>    45.8,<span style="white-space:pre-wrap">        </span>220.2,<span style="white-space:pre-wrap">        </span>-66.7,</div><div>    231.6,<span style="white-space:pre-wrap">        </span>211.3,<span style="white-space:pre-wrap">        </span>-66.1</div>

<div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>};</div><div><span style="white-space:pre-wrap">        </span></div><div>
<br></div><div>  const     unsigned int   Dimension = 3;</div><div>  typedef   unsigned char  PixelType;</div><div>  typedef   double CoordinateRepType;</div><div>  typedef   itk::ThinPlateSplineKernelTransform&lt; CoordinateRepType,Dimension&gt;     TPSTransformType;</div>

<div>  typedef   itk::Point&lt; CoordinateRepType,Dimension &gt;  PointType;</div><div>  typedef   std::vector&lt; PointType &gt;                   PointArrayType;</div><div>  typedef   TPSTransformType::PointSetType      PointSetType;</div>

<div>  typedef   PointSetType::Pointer            PointSetPointer;</div><div>  typedef   PointSetType::PointIdentifier  PointIdType;</div><div><br></div><div><br></div><div>  // Landmarks correspondances may be associated with the SplineKernelTransforms</div>

<div>  // via Point Set containers. Let us define containers for the landmarks.</div><div>  PointSetType::Pointer sourceLandMarks = PointSetType::New();</div><div>  PointSetType::Pointer targetLandMarks = PointSetType::New();</div>

<div>  PointType trackerPoint;     PointType imagePoint;</div><div>  PointSetType::PointsContainer::Pointer sourceLandMarkContainer = </div><div>                                   sourceLandMarks-&gt;GetPoints();</div><div>

  PointSetType::PointsContainer::Pointer targetLandMarkContainer = </div><div>                                   targetLandMarks-&gt;GetPoints();</div><div> </div><div><br></div><div>  // 1 Landmark</div>
<div>  trackerPoint[0] = tab[0];</div><div>  trackerPoint[1] = tab[1];</div><div>  trackerPoint[2] = tab[2];</div><div>  imagePoint[0] = tab[15];</div><div>  imagePoint[1] = tab[16];</div><div>  imagePoint[2] = tab[17];</div>

<div>  sourceLandMarkContainer-&gt;InsertElement( 0,trackerPoint);</div><div>  targetLandMarkContainer-&gt;InsertElement(0,imagePoint);</div><div><br></div><div> </div><div>  // 2 Landmark</div><div>  trackerPoint[0] = tab[3];</div>

<div>  trackerPoint[1] = tab[4];</div><div>  trackerPoint[2] = tab[5];</div><div>  imagePoint[0] = tab[18];</div><div>  imagePoint[1] = tab[19];</div><div>  imagePoint[2] = tab[20];</div><div>  sourceLandMarkContainer-&gt;InsertElement(1,trackerPoint);</div>

<div>  targetLandMarkContainer-&gt;InsertElement(1,imagePoint);</div><div> </div><div>  // 3 Landmark</div><div>  trackerPoint[0] = tab[6];</div><div>  trackerPoint[1] = tab[7];</div><div>  trackerPoint[2] = tab[8];</div>

<div>  imagePoint[0] = tab[21];</div><div>  imagePoint[1] = tab[22];</div><div>  imagePoint[2] = tab[23];</div><div>  sourceLandMarkContainer-&gt;InsertElement( 2,trackerPoint);</div><div>  targetLandMarkContainer-&gt;InsertElement(2,imagePoint);</div>

<div> </div><div>  // 4 Landmark</div><div>  trackerPoint[0] = tab[9];</div><div>  trackerPoint[1] = tab[10];</div><div>  trackerPoint[2] = tab[11];</div><div>  imagePoint[0] = tab[24];</div><div>  imagePoint[1] = tab[25];</div>

<div>  imagePoint[2] = tab[26];</div><div>  sourceLandMarkContainer-&gt;InsertElement( 3,trackerPoint);</div><div>  targetLandMarkContainer-&gt;InsertElement(3,imagePoint);</div><div><br></div><div>  // 5 Landmark</div><div>

  trackerPoint[0] = tab[12];</div><div>  trackerPoint[1] = tab[13];</div><div>  trackerPoint[2] = tab[14];</div><div>  imagePoint[0] = tab[27];</div><div>  imagePoint[1] = tab[28];</div><div>  imagePoint[2] = tab[29];</div>

<div><br></div><div>  sourceLandMarkContainer-&gt;InsertElement(4,trackerPoint);</div><div>  targetLandMarkContainer-&gt;InsertElement(4,imagePoint);</div><div><br></div><div>  TPSTransformType::Pointer tps = TPSTransformType::New();</div>

<div>  tps-&gt;SetSourceLandmarks(sourceLandMarks);</div><div>  tps-&gt;SetTargetLandmarks(targetLandMarks);</div><div>  tps-&gt;ComputeWMatrix();</div><div> </div><div><br></div><div>    PointSetType::Pointer transformed_points = PointSetType::New();</div>

<div>  PointSetType::PointsContainer::Pointer transformed_points_container = transformed_points-&gt;GetPoints();    </div><div>  TPSTransformType::OutputPointType trackerPointNewPosition;</div><div><br></div><div><font color="#ff0000">  for( int i = 0; i &lt; sourceLandMarks-&gt;GetNumberOfPoints(); i++){</font></div>

<div><font color="#ff0000"><span style="white-space:pre-wrap">        </span> PointSetType      src_pnt = sourceLandMarks-&gt;GetPoints();  // Here It doesn&#39;t compile  ?</font></div><div><font color="#ff0000">    trackerPointNewPosition = tps-&gt;TransformPoint(trackerPoint);</font></div>

<div><font color="#ff0000">    transformed_points_container-&gt;InsertElement(i,trackerPointNewPosition); </font></div><div><font color="#ff0000"><span style="white-space:pre-wrap">        </span>std::cout&lt;&lt;&quot; &quot;&lt;&lt;trackerPointNewPosition &lt;&lt;std::endl;</font></div>

<div><font color="#ff0000">  }</font></div><div><br></div><div><br></div><div>  return EXIT_SUCCESS;</div><div><br></div><div><br></div><div>}</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>I would appreciate for any help please.</div>

<div><br></div><div>Best,</div><div>Agata </div>
</blockquote></div><br>