Hi,<div><br></div><div>   I do not quite understand your question. I think you want to know how to compute the tracker points after registration </div><div>using TPS. If this is your question, I think you have already solved it with this line of your code.</div>
<div><br><br><div>  TPSTransformType::OutputPointType trackerPointNewPosition;</div><div>  trackerPointNewPosition = tps-&gt;TransformPoint(trackerPoint);</div><div>  std::cout&lt;&lt;&quot;trackerPointNewPosition: &quot; &lt;&lt;trackerPointNewPosition&lt;&lt;std::endl;</div>
<div><br></div><div> You can create a new PointSetType object to keep your tracker points after TPS transform.</div><div>If this is not your question, could you make your question a little clearer and maybe more specific?</div>
<div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Ja </div><br><br><div class="gmail_quote">On Sat, Aug 11, 2012 at 7:05 AM, agatte <span dir="ltr">&lt;<a href="mailto:wiatrak11@poczta.onet.pl" target="_blank">wiatrak11@poczta.onet.pl</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi,<br>
<br>
I have a question about TPS transformation in ITK.<br>
I have set of  5 sources and target points(landmarks).<br>
I want to compute TPS transformation.<br>
I  used ThinPlateSpline example for it.<br>
I want to compute new positions of point after transformation.<br>
What I can compute new position of each landmark after transformation ?<br>
I would be appreciate for any help please.<br>
<br>
Here I attach code :<br>
<br>
int main()<br>
{<br>
<br>
        double tab[30] =<br>
        {<br>
         // sources landmarks from tracker<br>
        -81.29,-31.07,  -770.58,<br>
    -83.11,     -21.26, -822.64,<br>
    -93.45,     -32.44, -858.72,<br>
    -68.08,     -126.89,-813.07,<br>
    -61.04,     75.74,  -808.36,<br>
<br>
         //  target landmarks from image - dicom<br>
    140.6,      230.7,  -30.5,<br>
    140.2,      231.7,  -71.1,<br>
    144.8,      235.9,  -116.1,<br>
    45.8,       220.2,  -66.7,<br>
    231.6,      211.3,  -66.1<br>
<br>
        };<br>
<br>
<br>
  const     unsigned int   Dimension = 3;<br>
  typedef   unsigned char  PixelType;<br>
  typedef   double CoordinateRepType;<br>
  typedef   itk::ThinPlateSplineKernelTransform&lt;<br>
CoordinateRepType,Dimension&gt;     TPSTransformType;<br>
  typedef   itk::Point&lt; CoordinateRepType,Dimension &gt;  PointType;<br>
  typedef   std::vector&lt; PointType &gt;                   PointArrayType;<br>
  typedef   TPSTransformType::PointSetType      PointSetType;<br>
  typedef   PointSetType::Pointer            PointSetPointer;<br>
  typedef   PointSetType::PointIdentifier  PointIdType;<br>
<br>
<br>
<br>
<br>
  // Landmarks correspondances may be associated with the<br>
SplineKernelTransforms<br>
  // via Point Set containers. Let us define containers for the landmarks.<br>
  PointSetType::Pointer sourceLandMarks = PointSetType::New();<br>
  PointSetType::Pointer targetLandMarks = PointSetType::New();<br>
  PointType trackerPoint;     PointType imagePoint;<br>
  PointSetType::PointsContainer::Pointer sourceLandMarkContainer =<br>
                                   sourceLandMarks-&gt;GetPoints();<br>
  PointSetType::PointsContainer::Pointer targetLandMarkContainer =<br>
                                   targetLandMarks-&gt;GetPoints();<br>
<br>
<br>
<br>
<br>
  // 1 Landmark<br>
  trackerPoint[0] = tab[0];<br>
  trackerPoint[1] = tab[1];<br>
  trackerPoint[2] = tab[2];<br>
  imagePoint[0] = tab[15];<br>
  imagePoint[1] = tab[16];<br>
  imagePoint[2] = tab[17];<br>
  sourceLandMarkContainer-&gt;InsertElement( 0,trackerPoint);<br>
  targetLandMarkContainer-&gt;InsertElement(0,imagePoint);<br>
<br>
  // 2 Landmark<br>
  trackerPoint[0] = tab[3];<br>
  trackerPoint[1] = tab[4];<br>
  trackerPoint[2] = tab[5];<br>
  imagePoint[0] = tab[18];<br>
  imagePoint[1] = tab[19];<br>
  imagePoint[2] = tab[20];<br>
  sourceLandMarkContainer-&gt;InsertElement(1,trackerPoint);<br>
  targetLandMarkContainer-&gt;InsertElement(1,imagePoint);<br>
<br>
  // 3 Landmark<br>
  trackerPoint[0] = tab[6];<br>
  trackerPoint[1] = tab[7];<br>
  trackerPoint[2] = tab[8];<br>
  imagePoint[0] = tab[21];<br>
  imagePoint[1] = tab[22];<br>
  imagePoint[2] = tab[23];<br>
  sourceLandMarkContainer-&gt;InsertElement( 2,trackerPoint);<br>
  targetLandMarkContainer-&gt;InsertElement(2,imagePoint);<br>
<br>
  // 4 Landmark<br>
  trackerPoint[0] = tab[9];<br>
  trackerPoint[1] = tab[10];<br>
  trackerPoint[2] = tab[11];<br>
  imagePoint[0] = tab[24];<br>
  imagePoint[1] = tab[25];<br>
  imagePoint[2] = tab[26];<br>
  sourceLandMarkContainer-&gt;InsertElement( 3,trackerPoint);<br>
  targetLandMarkContainer-&gt;InsertElement(3,imagePoint);<br>
<br>
  // 5 Landmark<br>
  trackerPoint[0] = tab[12];<br>
  trackerPoint[1] = tab[13];<br>
  trackerPoint[2] = tab[14];<br>
  imagePoint[0] = tab[27];<br>
  imagePoint[1] = tab[28];<br>
  imagePoint[2] = tab[29];<br>
  sourceLandMarkContainer-&gt;InsertElement(4,trackerPoint);<br>
  targetLandMarkContainer-&gt;InsertElement(4,imagePoint);<br>
<br>
  TPSTransformType::Pointer tps = TPSTransformType::New();<br>
  tps-&gt;SetSourceLandmarks(sourceLandMarks);<br>
  tps-&gt;SetTargetLandmarks(targetLandMarks);<br>
  // ComputeMAtrix<br>
  tps-&gt;ComputeWMatrix();<br>
<br>
  TPSTransformType::OutputPointType trackerPointNewPosition;<br>
  trackerPointNewPosition = tps-&gt;TransformPoint(trackerPoint);<br>
  std::cout&lt;&lt;&quot;trackerPointNewPosition:<br>
&quot;&lt;&lt;trackerPointNewPosition&lt;&lt;std::endl;<br>
<br>
 // TPSTransformType::OutputVectorType pointsAfterTr;<br>
 // pointsAfterTr = tps-&gt;TransformVector(sourceLandMarks);<br>
<br>
<br>
  // save transformation<br>
  typedef itk::TransformFileWriter    TransformWriterType;<br>
  TransformWriterType::Pointer transformWriter = TransformWriterType::New();<br>
  transformWriter-&gt;AddTransform( tps);<br>
  transformWriter-&gt;SetInput(tps);<br>
  transformWriter-&gt;SetFileName(&quot;tps.txt&quot;);<br>
  transformWriter-&gt;Update();<br>
<br>
<br>
<br>
  return EXIT_SUCCESS;<br>
<br>
<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://old.nabble.com/TPS--compute-new-position-of-points--tp34285325p34285325.html" target="_blank">http://old.nabble.com/TPS--compute-new-position-of-points--tp34285325p34285325.html</a><br>

Sent from the ITK - Users mailing list archive at Nabble.com.<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>