Sorry to hear that, but as I said I no longer use that filter. I was recently investigating filter reuse (only natural with such a cumbersome declaration), when I came across this message: <a href="http://www.itk.org/pipermail/insight-users/2003-December/005972.html">http://www.itk.org/pipermail/insight-users/2003-December/005972.html</a>. It may not be directly connected with the problem you are having, but it does not hurt to know.<div>
<br></div><div>Regards,</div><div>Dženan<br><div><br><div class="gmail_quote">On Tue, Jul 27, 2010 at 14:37, <span dir="ltr"><<a href="mailto:J.Menssen@cukz.umcn.nl">J.Menssen@cukz.umcn.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="NL" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Dear Dzenan</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">As you proposed in your mail, we created an unnamed block and
created a new deform filter from scratch </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">We instantiate the filter and set all parameters</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">However, this modification results in the same error message as
described below</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">So our problem is not yet solved</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Thank you for your time, kind regards</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Jan Menssen </span></p><div class="im">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> Dženan Zukić [mailto:<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>] <br>
<b>Sent:</b> donderdag 22 juli 2010 14:56<br>
<b>To:</b> Menssen, Jan<br>
<b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>; Nillesen, Maartje<br>
<b>Subject:</b> Re: [Insight-users] bug in DeformableModelSimplexMesh ?</span></p>
</div>
<p class="MsoNormal"> </p>
</div><p class="MsoNormal">I discovered few weeks back, that you cannot just change
input mesh for deform filter, that is</p><div><div></div><div class="h5">
<div>
<p class="MsoNormal"><span><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->SetInput(m_SimplexMesh);</span></i></span></p>
</div>
<div>
<p class="MsoNormal">this line is a problem. The workaround I used was to create
unnamed block and create a new deform filter from scratch (instantiate filter
and set a bunch of parameters) instead of just setting setting input mesh and
calling update.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Regards,</p>
</div>
<div>
<p class="MsoNormal">Dženan</p>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">On Wed, Jul 21, 2010 at 11:37, <<a href="mailto:J.Menssen@cukz.umcn.nl" target="_blank">J.Menssen@cukz.umcn.nl</a>> wrote:</p>
<div>
<p><span lang="EN-US">Dear All</span></p>
<p><span lang="EN-US">We are working
on a segmentation algorithm using deformable models with a refine mesh. The
deformation and refinement is done in a for loop. Our application is
based on the DeformableModel application as given in the InsightApplications
example DeformableModelSimplexMesh.</span></p>
<p><span lang="EN-US">We modified the
for loop in de DeformMesh method (DeformableModelApplication.cxx) with a
refinement of the mesh, but this crashes. Below a part of (pseudo) code is
given.. </span></p>
<p><i><span lang="EN-US">
for i=1:i<nr_iterations;i++</span></i></p>
<p><i><span lang="EN-US">
{</span></i></p>
<p><i><span lang="EN-US">
m_simplexMesh->DisconnectPipeline()</span></i></p>
<p><i><span lang="EN-US">
m_deformFilter-SetInput(m_simplexMesh);</span></i></p>
<p><i><span lang="EN-US">
m_deformFilter->Update(0;</span></i></p>
<p><i><span lang="EN-US">
simplexMesh2 = m_deformFilter->GetOutput();</span></i></p>
<p><i><span lang="EN-US">
</span></i></p>
<p><i><span lang="EN-US">
m_refineMesh->SetInput(simplexMesh2);</span></i></p>
<p><i><span lang="EN-US">
m_refineMesh->Update();</span></i></p>
<p><i><span lang="EN-US">
m_simplexMesh=m_refineMesh->GetOutput();</span></i></p>
<p><i><span lang="EN-US"> }</span></i></p>
<p><span lang="EN-US">m_deformFilter
is a</span><span lang="EN-US"> </span><span>DeformableSimplexMesh3DGradientConstraintForceFilter,</span>
</p>
<p><span>m_RefineMesh is a
itkSimplexMeshAdaptTopologyFilter</span></p>
<p><span lang="EN-US"> <i> </i></span></p>
<p><span lang="EN-US">To isolate the
bug, we started with a little modification of the DeformMesh method in
DeformableModelApplication.cxx. The modifications are given below (line 522 in
original file, InsightApplciations 3.16). Running this code results also in a
crash</span></p>
<p><span lang="EN-US">*----------------------------------------------------------------------------------------------------------------------------------------</span></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">SimplexMeshType::Pointer
simplexMesh2 = m_SimplexMesh;</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">const</span>
</i><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">unsigned</span>
</i><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">int</span></i><i><span style="font-size:7.5pt;font-family:"Courier New""> numberOfIterationsToGo =
atoi(m_IterationsValueInput->value()); </span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">for</span></i><i><span style="font-size:7.5pt;font-family:"Courier New"">(</span> </i><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">unsigned</span> </i><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">int</span></i><i><span style="font-size:7.5pt;font-family:"Courier New""> i=0;
i<numberOfIterationsToGo; i++ )</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">{</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
std::cout <<</span> </i><i><span style="font-size:7.5pt;font-family:"Courier New";color:#A31515">" Iteration "</span></i><i><span style="font-size:7.5pt;font-family:"Courier New""> << i <<
std::endl;</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New";color:green">//*
-------------- start modified code -------------------------------------------</span></i></p>
<p><i> </i><i><span style="font-size:7.5pt;font-family:"Courier New";color:green">// THIS IS MODIFIED CODE THAT (WE
THINK) DOESN'T VIOLATE THE ITK RULES BUT THIS</span></i></p>
<p><i> </i><i><span style="font-size:7.5pt;font-family:"Courier New";color:green">// CODE CRASHES</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_SimplexMesh->DisconnectPipeline();</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->SetInput(m_SimplexMesh);</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->SetIterations(1);</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->Update();</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">simplexMesh2 = m_DeformFilter->GetOutput();</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">SimplexMesh2->DisconnectPipeline(0</span></i></p>
<p style="margin-left:108.0pt"><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->SetInput(simplexMesh2);</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->SetIterations(1);</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_DeformFilter->Update();</span></i></p>
<p><i>
</i><i><span style="font-size:7.5pt;font-family:"Courier New"">m_SimplexMesh = m_DeformFilter->GetOutput();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New";color:green">//
--------------------- end modified code --------------------------------------
*/</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
m_SimplexMeshToShow = m_SimplexMesh;</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New""> </span>
</i><i><span style="font-size:7.5pt;font-family:"Courier New";color:blue">this</span></i><i><span style="font-size:7.5pt;font-family:"Courier New"">->RefreshMeshVisualization();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New""> </span>
</i><i><span style="font-size:7.5pt;font-family:"Courier New";color:green">//
force a redraw</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
axialView->redraw();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
coronalView->redraw();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
sagittalView->redraw();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
surfaceView->redraw();</span></i></p>
<p><i><span style="font-size:7.5pt;font-family:"Courier New"">
Fl::check(); </span></i></p>
<p><i><span style="font-size:10.0pt;font-family:"Courier New""> }</span></i></p>
<p><span lang="EN-US">*-------------------------------------------------------------------------------------------------------------------------------------------</span></p>
<p><span lang="EN-US">Error message
(using Visual Studio 2005 and/or 2008) of the crash</span></p>
<p><span lang="EN-US">Debug Assertion
Failed !</span></p>
<p><span lang="EN-US"> </span><span lang="EN-US">Expression map/set iterator
not dereferencable </span></p>
<p><span lang="EN-US">Do we something
wrong? Using a for loop in a pipeline is dangerous but in bug 0001080, we
read it’s possible to use a for loop. Also at the Old Nabble forum I read
a message that is must be possible to use a for loop. (</span><a href="http://old.nabble.com/Using-image-iterators-combined-with-filters-in-a-loop-td28684443.html" target="_blank"><span lang="EN-US">http://old.nabble.com/Using-image-iterators-combined-with-filters-in-a-loop-td28684443.html</span></a><span lang="EN-US">)</span></p>
<p><span lang="EN-US">Even if we
changed the code in the original example DeformableModelApplication according
to the above referenced Old Nabble article the application crashes (see
below)</span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New"">
</span></p>
<p><i><span style="font-size:10.0pt;font-family:"Courier New"">m_DeformFilter->SetInput(
m_SimplexMesh );</span></i></p>
<p><i><span style="font-size:10.0pt;font-family:"Courier New""> </span>
</i><i><span style="font-size:10.0pt;font-family:"Courier New"">m_DeformFilter->SetIterations(1);
</span></i></p>
<p><i><span style="font-size:10.0pt;font-family:"Courier New"">
m_DeformFilter->Update();</span></i></p>
<p><i><span style="font-size:10.0pt;font-family:"Courier New""> </span>
</i><i><span style="font-size:10.0pt;font-family:"Courier New"">m_SimplexMesh
= m_DeformFilter->GetOutput(); </span></i></p>
<p><i> </i><i><span style="font-size:10.0pt;font-family:"Courier New"">m_SimplexMesh->DisconnectPipeline();</span></i></p>
<p><span lang="EN-US">So is there a
bug in the original ITK sources? As far as we now, ITK doesn’t allow to change
the input of a filter and we think this is what happened in the original
DeformableSimplexMesh application.</span></p>
<p><span lang="EN-US">Can someone help
us with our problem ?</span></p>
<p><span lang="EN-US">We tested with
ITK 2.8, ITK 3.16 and 3.18 and all crashes</span></p>
<p><b> </b><b><span style="font-size:10.0pt;font-family:"Univers","serif";color:#215868">Jan Menssen</span><br>
</b><i><span style="font-size:10.0pt;font-family:"Univers","serif";color:#444444">Research
assistant</span></i></p>
<p><b><span style="font-size:7.5pt;font-family:"Univers","serif";color:#215868">Radboud
University Nijmegen Medical Centre</span></b><br>
<b><span style="font-size:7.5pt;font-family:"Univers","serif";color:#444444">Clinical
Physics Lab -</span></b> <span style="font-size:7.5pt;font-family:"Univers","serif";color:#444444">Peadiatrics</span><br>
<span style="font-size:7.5pt;font-family:"Univers","serif";color:#444444">Huispost
833, route 833<br>
P.O box 9101<br>
6500 HB Nijmegen<br>
Telefoon: +31 24 36 19063<br>
E-mail</span> <a href="mailto:J.Menssen@cukz.umcn.nl" target="_blank"><span style="font-size:7.5pt;font-family:"Univers","serif"">J.Menssen@cukz.umcn.nl</span></a><span style="font-size:7.5pt;font-family:"Univers","serif";color:#444444"> </span></p>
<p><a href="http://www.umcn.nl/" target="_blank"><span style="font-size:7.5pt;font-family:"Univers","serif"">http://www.umcn.nl</span></a></p>
<p class="MsoNormal"><br clear="all">
</p>
<div>
<p><span style="font-size:10.0pt">Het UMC St
Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister
onder nummer 41055629.<br>
The Radboud University Nijmegen Medical Centre is listed in the Commercial
Register of the Chamber of Commerce under file number 41055629.</span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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.html" target="_blank">http://www.kitware.com/products/protraining.html</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></p>
</div>
<p class="MsoNormal"> </p>
</div>
</div></div></div><div><div></div><div class="h5">
<br clear="all">
        <div>
        <p style="font-size:13px;font-family:arial">
        
        Het UMC St Radboud staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 41055629.<br> The Radboud University Nijmegen Medical Centre is listed in the Commercial Register of the Chamber of Commerce under file number 41055629.<br>
        </p>
        </div>
</div></div></div>
</blockquote></div><br></div></div>