<div id=":3hy" class="" style="font-size:12.727272033691406px;margin-bottom:0px;margin-left:0px;padding-bottom:5px;font-family:arial,sans-serif"><div id=":3gh">sorry, the attachment was a little big so I had to scale it down, here is again:</div>

<div id=":3gh"><br></div><div id=":3gh">hello, while I was testing a dicom viewer I am developing I noticed differences in window leveling from the pipeline I am using with respect to one of the viewers I use as reference. I attached the snapshot, the left window is my viewer and the right is one of my reference viewers. Both have the same window/level: 1995/998, but the image displayed at left is darker than right, here is part of the pipeline I use:<div>

<br></div><div><div>        vtk_image = image.vtk_image</div><div>        self.view = vtk.QVTKWidget(self)</div><div>        self.view.setFocusProxy(self)</div><div>        # add the view to the internal layout</div><div>

        self.setUpdatesEnabled(False)</div><div>        self.layout().takeAt(1)</div><div>        self.layout().addWidget(self.view)</div><div>        self.setUpdatesEnabled(True)</div><div><br></div><div>        # create the main interactor style</div>

<div>        style = vtk.vtkInteractorStyleImage()</div><div>        style.SetInteractionModeToImageSlicing()</div><div>        self.view.GetRenderWindow().GetInteractor().SetInteractorStyle(style)</div><div><br></div><div>

        # the axial orientation</div><div>        style.SetZViewRightVector((1, 0, 0))</div><div>        style.SetZViewUpVector((0, -1, 0))</div><div><br></div><div>        # the sagital orientation</div><div>        style.SetXViewRightVector((0, 1, 0))</div>

<div>        style.SetXViewUpVector((0, 0, 1))</div><div><br></div><div>        # the coronal orientation</div><div>        style.SetYViewRightVector((1, 0, 0))</div><div>        style.SetYViewUpVector((0, 0, 1))</div><div>

<br></div><div>        image_mapper = vtk.vtkImageResliceMapper()</div><div>        image_mapper.SliceFacesCameraOn()</div><div>        image_mapper.SliceAtFocalPointOn()</div><div>        image_mapper.JumpToNearestSliceOn()</div>

<div>        image_mapper.BorderOff()</div><div>        self.image_mapper = image_mapper</div><div><br></div><div>        format = image.image_format</div><div>        if format in (vtkgdcm.VTK_LOOKUP_TABLE, vtkgdcm.VTK_INVERSE_LUMINANCE):</div>

<div>            lut = vtk_image.GetPointData().GetScalars().GetLookupTable()</div><div><br></div><div>            if isinstance(lut, vtkgdcm.vtkLookupTable16):</div><div>                color_filter = vtkgdcm.vtkImageMapToColors16()</div>

<div>            else:</div><div>                color_filter = vtk.vtkImageMapToColors()</div><div><br></div><div>            color_filter.SetInputConnection(vtk_image.GetProducerPort())</div><div>            color_filter.SetLookupTable(lut)</div>

<div><br></div><div>            if format == vtkgdcm.VTK_LOOKUP_TABLE:</div><div>                color_filter.SetOutputFormatToRGB()</div><div>            elif format == vtkgdcm.VTK_INVERSE_LUMINANCE:</div><div>                color_filter.SetOutputFormatToLuminance()</div>

<div><br></div><div>            color_filter.Update()</div><div>            scalar_range = color_filter.GetOutput().GetScalarRange()</div><div>            image_mapper.SetInputConnection(color_filter.GetOutputPort())</div>

<div>            del color_filter</div><div>        elif format == vtkgdcm.VTK_YBR:</div><div>            color_filter = vtkgdcm.vtkImageYBRToRGB()</div><div>            color_filter.SetInputConnection(vtk_image.GetProducerPort())</div>

<div>            color_filter.Update()</div><div>            scalar_range = color_filter.GetOutput().GetScalarRange()</div><div>            image_mapper.SetInputConnection(color_filter.GetOutputPort())</div><div>            del color_filter</div>

<div>        else:</div><div>            scalar_range = vtk_image.GetScalarRange()</div><div>            image_mapper.SetInput(vtk_image)</div><div><br></div><div>        try:</div><div>            # here the window width will be: 1995 and window level: 998</div>

<div>            level = image.window_level[0]</div><div>            window = image.window_width[0]</div><div>        except KeyError, IndexError:</div><div>            window = scalar_range[1] - scalar_range[0]</div><div>

            level = 0.5 * (scalar_range[1] + scalar_range[0])</div><div><br></div><div>        image_property = vtk.vtkImageProperty()</div><div>        image_property.SetColorWindow(window)</div><div>        image_property.SetColorLevel(level)</div>

<div>        image_property.SetAmbient(0.0)</div><div>        image_property.SetDiffuse(1.0)</div><div>        image_property.SetOpacity(1.0)</div><div>        image_property.SetInterpolationTypeToLinear()</div><div>        self.image_property = image_property</div>

<div><br></div><div>        image_actor = vtk.vtkImageSlice()</div><div>        image_actor.SetMapper(image_mapper)</div><div>        image_actor.SetProperty(image_property)</div><div>        self.image_actor = image_actor</div>

<div><br></div><div>        image_renderer = vtk.vtkRenderer()</div><div>        image_renderer.SetBackground(0, 0, 0)</div><div>        self.image_renderer = image_renderer</div><div>        image_renderer.AddViewProp(image_actor)</div>

<div>        image_renderer.ResetCamera()</div><div>        image_renderer.GetActiveCamera().ParallelProjectionOn()</div><div>        self.render_window().AddRenderer(image_renderer)</div><div><br></div><div>        self.set_orientation(&#39;AXIAL&#39;)</div>

<div>        self.render()</div></div><div><br></div><div class=""></div></div></div><div id=":3hn" class="" style="font-size:12.727272033691406px;font-family:arial,sans-serif"></div>