<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>I am trying to wrap some functionality into a class. I am trying to write a function that reads in a transform file, however, I want it to take the list of transform pointers that it reads in and merge/insert them into an already existing list. Here is
the relevant code with more details below it:</div>
<div><br>
</div>
<div>
<div>#include "itkTransform.h"</div>
<div>#include "itkTransformFileReader.h"</div>
</div>
<div><br>
</div>
<div>public:</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>typedef itk::TransformFileReaderTemplate< double ><span class="Apple-tab-span" style="white-space:pre">
</span>TransformReaderType;<span class="Apple-tab-span" style="white-space:pre"> </span>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>typedef TransformReaderType::TransformListType<span class="Apple-tab-span" style="white-space:pre">
</span>TransformListType;</div>
</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>void ReadTransformFile( const char * transformFilename );</div>
<div><br>
</div>
<div>protected:</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>LandmarkAnalysis()</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;">TransformListType * m_TransformList = 0;</span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformListType * m_TransformListTemporary = 0;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
</div>
<div><br>
</div>
<div>private:</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformListType * m_TransformList;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformListType * m_TransformListTemporary;</div>
<div>};</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>.hxx file</div>
<div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>void LandmarkAnalysis::ReadTransformFile( const char * transformFilename )</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformReaderType::Pointer reader = TransformReaderType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>reader->SetFileName( transformFilename );</div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">reader->Update();</span></div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// put output into member variable</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>m_TransformListTemporary = reader->GetTransformList();</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>//(*m_TransformList).merge( *m_TransformListTemporary );</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// print out to prove that it was completed<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>TransformListType::const_iterator tempIt = m_TransformListTemporary->begin();</div>
<div><span class="Apple-tab-span" style="font-size: 10pt; white-space: pre;"></span><span style="font-size: 10pt;">TransformListType::iterator it = m_TransformList->begin(); ***CODE BREAKS AT THIS LINE***</span></div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>for(; tempIt !=m_TransformListTemporary->end(); tempIt++)</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::cout << (*tempIt) << std::endl;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>(*m_TransformList).insert(it, (*tempIt));</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>std::cout << transformFilename << " has been read in." << 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>return;</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
</div>
<div><br>
</div>
<div>Here is my problem: I know that at the base level both m_TransformListTemporary and m_TransformList are lists of transform pointers. However, I cannot use any of the c++ stl list member functions such as merge or insert (I get runtime errors.) Is there
some fundamental concept that I do not understand with how ITK interacts with the STL? In addition, through debugging, the line shown above instantiating an iterator for m_TransformList breaks the code, even though the previous line (which, to my understanding,
does the same thing, but with a different list) works fine. </div>
<div><br>
</div>
<div>Any help would be very much appreciated.</div>
<div><br>
</div>
<div>Emily Hammond</div>
</div>
</body>
</html>