[vtkusers] Very slow mapper!?!?

oliveira at alumni.deec.uc.pt oliveira at alumni.deec.uc.pt
Mon Jul 14 11:19:06 EDT 2003


Hi all,
I'm using the next code to read, mapping with a lookuptable and view the
result.
Ok, this code work perfectly but it needs very much time to appears the
image, and when it appears the interaction is very, very slow (for example
to make zoom).
I'm using a PIII (1.2) with 512M ram (win 2000 pro).
This program also takes 96M ram when running!?!?!?
The input image as only 64k !!!!!

Is there any way to do what I want or am I using this classes in a wrong
way?
I think the problem is in the mapper because when I use only imageviewer
without colormapping is very fast! Am I using the right mapper?

Thanks.
//leitura is the name of a file with 64k

	vtkImageReader *imagedata = vtkImageReader::New();
	imagedata->SetFileName(leitura);
	imagedata->SetDataOrigin(0,0,0);
	imagedata->SetFileDimensionality(2);
	imagedata->SetDataExtent(0,255,0,255,0,0);
	imagedata->SetDataScalarTypeToUnsignedChar();
	imagedata->Update();

	vtkLookupTable *lut = vtkLookupTable::New();
	lut->SetNumberOfColors(17);

	lut->Build();
        lut-> SetTableValue(0,0.0,0.0,1.0,1.0);
	lut-> SetTableValue(1,0.0,0.25,1.0,1.0);
	lut-> SetTableValue(2,0.0,0.5,1.0,1.0);
	lut-> SetTableValue(3,0.0,0.75,1.0,1.0);
	lut-> SetTableValue(4,0.0,1.0,1.0,1.0);
	lut-> SetTableValue(5,0.0,1.0,0.75,1.0);
	lut-> SetTableValue(6,0.0,1.0,0.5,1.0);
	lut-> SetTableValue(7,0.0,1.0,0.25,1.0);
	lut-> SetTableValue(8,0.0,1.0,0.0,1.0);
	lut-> SetTableValue(9,0.25,1.0,0.0,1.0);
	lut-> SetTableValue(10,0.5,1.0,0.0,1.0);
	lut-> SetTableValue(11,0.75,1.0,0.0,1.0);
	lut-> SetTableValue(12,1.0,1.0,0.0,1.0);
	lut-> SetTableValue(13,1.0,0.75,0.0,1.0);
	lut-> SetTableValue(14,1.0,0.5,0.0,1.0);
	lut-> SetTableValue(15,1.0,0.25,0.0,1.0);
	lut-> SetTableValue(16,1.0,0.0,0.0,1.0);


	vtkDataSetMapper *map = vtkDataSetMapper::New();
        map-> SetLookupTable(lut);
        map->SetInput(imagedata->GetOutput());
	map-> SetScalarRange(0.0,200.0);
	map->SetColorModeToMapScalars();
	map->Update();

	vtkActor *actor=vtkActor::New();
        actor->SetMapper(map);

        vtkRenderer *ren=vtkRenderer::New();
	ren->AddActor(actor);

	vtkRenderWindow *renwin=vtkRenderWindow::New();
	renwin->AddRenderer(ren);
	renwin->Render();

	vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();

	iren->SetRenderWindow(renwin);
	iren->Initialize();

	iren->Start();






More information about the vtkusers mailing list