[vtkusers] automatic LOD level

jmanjon jmanjon at fis.upv.es
Wed Apr 17 03:21:21 EDT 2002


Hi friends,

I have a LOD volume with 4 levels the fisrt is an outline and all works perfect except that when I do button up the outline is convertd to high resolution LOD (using for this operation 4 seconds). I would like to pass automatically for all the LODs levels like volview does. How can I do it.

the code is this:

 // LOD Level of detail

  vtkProperty *outlineProperty = vtkProperty::New();
  outlineProperty->SetColor(1,1,1);
        vtkOutlineFilter *outline = vtkOutlineFilter::New();
        outline->SetInput(data);
        vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
        mapOutline->SetInput(outline->GetOutput());

        vtkImageResample *resampler1=vtkImageResample::New();
        resampler1->SetInput(data);
        resampler1->SetAxisMagnificationFactor(0,0.2);
        resampler1->SetAxisMagnificationFactor(1,0.2);
        resampler1->SetAxisMagnificationFactor(2,0.2);

        vtkImageResample *resampler2=vtkImageResample::New();
        resampler2->SetInput(data);
        resampler2->SetAxisMagnificationFactor(0,0.6);
        resampler2->SetAxisMagnificationFactor(1,0.6);
        resampler2->SetAxisMagnificationFactor(2,0.6);

        lowresMapper=vtkVolumeTextureMapper2D::New();
        lowresMapper->SetInput(resampler1->GetOutput());

        medresMapper=vtkVolumeTextureMapper2D::New();
        medresMapper->SetInput(resampler2->GetOutput());

        hiresMapper=vtkVolumeTextureMapper2D::New();
        hiresMapper->SetInput(data);

  superhiresMapper=vtkVolumeRayCastMapper::New();
        superhiresMapper->SetInput(data);

  vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();
        superhiresMapper->SetVolumeRayCastFunction(compositeFunction);

  // LOD

  id0=volumeLOD->AddLOD(mapOutline, outlineProperty, 0.0);
  id1=volumeLOD->AddLOD(lowresMapper,volumeProperty,0.0);
  id2=volumeLOD->AddLOD(medresMapper,volumeProperty,0.0);
  id3=volumeLOD->AddLOD(hiresMapper,volumeProperty,0.0);
  id4=volumeLOD->AddLOD(superhiresMapper,volumeProperty,0.0);

  volumeLOD->AutomaticLODSelectionOn();

thanks

jose






More information about the vtkusers mailing list