<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0" class=" hasGoogleVoiceExt">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello all,
<div><br>
</div>
<div>Here is the flow of my program.</div>
<div><br>
</div>
<div>1. read in fiducial points noted with Slicer (to my understanding to get from Slicer to ITK, invert the first two coordinates)</div>
<div>2. read in transform from files with TransformFileReaderTemplate class. This reads in the transforms as a list and I can add multiple transforms to the list.</div>
<div>3. apply the transforms in the list (in order) to the fiducials using the TransformPoint method for each transform. Here is the code I am using to apply the transforms.</div>
<div><br>
</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// create iterator to parse through the transform list</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformListType::const_iterator itTrans = this->m_TransformList.begin();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for(; itTrans != this->m_TransformList.end(); itTrans++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// determine what type of transform it is</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>if( !strcmp( (*itTrans)->GetNameOfClass(), "AffineTransform" ) )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// extract transform</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>AffineTransformType::Pointer affineTrans = static_cast< AffineTransformType * >( (*itTrans).GetPointer() );</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// apply to landmarks</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>LandmarksType::const_iterator itLM = this->m_TransformedMovingLandmarks.begin();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for(; itLM != this->m_TransformedMovingLandmarks.end(); itLM++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">this->m_TransformedMovingLandmarks[ itLM->first ] = affineTrans->TransformPoint( itLM->second );</span></div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">}</span></div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">}</span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>else if( !strcmp( (*itTrans)->GetNameOfClass(), "BSplineTransform" ) )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// extract transforms</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>BSplineTransformType::Pointer bsplineTrans = static_cast< BSplineTransformType * >( (*itTrans).GetPointer() );</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// apply to landmarks</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>LandmarksType::const_iterator itLM = this->m_TransformedMovingLandmarks.begin();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for(; itLM != this->m_TransformedMovingLandmarks.end(); itLM++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">this->m_TransformedMovingLandmarks[ itLM->first ] = bsplineTrans->TransformPoint( itLM->second );</span></div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">}</span></div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">}</span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>else</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>std::cerr << "TransformType is not recognized." << std::endl;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
</div>
<div><br>
</div>
<div><span style="font-size: 13.3333330154419px;">NOTE: m_TransformedMovingList is initialized to the original read in fiducial list</span></div>
<div><br>
</div>
<div>4. read out the transform fiducials (invert first two coordinates for observation in Slicer purposes)</div>
<div>5. Compare the results using Slicer</div>
<div><br>
</div>
<div>Problem: This method works just fine with scaling and translation transforms (given the last coordinate is inverted instead of the first two -> first question), however, once rotation (and shearing) is applied the result is wrong. Can anyone give some
insight? I'm assuming there is some coordinate system conversion that needs to take place on the transform.</div>
<div><br>
</div>
<div>Thanks!</div>
<div>Emily Hammond</div>
</div>
</body>
</html>