<div dir="ltr"><div>Hi,<br><br></div><div>I am using a filter to process an image in an iterative process, so my code looks like this<br><br>------------------------------------------------------------------------------------------------------------------------<br>
<br><pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span>FilterType<span style="color:rgb(0,0,0)">::</span>Pointer<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(192,192,192)"></span>FilterType<span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">::</span>New<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>SetSigma<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1.5</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)"></span>SetField<span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">reader1-></span>GetOutput<span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)"></span>SetCertainty<span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">reader2</span><span style="color:rgb(0,0,0)">-></span>GetOutput<span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>


<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">2</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">++</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">try</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>Update<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">catch</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ExceptionObject</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span>exc<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>cerr<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"Exception</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">caught!"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>endl<span style="color:rgb(0,0,0)">;</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>cerr<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span>exc<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>endl<span style="color:rgb(0,0,0)">;</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">-</span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">;</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span>VectorFieldType<span style="color:rgb(0,0,0)">::</span>Pointer<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">tempField</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>GetOutputField<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span>ImageType<span style="color:rgb(0,0,0)">::</span>Pointer<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">tempCert</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>GetOutputCertainty<span style="color:rgb(0,0,0)">();</span></pre>


<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">tempField</span><span style="color:rgb(0,0,0)">-></span>DisconnectPipeline<span style="color:rgb(0,0,0)">();</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">tempCert</span><span style="color:rgb(0,0,0)">-></span>DisconnectPipeline<span style="color:rgb(0,0,0)">();</span></pre>


<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>SetField<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">tempField</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)">filter</span><span style="color:rgb(192,192,192)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)"></span><span style="color:rgb(0,0,0)">-></span>SetCertainty<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">tempCert</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre><br>------------------------------------------------------------------------------------------------------------------------<br>
<br><br></div><div>when I run it I get the exception after the update in the second iteration<br><br>---------------------------------------------------------------------------------------------------------------------------------<br>
itk::ExceptionObject (0000000000A1EF70)<br>Location: "void __cdecl itk::Image<class itk::Vector<float,3>,3>::Graft(const class itk::DataObject *)"<br>File: d:\itk4.5\insighttoolkit-4.5.0\modules\core\common\include\itkImage.hxx<br>
Line: 138<br>Description: itk::ERROR: Image(00000000033EC890): itk::Image::Graft() cannot cast class itk::DataObject const * __ptr64 to class itk::Image<class itk::Vector<fl<br>oat,3>,3> const * __ptr64<br><br>
----------------------------------------------------------------------------------------------------------------------------------<br></div><div><br>anybody has ideas of what is it about?<br><br></div><div>I will extract an example code that reproduces the problem.<br>
<br></div><div>Thank you very much<br></div><div><br></div><div><div><div><div dir="ltr">Nicolás Gallego-Ortiz<br>UniversitĂ© catholique de Louvain, Belgium<br></div></div>
</div></div></div>