# keep the slices color same as in volume rendering

**URL:** https://discourse.vtk.org/t/keep-the-slices-color-same-as-in-volume-rendering/13332
**Category:** Support
**Created:** [February 18, 2024, 8:35am UTC](https://discourse.vtk.org/t/keep-the-slices-color-same-as-in-volume-rendering/13332 "2024-02-18T08:35:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Adam](https://discourse.vtk.org/user_avatar/discourse.vtk.org/adam/32/8481_2.png) [@Adam](https://discourse.vtk.org/u/Adam)
#### Post date: [February 18, 2024, 8:35am UTC](https://discourse.vtk.org/t/keep-the-slices-color-same-as-in-volume-rendering/13332/1 "2024-02-18T08:35:41Z")

</div>

Hi,I am trying to implement the 4 planes view thing (axial, coronal,sagittal and 3D(volume render)) using three vtkImagePlaneWidget in the 3D view. but when i modify the 3D volume property (color,Opacity and Contrast),the vtkImagePlaneWidget slices(axial, coronal,sagittal) unable to update synchronously color,Opacity and Contrast.

vtk-9.3.0

I will really appreciate if you can guide me through.

Best Regards

```auto
    int dimensions[3] = { 0,0,0 };
    reader->GetOutput()->GetDimensions(dimensions);
    picker->SetTolerance(0.005);

    imgPlaneX->SetInputConnection(reader->GetOutputPort());
    imgPlaneX->SetPicker(picker);
    imgPlaneX->RestrictPlaneToVolumeOn();
    imgPlaneX->GetMarginProperty()->SetOpacity(0.0);
    imgPlaneX->SetMarginSizeX(0);
    imgPlaneX->SetMarginSizeY(0);
    imgPlaneX->DisplayTextOn();
    imgPlaneX->SetResliceInterpolateToLinear();
    imgPlaneX->SetPlaneOrientationToXAxes();
    //imgPlaneX->SetWindowLevel(imgBitDepthLevelScale, imgBitDepthLevelScale / 2.0, 0);
    imgPlaneX->SetSliceIndex(dimensions[0] / 2);
    imgPlaneX->GetTexturePlaneProperty()->SetOpacity(1);
    //imgPlaneX->GetCursorProperty()->SetColor(1, 0, 0);
    //imgPlaneX->GetMarginProperty()->SetColor(1, 0, 0);
    imgPlaneX->GetPlaneProperty()->SetColor(1, 0.25, 0.0);
    imgPlaneX->GetSelectedPlaneProperty()->SetColor(0, 1, 0);
    //imgPlaneX->GetPlaneProperty()->SetOpacity(1.0);
    imgPlaneX->GetPlaneProperty()->SetLineWidth(1);

    imgPlaneY->SetInputConnection(reader->GetOutputPort());
    imgPlaneY->SetPicker(picker);
    imgPlaneY->RestrictPlaneToVolumeOn();
    imgPlaneY->GetMarginProperty()->SetOpacity(0);
    imgPlaneY->SetMarginSizeX(0);
    imgPlaneY->SetMarginSizeY(0);
    imgPlaneY->DisplayTextOn();
    imgPlaneY->SetResliceInterpolateToLinear();
    imgPlaneY->SetPlaneOrientationToYAxes();
    //imgPlaneY->SetWindowLevel(imgBitDepthLevelScale, imgBitDepthLevelScale / 2.0, 0);
    imgPlaneY->SetSliceIndex(dimensions[1] / 2);
    imgPlaneY->GetTexturePlaneProperty()->SetOpacity(1);
    imgPlaneY->GetPlaneProperty()->SetColor(1, 0.25, 0.0);
    imgPlaneY->GetSelectedPlaneProperty()->SetColor(0, 1, 0);
    //imgPlaneY->GetPlaneProperty()->SetOpacity(1.0);
    imgPlaneY->GetPlaneProperty()->SetLineWidth(1);

    imgPlaneZ->SetInputConnection(reader->GetOutputPort());
    imgPlaneZ->SetPicker(picker);
    imgPlaneZ->RestrictPlaneToVolumeOn();
    imgPlaneZ->GetMarginProperty()->SetOpacity(0);
    imgPlaneZ->SetMarginSizeX(0);
    imgPlaneZ->SetMarginSizeY(0);
    imgPlaneZ->DisplayTextOn();
    imgPlaneZ->SetResliceInterpolateToLinear();
    imgPlaneZ->SetPlaneOrientationToZAxes();
    //imgPlaneZ->SetWindowLevel(imgBitDepthLevelScale, imgBitDepthLevelScale / 2.0, 0);
    imgPlaneZ->SetSliceIndex(dimensions[2] / 2);
    imgPlaneZ->GetTexturePlaneProperty()->SetOpacity(1);
    imgPlaneZ->GetPlaneProperty()->SetColor(1, 0.25, 0.0);
    imgPlaneZ->GetSelectedPlaneProperty()->SetColor(0, 1, 0);
    //imgPlaneZ->GetPlaneProperty()->SetOpacity(1.0);
    imgPlaneZ->GetPlaneProperty()->SetLineWidth(1);

    imgPlaneX->SetDefaultRenderer(renderer);
    imgPlaneY->SetDefaultRenderer(renderer);
    imgPlaneZ->SetDefaultRenderer(renderer);

```

 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/da40e130bacdd8a3d4607431eb16e931b680beb7.jpeg)
