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"><<a href="mailto:michal@srna.info">michal@srna.info</a>></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'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<unsigned short,2> ImageType;<br>typedef itk::ImageFileReader<ImageType> ReaderType;<br>typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;<br><br>ReaderType::Pointer reader= ReaderType::New();<br>
ConnectorType::Pointer connector= ConnectorType::New();<br><br>reader->SetFileName( argv[1]);<br>
connector->SetInput( reader->GetOutput() );<br><br>connector-> Update ();<br><br>Code runs, no compile errors and when running it crashes on the same spot in file vtkImageImport.cxx just when executing "connector-> Update ()". 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 '[3968] test.exe: Native' 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"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></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->SetInput(0,connector_ITK_to_VTK_alpha_data2->GetOutput());<br>
</div><div>
to<br> blend->SetInput(1,connector_ITK_to_VTK_alpha_data2->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"><<a href="mailto:kositch@seznam.cz" target="_blank">kositch@seznam.cz</a>></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->WholeExtentCallback)<br>
{<br>
tryCatchMacro(<br>
this->SetWholeExtent(<br>
-> (this->WholeExtentCallback)(this->CallbackUserData)),<br>
"Calling WholeExtentCallback: ");<br>
}<br>
<br>
Here is my corresponding code. "TransformedImportFilter" and "FixedImportFilter" 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< TransformedImageType > 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->SetInput( TransformedImportFilter->GetOutput() );<br>
connector_ITK_to_VTK_alpha_data2->SetInput( FixedImportFilter->GetOutput() );<br>
<br>
/*blending image data*/<br>
vtkSmartPointer<vtkImageBlend> blend = vtkSmartPointer<vtkImageBlend>::New();<br>
blend->SetOpacity(0, 0.5);<br>
blend->SetOpacity(1, 0.5);<br>
blend->SetInput(0,connector_ITK_to_VTK_alpha_data1->GetOutput());<br>
blend->SetInput(0,connector_ITK_to_VTK_alpha_data2->GetOutput());<br>
<br>
/*connecting VTK to ITK*/<br>
typedef itk::VTKImageToImageFilter< TransformedImageType > 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->SetInput( blend->GetOutput() );<br>
<br>
/*writing the data into DICOM*/<br>
typedef itk::ImageFileWriter< TransformedImageType > WriterType;<br>
WriterType::Pointer writer = WriterType::New();<br>
writer->SetFileName(output_alpha_visualization);<br>
writer->SetInput(connector_VTK_to_ITK->GetOutput() );<br>
writer->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>