[vtkusers] Trying to connect ITK - VTK - ITK

Bill Lorensen bill.lorensen at gmail.com
Mon Apr 11 11:01:29 EDT 2011


Try changing:
  blend->SetInput(0,connector_ITK_to_VTK_alpha_data2->GetOutput());
to
  blend->SetInput(1,connector_ITK_to_VTK_alpha_data2->GetOutput());


On Mon, Apr 11, 2011 at 10:15 AM, Michal Srna <kositch at seznam.cz> wrote:

> Hello dear VTK users,
>
> 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
>
>  if (this->WholeExtentCallback)
>    {
>    tryCatchMacro(
>      this->SetWholeExtent(
> ->        (this->WholeExtentCallback)(this->CallbackUserData)),
>      "Calling WholeExtentCallback: ");
>    }
>
> Here is my corresponding code.  "TransformedImportFilter" and
>  "FixedImportFilter" are outputs of ITKImageFilter, which connects my image
> data from memory into the ITK pipeline:
>
>                          /*connecting ITK to VTK*/
>                                typedef itk::ImageToVTKImageFilter<
> TransformedImageType > ITK_to_VTK_ConnectorType;
>
>                                ITK_to_VTK_ConnectorType::Pointer
> connector_ITK_to_VTK_alpha_data1 = ITK_to_VTK_ConnectorType::New();
>                                ITK_to_VTK_ConnectorType::Pointer
> connector_ITK_to_VTK_alpha_data2 = ITK_to_VTK_ConnectorType::New();
>
>                                connector_ITK_to_VTK_alpha_data1->SetInput(
> TransformedImportFilter->GetOutput() );
>                                connector_ITK_to_VTK_alpha_data2->SetInput(
> FixedImportFilter->GetOutput() );
>
>                        /*blending image data*/
>                                vtkSmartPointer<vtkImageBlend> blend =
> vtkSmartPointer<vtkImageBlend>::New();
>                                blend->SetOpacity(0, 0.5);
>                                blend->SetOpacity(1, 0.5);
>
>  blend->SetInput(0,connector_ITK_to_VTK_alpha_data1->GetOutput());
>
>  blend->SetInput(0,connector_ITK_to_VTK_alpha_data2->GetOutput());
>
>                        /*connecting VTK to ITK*/
>                                typedef itk::VTKImageToImageFilter<
> TransformedImageType > VTK_to_ITK_ConnectorType;
>
>                                VTK_to_ITK_ConnectorType::Pointer
> connector_VTK_to_ITK = VTK_to_ITK_ConnectorType::New();
>
>                                connector_VTK_to_ITK->SetInput(
> blend->GetOutput() );
>
>                        /*writing the data into DICOM*/
>                                typedef itk::ImageFileWriter<
> TransformedImageType > WriterType;
>                                WriterType::Pointer writer =
> WriterType::New();
>
>  writer->SetFileName(output_alpha_visualization);
>
>  writer->SetInput(connector_VTK_to_ITK->GetOutput() );
>                                writer->Update();
>
> 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++.
>
> I will be happy, if someone will help me.
>
> Best regards,
>
> Pavli
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110411/b16ddd08/attachment.htm>


More information about the vtkusers mailing list