<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Hi everyone,<div>I am trying to read some data using the ITK ImageFileReader, then after doing thresholding I am trying to import it into VTK and display it using VTK. If I use the itk image as input to the VTK importer then I don't have any problem. But if I threshold it first then VTK gives an error "3D texture not supported". The code is like this:</div>
<div><br></div><div><div> typedef itk::Image< PixelT, 2> ImageT;</div><div> typedef itk::ImageFileReader< ImageT > ReaderT;</div><div> typedef itk::Image< unsigned char, 2 > UCharImageT;</div><div> typedef itk::BinaryThresholdImageFilter< ImageT, UCharImageT > ThresholdT;</div>
<div> typedef itk::VTKImageExport< UCharImageT > ExportFilterT;</div><div><br></div><div> ReaderT::Pointer reader = ReaderT::New();</div><div> reader->SetFileName( fullFilePath.c_str());</div><div> reader->Update();</div>
<div><br></div><div> ThresholdT::Pointer thresholder = ThresholdT::New();</div><div> thresholder->SetInput( reader->GetOutput() );</div><div> thresholder->SetOutsideValue( 0 );</div><div> thresholder->SetInsideValue( 255 );</div>
<div> unsigned char component[3];</div><div> component[0] = component[1] = component[2] = 0;</div><div> thresholder->SetLowerThreshold( component );</div><div> component[0] = component[1] = component[2] = 200;</div>
<div> thresholder->SetUpperThreshold( component );</div><div><br></div><div> ExportFilterT::Pointer itkExporter = ExportFilterT::New();</div><div> itkExportFilters.push_back( itkExporter );</div><div> itkExporter->SetInput( thresholder->GetOutput() ); // If instead I use reader->GetOutput() then there is no error.</div>
<div> itkExporter->Update();</div><div><br></div><div> vtkImageImport* vtkImporter = vtkImageImport::New();</div><div> ConnectPipelines(itkExporter, vtkImporter);</div><div><br></div><div><div> voi = vtkExtractVOI::New();</div>
<div> voi->SetInput( vtkImporter->GetOutput() );</div><div> voi->SetVOI( 0, 1023, 0, 1023, 0, 0);</div><div> texture = vtkTexture::New();</div><div> texture->SetInput( voi->GetOutput() );</div><div> texture->InterpolateOn();</div>
<div> texture->SetLookupTable( colorMap );</div><div> </div><div> map = vtkPolyDataMapper::New();</div><div> map->SetInput( imagePlane->GetOutput() );</div><div> </div><div> actor = vtkActor::New();</div><div>
actor->SetMapper( map );</div><div> actor->SetTexture( texture );</div><div><br></div><div> ren = vtkRenderer::New();</div><div> ren->AddActor( actor );</div><div> double x, y, z;</div><div> x = y = z = 0.0;</div>
<div> //ren->GetActiveCamera()->GetPosition(x, y, z);</div><div> //std::cout << "Camera position: x = " << x << ", y = " << y << ", z = " << z << std::endl;</div>
<div> //ren->GetActiveCamera()->SetPosition(0.0, 0.0, 1.0);</div><div> ren->SetBackground(0.0, 0.0, 0.0 );</div><div><br></div><div><br></div><div>I posted this in the VTK list because the error was being thrown by VTK. If this is not the best place for it please do tell me.</div>
<div><br></div><div><br></div><div>Cheers,</div><div>D</div></div><div><br></div></div></span>