Try changing:<br> blend->SetInput(0,connector_ITK_to_VTK_alpha_data2->GetOutput());<br><div id=":1pc">to<br> blend->SetInput(1,connector_ITK_to_VTK_alpha_data2->GetOutput());<br></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">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>