Ignore:
Timestamp:
Nov 23, 2014, 7:40:56 PM (10 years ago)
Author:
ldelgass
Message:

Merge some changes from trunk, including 2 new (currently unused) commands for
the image (slice) object

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vtkvis/branches/1.7/Image.h

    r4604 r4783  
    6666    }
    6767
     68    void setSlicePlane(double normal[3], double origin[3])
     69    {
     70        setSliceFollowsCamera(false);
     71
     72        vtkImageMapper3D *mapper = getImageMapper();
     73        vtkImageResliceMapper *resliceMapper = vtkImageResliceMapper::SafeDownCast(mapper);
     74        if (resliceMapper != NULL) {
     75            vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
     76            plane->SetNormal(normal);
     77            plane->SetOrigin(origin);
     78            resliceMapper->SetSlicePlane(plane);
     79        }
     80    }
     81
     82    void setSliceFollowsCamera(bool state)
     83    {
     84        vtkImageMapper3D *mapper = getImageMapper();
     85        if (mapper != NULL) {
     86            mapper->SetSliceFacesCamera(state ? 1 : 0);
     87            mapper->SetSliceAtFocalPoint(state ? 1 : 0);
     88        }
     89    }
     90
     91    void setJumpToNearestSlice(bool state)
     92    {
     93        vtkImageMapper3D *mapper = getImageMapper();
     94        vtkImageResliceMapper *resliceMapper = vtkImageResliceMapper::SafeDownCast(mapper);
     95        if (resliceMapper != NULL) {
     96            resliceMapper->SetJumpToNearestSlice(state ? 1 : 0);
     97        }
     98    }
     99
    68100    void setExtents(int extent[6])
    69101    {
Note: See TracChangeset for help on using the changeset viewer.