[vtkusers] Slow Dicom blend mode.

David Gobbi david.gobbi at gmail.com
Wed Oct 13 16:35:10 EDT 2010


Hi Allessandro,

The three transfer functions in that example (the volumeColor,
volumeScalarOpacity, and volumeGradientOpacity) are hard-coded for the
headsq/quarter images in VTKData.  To use them with any other volume,
you must change the values.

 volumeColor->AddRGBPoint(0, 0.0, 0.0, 0.0);
 volumeColor->AddRGBPoint(500, 1.0, 0.5, 0.3);
 volumeColor->AddRGBPoint(1000, 1.0, 0.5, 0.3);
 volumeColor->AddRGBPoint(1150, 1.0, 1.0, 0.9);

 volumeScalarOpacity->AddPoint(0, 0.00);
 volumeScalarOpacity->AddPoint(500, 0.15);
 volumeScalarOpacity->AddPoint(1000, 0.15);
 volumeScalarOpacity->AddPoint(1150, 0.85);

These are made for a volume with intensity values that approximately
range from 0 to 1200.  Find the intensity range of your DICOM data and
adjust them accordingly.  Then you will be able to use "Composite" for
your volume rendering.

  David


On Wed, Oct 13, 2010 at 1:09 AM, Alessandro Martini
<alessandromartini at gmail.com> wrote:
> I get the medical4.cxx example and change it to open a dicom file, resulting
> this code, but with SetBlendModeToComposite the volume dond appear, and
> SetBlendModeToAdictive is to much slow, what I need to use
> SetBlendModeToComposite?
>
>         vtkSmartPointer<vtkRenderer>ren = vtkWindow1->GetRenderer();
>         vtkSmartPointer<vtkRenderWindowInteractor>iren =
>         vtkWindow1->GetInteractor();
>
>         vtkSmartPointer<vtkDICOMImageReader>dicomReader =
>         vtkSmartPointer<vtkDICOMImageReader>::New();
>         dicomReader->SetDirectoryName(dirname);
>         dicomReader->Update();
>
>         vtkSmartPointer<vtkSmartVolumeMapper>volumeMapper =
>         vtkSmartPointer<vtkSmartVolumeMapper>::New();
>         volumeMapper->SetInput(dicomReader->GetOutput());
>
> -->>        volumeMapper->SetBlendModeToAdditive();
> <<--
>
>         vtkSmartPointer<vtkColorTransferFunction>volumeColor =
>         vtkSmartPointer<vtkColorTransferFunction>::New();
>         volumeColor->AddRGBPoint(0, 0.0, 0.0, 0.0);
>         volumeColor->AddRGBPoint(500, 1.0, 0.5, 0.3);
>         volumeColor->AddRGBPoint(1000, 1.0, 0.5, 0.3);
>         volumeColor->AddRGBPoint(1150, 1.0, 1.0, 0.9);
>
>         vtkSmartPointer<vtkPiecewiseFunction>volumeScalarOpacity =
>         vtkSmartPointer<vtkPiecewiseFunction>::New();
>         volumeScalarOpacity->AddPoint(0, 0.00);
>         volumeScalarOpacity->AddPoint(500, 0.15);
>         volumeScalarOpacity->AddPoint(1000, 0.15);
>         volumeScalarOpacity->AddPoint(1150, 0.85);
>
>         vtkSmartPointer<vtkPiecewiseFunction>volumeGradientOpacity =
>         vtkSmartPointer<vtkPiecewiseFunction>::New();
>         volumeGradientOpacity->AddPoint(0, 0.0);
>         volumeGradientOpacity->AddPoint(90, 0.5);
>         volumeGradientOpacity->AddPoint(100, 1.0);
>
>         vtkSmartPointer<vtkVolumeProperty>volumeProperty =
>         vtkSmartPointer<vtkVolumeProperty>::New();
>         volumeProperty->SetColor(volumeColor);
>         volumeProperty->SetScalarOpacity(volumeScalarOpacity);
>         volumeProperty->SetGradientOpacity(volumeGradientOpacity);
>         volumeProperty->SetInterpolationTypeToLinear();
>         volumeProperty->ShadeOn();
>         volumeProperty->SetAmbient(0.4);
>         volumeProperty->SetDiffuse(0.6);
>         volumeProperty->SetSpecular(0.2);
>
>         vtkSmartPointer<vtkVolume>volume =
> vtkSmartPointer<vtkVolume>::New();
>         volume->SetMapper(volumeMapper);
>         volume->SetProperty(volumeProperty);
>
>         ren->AddViewProp(volume);
>
>         vtkCamera *camera = ren->GetActiveCamera();
>         double *c = volume->GetCenter();
>         camera->SetFocalPoint(c[0], c[1], c[2]);
>         camera->SetPosition(c[0] + 400, c[1], c[2]);
>         camera->SetViewUp(0, 0, -1);
>
>         vtkWindow1->Invalidate();
>
>         iren->Initialize();
>         iren->Start();
>
> Thank's,
> Alessandro Martini
> alessandromartini at gmail.com
> -------------------------------------------------
> 'Existem 10 tipos de pessoas no mundo:
> aquelem que entendem binário, e aqueles que não!'
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list