<div class="gmail_quote">Thanks for yout suggestion - thanks to Bill - solved now. I needed to compile ITKv4 again with flag ITKGroup_Bridge flag turned on. (Before than I was using ITKBasicFilters.lib from build of ITK 3.20, which is probably not compatible with new ITKv4)<br>

<br>Thanks!<br><br><div class="gmail_quote">2011/4/11 Garin, Alba <span dir="ltr">&lt;<a href="mailto:agarin@ceit.es" target="_blank">agarin@ceit.es</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div link="blue" vlink="purple" lang="ES"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hi ,</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal">

<span style="font-size:11.0pt;color:#1F497D" lang="EN-US">Are you sure that the reader does its function correctly? Because I use this filter in the same way as you do and I do not get any error. I would save the output of the reader in an image and set as input this image in order to separate both actions. Try it, look if you save the image properly and see if gives the error in the same place as before. Because maybe this filter executes the reader-&gt;getoutput when updating and not when setting the input. Don’t know.</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D" lang="EN-US">Hope it helps.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D" lang="EN-US"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D" lang="EN-US">Alba</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D" lang="EN-US"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D" lang="EN-US"> </span></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10.0pt" lang="EN-US">From:</span></b><span style="font-size:10.0pt" lang="EN-US"> <a href="mailto:insight-users-bounces@itk.org" target="_blank">insight-users-bounces@itk.org</a> [mailto:<a href="mailto:insight-users-bounces@itk.org" target="_blank">insight-users-bounces@itk.org</a>] <b>On Behalf Of </b>Bc. Michal Srna<br>

<b>Sent:</b> lunes, 11 de abril de 2011 17:32<br><b>To:</b> Bill Lorensen<br><b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>; <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>

<b>Subject:</b> Re: [Insight-users] [vtkusers] Trying to connect ITK - VTK - ITK</span></p></div><div><div></div><div><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-bottom:12.0pt">Did it, no error message at all (I use console application).<br>

<br>Here I marked, where the program crashes in file vtkImageImport.cxx, it&#39;s on line 7<br><br>1void vtkImageImport::InvokeExecuteInformationCallbacks()<br>2{<br>3  if (this-&gt;WholeExtentCallback)<br>4    {<br>5   tryCatchMacro(<br>

6      this-&gt;SetWholeExtent(<br>7        (this-&gt;WholeExtentCallback)(this-&gt;CallbackUserData)),<br>8      &quot;Calling WholeExtentCallback: &quot;);<br>9   }</p><div><p class="MsoNormal">2011/4/11 Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</p>

<p class="MsoNormal">Put a try/catch around the Update();</p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"> </p><div><p class="MsoNormal">On Mon, Apr 11, 2011 at 11:16 AM, Bc. Michal Srna &lt;<a href="mailto:michal@srna.info" target="_blank">michal@srna.info</a>&gt; wrote:</p>

<p class="MsoNormal">Tried, but didn&#39;t help. <br><br>I also tried to use simple example from <a href="http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf" target="_blank">http://www.itk.org/CourseWare/Training/GettingStarted-II.pdf</a> (slide 18) and tried just to connect simple readed 2D tiff image (via ITK) to the VTK pipeline via ImageToVTKImageFilter like this:<br>

<br>typedef itk::Image&lt;unsigned short,2&gt; ImageType;<br>typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br>typedef itk::ImageToVTKImageFilter&lt;ImageType&gt; ConnectorType;<br><br>ReaderType::Pointer reader= ReaderType::New();<br>

ConnectorType::Pointer connector= ConnectorType::New();<br><br>reader-&gt;SetFileName( argv[1]);<br>connector-&gt;SetInput( reader-&gt;GetOutput() );<br><br>connector-&gt; Update ();<br><br>Code runs, no compile errors and when running it crashes on the same spot in file vtkImageImport.cxx just when executing &quot;connector-&gt; Update ()&quot;. So the problem is somewhere where executing connection of ITK pipeline to the VTK pipeline.<br>

<br>Here is the report of crash:<br><br>First-chance exception at 0x01e1e219 in test.exe: 0xC0000005: Access violation reading location 0x00000000.<br>Unhandled exception at 0x01e1e219 in test.exe: 0xC0000005: Access violation reading location 0x00000000.<br>

The program &#39;[3968] test.exe: Native&#39; has exited with code 0 (0x0).</p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><br><br> </p><div><p class="MsoNormal">2011/4/11 Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</p>

<p class="MsoNormal">Try changing:</p><div><p class="MsoNormal"><br>  blend-&gt;SetInput(0,connector_ITK_to_VTK_alpha_data2-&gt;GetOutput());</p></div><div><p class="MsoNormal">to<br>  blend-&gt;SetInput(1,connector_ITK_to_VTK_alpha_data2-&gt;GetOutput());</p>

</div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"> </p><div><p class="MsoNormal">On Mon, Apr 11, 2011 at 10:15 AM, Michal Srna &lt;<a href="mailto:kositch@seznam.cz" target="_blank">kositch@seznam.cz</a>&gt; wrote:</p>

<p class="MsoNormal">Hello dear VTK users,<br><br>I would like to connect two 3D images from ITK (same dimensions) to VTK and blend them using vtkImageBlend. The problem is, that when I run the code, it crashes on this part of the code of vtkImageImport.cxx<br>

<br> if (this-&gt;WholeExtentCallback)<br>   {<br>   tryCatchMacro(<br>     this-&gt;SetWholeExtent(<br>-&gt;        (this-&gt;WholeExtentCallback)(this-&gt;CallbackUserData)),<br>     &quot;Calling WholeExtentCallback: &quot;);<br>

   }<br><br>Here is my corresponding code.  &quot;TransformedImportFilter&quot; and  &quot;FixedImportFilter&quot; are outputs of ITKImageFilter, which connects my image data from memory into the ITK pipeline:<br><br>                         /*connecting ITK to VTK*/<br>

                               typedef itk::ImageToVTKImageFilter&lt; TransformedImageType &gt; ITK_to_VTK_ConnectorType;<br><br>                               ITK_to_VTK_ConnectorType::Pointer connector_ITK_to_VTK_alpha_data1 = ITK_to_VTK_ConnectorType::New();<br>

                               ITK_to_VTK_ConnectorType::Pointer connector_ITK_to_VTK_alpha_data2 = ITK_to_VTK_ConnectorType::New();<br><br>                               connector_ITK_to_VTK_alpha_data1-&gt;SetInput( TransformedImportFilter-&gt;GetOutput() );<br>

                               connector_ITK_to_VTK_alpha_data2-&gt;SetInput( FixedImportFilter-&gt;GetOutput() );<br><br>                       /*blending image data*/<br>                               vtkSmartPointer&lt;vtkImageBlend&gt; blend = vtkSmartPointer&lt;vtkImageBlend&gt;::New();<br>

                               blend-&gt;SetOpacity(0, 0.5);<br>                               blend-&gt;SetOpacity(1, 0.5);<br>                               blend-&gt;SetInput(0,connector_ITK_to_VTK_alpha_data1-&gt;GetOutput());<br>

                               blend-&gt;SetInput(0,connector_ITK_to_VTK_alpha_data2-&gt;GetOutput());<br><br>                       /*connecting VTK to ITK*/<br>                               typedef itk::VTKImageToImageFilter&lt; TransformedImageType &gt; VTK_to_ITK_ConnectorType;<br>

<br>                               VTK_to_ITK_ConnectorType::Pointer connector_VTK_to_ITK = VTK_to_ITK_ConnectorType::New();<br><br>                               connector_VTK_to_ITK-&gt;SetInput( blend-&gt;GetOutput() );<br>

<br>                       /*writing the data into DICOM*/<br>                               typedef itk::ImageFileWriter&lt; TransformedImageType &gt; WriterType;<br>                               WriterType::Pointer writer = WriterType::New();<br>

                               writer-&gt;SetFileName(output_alpha_visualization);<br>                               writer-&gt;SetInput(connector_VTK_to_ITK-&gt;GetOutput() );<br>                               writer-&gt;Update();<br>

<br>I think the problem is already in process of importing data from ITK to VTK. I am using ITKv4 and VTK 5.6.1 on Windows platform with MVSC++.<br><br>I will be happy, if someone will help me.<br><br>Best regards,<br><br>

Pavli<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 <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>

<br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a></p>

</div><p class="MsoNormal"> </p></div></div></div><p class="MsoNormal"><br><br clear="all"></p></div></div><p class="MsoNormal"><span style="color:#888888">-- <br>S pozdravem Bc. Michal Srna<br><br>Fotografické portfolio:<br>

<a href="http://michalsrna.cz" target="_blank">http://michalsrna.cz</a></span></p></div><p class="MsoNormal"> </p></div></div></div><p class="MsoNormal"><br><br clear="all"><br>-- <br>S pozdravem Bc. Michal Srna<br><br>Fotografické portfolio:<br>

<a href="http://michalsrna.cz" target="_blank">http://michalsrna.cz</a></p></div></div></div></div></blockquote></div></div></div><div><div></div><div class="h5"><br><br clear="all"><br>-- <br>S pozdravem Bc. Michal Srna<br>
<br>Fotografické portfolio:<br><a href="http://michalsrna.cz" target="_blank">http://michalsrna.cz</a><br>

</div></div></div><br><br clear="all"><br>-- <br>S pozdravem Bc. Michal Srna<br><br>Fotografické portfolio:<br><a href="http://michalsrna.cz">http://michalsrna.cz</a><br>