[vtkusers] Quick vtkImageViewer2 Reset Level question

Bryn Lloyd blloyd at vision.ee.ethz.ch
Mon Apr 20 03:32:09 EDT 2009


try this:

   vtkImageData *image = viewer->GetInput();
   this->range = image->GetScalarRange();
   this->SetColorLevel(0.5 * (range[0] + range[1]));
   this->SetColorWindow(range[1] - range[0]);





If you want to have additional features, e.g.
  1. moving between slices of a 3D image (up/down keys)
  2. picking points in the image (e.g. seed points for segmentation)

then check out my little extension to vtkImageViewer2:

http://www.vision.ee.ethz.ch/~blloyd/ImageViewer

Some explanation about it's usage is in the header file: ImageViewer.h


You can also have a look at this thread:
http://www.vtk.org/pipermail/vtkusers/2009-March/100043.html



--Bryn






Shakes wrote:
> Hi Guys,
> 
> I just wanted to reset the window/level in vtkImageViewer2 through the 
> API (rather than relying on user to press 'r'). Whats the easy way of 
> doing this?
> 
> Looked everywhere. vtkImageViewer2 is within a QVTKWidget btw. Thanks in 
> advance.
> 
> Cheers
> Shakes
> 
> VTK 5.2.1, Qt 4.4.3
> 
> _______________________________________________
> 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


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 26668
Fax: +41 44 63 21199
-------------------------------------------------



More information about the vtkusers mailing list