[vtkusers] Why does this give a "3D texture not supported" error?
Diptansu Das
diptansu at gmail.com
Mon Jan 18 13:59:53 EST 2010
Hi everyone,
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:
typedef itk::Image< PixelT, 2> ImageT;
typedef itk::ImageFileReader< ImageT > ReaderT;
typedef itk::Image< unsigned char, 2 > UCharImageT;
typedef itk::BinaryThresholdImageFilter< ImageT, UCharImageT > ThresholdT;
typedef itk::VTKImageExport< UCharImageT > ExportFilterT;
ReaderT::Pointer reader = ReaderT::New();
reader->SetFileName( fullFilePath.c_str());
reader->Update();
ThresholdT::Pointer thresholder = ThresholdT::New();
thresholder->SetInput( reader->GetOutput() );
thresholder->SetOutsideValue( 0 );
thresholder->SetInsideValue( 255 );
unsigned char component[3];
component[0] = component[1] = component[2] = 0;
thresholder->SetLowerThreshold( component );
component[0] = component[1] = component[2] = 200;
thresholder->SetUpperThreshold( component );
ExportFilterT::Pointer itkExporter = ExportFilterT::New();
itkExportFilters.push_back( itkExporter );
itkExporter->SetInput( thresholder->GetOutput() ); // If instead I
use reader->GetOutput() then there is no error.
itkExporter->Update();
vtkImageImport* vtkImporter = vtkImageImport::New();
ConnectPipelines(itkExporter, vtkImporter);
voi = vtkExtractVOI::New();
voi->SetInput( vtkImporter->GetOutput() );
voi->SetVOI( 0, 1023, 0, 1023, 0, 0);
texture = vtkTexture::New();
texture->SetInput( voi->GetOutput() );
texture->InterpolateOn();
texture->SetLookupTable( colorMap );
map = vtkPolyDataMapper::New();
map->SetInput( imagePlane->GetOutput() );
actor = vtkActor::New();
actor->SetMapper( map );
actor->SetTexture( texture );
ren = vtkRenderer::New();
ren->AddActor( actor );
double x, y, z;
x = y = z = 0.0;
//ren->GetActiveCamera()->GetPosition(x, y, z);
//std::cout << "Camera position: x = " << x << ", y = " << y << ", z = "
<< z << std::endl;
//ren->GetActiveCamera()->SetPosition(0.0, 0.0, 1.0);
ren->SetBackground(0.0, 0.0, 0.0 );
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.
Cheers,
D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100118/40f73f5a/attachment.htm>
More information about the vtkusers
mailing list