Put a try/catch around the Update();<br><br><div class="gmail_quote">On Mon, Apr 11, 2011 at 11:16 AM, Bc. Michal Srna <span dir="ltr">&lt;<a href="mailto:michal@srna.info">michal@srna.info</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
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).<div><div></div><div class="h5"><br><br> <br><br><div class="gmail_quote">2011/4/11 Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Try changing:<div><br>  blend-&gt;SetInput(0,connector_ITK_to_VTK_alpha_data2-&gt;GetOutput());<br>
</div><div>
to<br>  blend-&gt;SetInput(1,connector_ITK_to_VTK_alpha_data2-&gt;GetOutput());<br></div><div><div></div><div><br><br><div class="gmail_quote">
On Mon, Apr 11, 2011 at 10:15 AM, Michal Srna <span dir="ltr">&lt;<a href="mailto:kositch@seznam.cz" target="_blank">kositch@seznam.cz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


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><br>
</blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>S pozdravem Bc. Michal Srna<br><br>Fotografické portfolio:<br><a href="http://michalsrna.cz" target="_blank">http://michalsrna.cz</a><br>

</font></blockquote></div><br>