[vtkusers] VTK speed - can it be THAT slow????

Gregg Germain gregg at head.cfa.harvard.edu
Tue Jan 20 06:57:18 EST 2004


Hello,

I created an application that reads in an image and overlays contours
on top.  The image is around 350x350 pixels and there are 10 levels
in contours. 

When I try to drag the contour around with a mouse, it takes 11 to 14 seconds 
for the each movement to occur. I know the web page says that VTK is slow, but 
can it be THIS slow?

Perhaps I'm doing something that causes gross inefficiency. A code fragment is 
below


vtkImageActor* imageActor;
  vtkFITSReader* imageReader=vtkFITSReader::New();
  vtkImageShiftScale* imageShiftScale=vtkImageShiftScale::New();
  imageActor = vtkImageActor::New();
  imageReader->SetDataSpacing(0.8,0.8,1.5);
  imageReader->SetFileName(inFileName.c_str());

  imageShiftScale->SetInput(imageReader->GetOutput());
  imageShiftScale->SetShift(0);
  imageShiftScale->SetScale(1);
  imageShiftScale->SetOutputScalarTypeToUnsignedChar();
  imageActor->SetInput(imageShiftScale->GetOutput());

  renderer->AddActor(imageActor);


and the contour:

  vtkActor* contActor;
 vtkFITSReader* imageReader=vtkFITSReader::New();
  vtkImageShiftScale* imageShiftScale=vtkImageShiftScale::New();

  imageReader->SetFileName(inFileName.c_str());

  imageShiftScale->SetInput(imageReader->GetOutput());
  imageShiftScale->SetOutputScalarTypeToUnsignedChar();

  vtkContourFilter* contFilter = vtkContourFilter::New();
  contFilter->SetInput(imageShiftScale->GetOutput());
  contFilter->GenerateValues(inLevelCount,inLowVal,inHighVal);
  vtkPolyDataMapper* contMapper = vtkPolyDataMapper::New();
  contMapper->SetInput(contFilter->GetOutput());
  contMapper->SetScalarRange(inLowVal,inHighVal);
  contMapper->SetColorMode(5);
  contActor=vtkActor::New();
  contActor->SetMapper(contMapper);

  renderer->AddActor(contActor);


--- Gregg

                                   "Improvise, adapt, overcome."
gregg at head-cfa.harvard.edu             
Smithsonian Center for Astrophysics            
Phone: (617) 496-1558                                 
  







More information about the vtkusers mailing list