[vtkusers] vtkImageMapper3D, vtkInteractorStyleImage - inverting luminance images

David Gobbi david.gobbi at gmail.com
Tue Jun 14 21:05:26 EDT 2011


Hi Dean,

The ImageMapper3D rejects negative windows by design, so if you want
to change this behavior you should:
1) add an option to the interface so that this behavior can be turned on or off
2) ensure that, whichever way the option is set, that both image mappers
  (vtkImageSliceMapper and vtkImageResliceMapper) behave the same way

 - David


On Tue, Jun 14, 2011 at 6:33 PM, Dean Inglis <dean.inglis at camris.ca> wrote:
> I commented on this issue earlier when the new vtkImageSlice
> and associated classes were contributed:
> http://www.vtk.org/pipermail/vtk-developers/2011-April/009631.html
>
> I found I can bypass the limitation on negative window/level
> to invert images in vtkInteractorStyleImage by adding observers
> to handle Start/End/Reset/WindowLevel events. Even so,
> however, vtkImageMapper3D prohibits this from working
> because of the restriction that the range computed from the window
> and level obtained from vtkImageProperty must be ordered
> min to max for a valid scale in the following method:
>
> void vtkImageMapper3D::ConvertImageScalarsToRGBA(
>  void *inPtr, unsigned char *outPtr, const int extent[6],
>  int numComp, int inIncY, int inIncZ, int outIncY, int outIncZ,
>  int scalarType, double scalarRange[2])
> {
>  double shift = -scalarRange[0];
>  double scale = 255.0;
>
>  //if (scalarRange[0] < scalarRange[1])
>  //  {
>   scale /= (scalarRange[1] - scalarRange[0]);
>  //  }
> // else
> //   {
> //   scale = 1e+32;
> //   }
>
> Commenting out the lines as shown allows for inverting an
> image without having to use a user supplied lut.
> What are the reasons for restricting the scale to be a positive
> value?  Can the above edits be incorporated into the mapper,
> or is there an alternative approach that could be suggested to
> allow interactive window/level with inversion?
>
> I have tried vtkImageMapToWindowLevelColors between
> say a reader and a vtkImageMapper3D but this significantly affects
> performance.
>
> Dean
>
>
>
>
>
> _______________________________________________
> 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