Changeset 4814


Ignore:
Timestamp:
Dec 2, 2014, 8:56:30 PM (5 years ago)
Author:
ldelgass
Message:

Add protocol to toggle interpolation in image slicer

Location:
vtkvis/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vtkvis/trunk/Renderer.h

    r4793 r4814  
    773773    void setImageWindow(const DataSetId& id, double window);
    774774
     775    void setImageSliceInterp(const DataSetId& id, bool state);
     776
    775777    void setImageSlicePlane(const DataSetId& id, double normal[3], double origin[3]);
    776778
  • vtkvis/trunk/RendererCmd.cpp

    r4792 r4814  
    71817181
    71827182static int
     7183ImageSliceInterpOp(ClientData clientData, Tcl_Interp *interp, int objc,
     7184                   Tcl_Obj *const *objv)
     7185{
     7186    bool state;
     7187    if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
     7188        return TCL_ERROR;
     7189    }
     7190    if (objc == 4) {
     7191        const char *name = Tcl_GetString(objv[3]);
     7192        g_renderer->setImageSliceInterp(name, state);
     7193    } else {
     7194        g_renderer->setImageSliceInterp("all", state);
     7195    }
     7196    return TCL_OK;
     7197}
     7198
     7199static int
    71837200ImageSlicePlaneOp(ClientData clientData, Tcl_Interp *interp, int objc,
    71847201                  Tcl_Obj *const *objv)
     
    72687285    {"pos",          1, ImagePositionOp, 5, 6, "x y z ?dataSetName?"},
    72697286    {"scale",        2, ImageScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     7287    {"sinterp",      2, ImageSliceInterpOp, 3, 4, "bool ?dataSetName?"},
    72707288    {"slice",        2, ImageSlicePlaneOp, 8, 9, "nx ny nz ox oy oz ?dataSetName?"},
    72717289    {"visible",      1, ImageVisibleOp, 3, 4, "bool ?dataSetName?"},
  • vtkvis/trunk/RendererGraphicsObjs.cpp

    r4090 r4814  
    24082408}
    24092409
     2410void Renderer::setImageSliceInterp(const DataSetId& id, bool state)
     2411{
     2412    ImageHashmap::iterator itr;
     2413
     2414    bool doAll = false;
     2415
     2416    if (id.compare("all") == 0) {
     2417        itr = _images.begin();
     2418        if (itr == _images.end())
     2419            return;
     2420        doAll = true;
     2421    } else {
     2422        itr = _images.find(id);
     2423    }
     2424    if (itr == _images.end()) {
     2425        ERROR("Image not found: %s", id.c_str());
     2426        return;
     2427    }
     2428
     2429    do {
     2430        itr->second->setJumpToNearestSlice(!state);
     2431    } while (doAll && ++itr != _images.end());
     2432
     2433    _needsRedraw = true;
     2434}
     2435
    24102436void Renderer::setImageSlicePlane(const DataSetId& id, double normal[3], double origin[3])
    24112437{
Note: See TracChangeset for help on using the changeset viewer.