[vtkusers] ImageReader don't work

Stephan Theisen StephanTheisen at gmx.de
Sat Feb 12 09:06:19 EST 2005


Hi together!

I've a little problem with my ImageReader. I've a number slices which I 
will read in as a volume. So I implemented the
the vtkImageReader function in my programm. But all what I get is a 
black screen. Is anything wrong in the following
source code:

    vtkImageReader2 ireader = new vtkImageReader2();
    ireader.SetDataExtent(0,512,0,512,1,30);
    ireader.SetDataSpacing(0.488,0.488,1.0);
    ireader.SetFilePrefix("G:/CT-BilderTiffumbenannt/basename");
    ireader.SetFilePattern("%s%i.tif");
    ireader.SetFileDimensionality(3); 

    vtkContourFilter skinExtractor = new vtkContourFilter();
    skinExtractor.SetInput(ireader.GetOutput());  
    skinExtractor.SetValue(0,1150);
       
    vtkDecimatePro skinDeci = new vtkDecimatePro();
    skinDeci.SetInput(skinExtractor.GetOutput());
    skinDeci.SetTargetReduction(0.9);
    skinDeci.SetFeatureAngle(50.0);
    skinDeci.SplittingOff();
    skinDeci.AccumulateErrorOn();
    skinDeci.SetMaximumError(0.2);
    skinDeci.PreserveTopologyOn();
   
    vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter();
    smoother.SetInput(skinDeci.GetOutput());
    smoother.SetNumberOfIterations(50);
       
    vtkPolyDataNormals skinNormals = new vtkPolyDataNormals();
    skinNormals.SetInput(smoother.GetOutput());
    skinNormals.SetFeatureAngle(50.0);
       
    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();
    skinMapper.SetInput(skinNormals.GetOutput());
    skinMapper.ScalarVisibilityOff();
       
    vtkActor skin = new vtkActor();
    skin.SetMapper(skinMapper);
    skin.GetProperty().SetDiffuseColor(1, .49, .25);
    skin.GetProperty().SetSpecular(.3);
    skin.GetProperty().SetSpecularPower(20);
    skin.GetProperty().SetOpacity(1.0);
    
    renWin.GetRenderer().AddActor(skin);

The rest of the programm is still works with a volumereader, but now I 
must use an imagereader.
Thanks in advance

Stephan




More information about the vtkusers mailing list