/usr/include/KWWidgets/vtkKWVolumePropertyWidget.h is in libkwwidgets1-dev 1.0.0~cvs20100930-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | /*=========================================================================
Module: $RCSfile: vtkKWVolumePropertyWidget.h,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkKWVolumePropertyWidget - a transfer function widget
// .SECTION Description
// This class contains the UI components and methods to edit a
// ColorTransferFunction in concert with a PiecewiseFunction for opacity.
// New control points can be added by clicking with the left mouse button
// and they can be removed by dragging them out of the window.
#ifndef __vtkKWVolumePropertyWidget_h
#define __vtkKWVolumePropertyWidget_h
#include "vtkKWCompositeWidget.h"
class vtkDataSet;
class vtkKWCheckButton;
class vtkKWColorTransferFunctionEditor;
class vtkKWHSVColorSelector;
class vtkKWHistogramSet;
class vtkKWFrame;
class vtkKWFrameWithLabel;
class vtkKWMenuButtonWithLabel;
class vtkKWScaleWithEntrySetWithLabel;
class vtkKWMenuButton;
class vtkKWPiecewiseFunctionEditor;
class vtkKWScalarComponentSelectionWidget;
class vtkKWScaleWithEntry;
class vtkKWVolumeMaterialPropertyWidget;
class vtkVolumeProperty;
class KWWidgets_EXPORT vtkKWVolumePropertyWidget : public vtkKWCompositeWidget
{
public:
static vtkKWVolumePropertyWidget* New();
void PrintSelf(ostream& os, vtkIndent indent);
vtkTypeRevisionMacro(vtkKWVolumePropertyWidget,vtkKWCompositeWidget);
// Description:
// Get/Set the transfer function mapping scalar value to color
vtkGetObjectMacro(VolumeProperty, vtkVolumeProperty);
virtual void SetVolumeProperty(vtkVolumeProperty*);
// Description:
// The data this volume property is used for.
// Will be used to get the scalar range of the transfer functions for
// example.
vtkGetObjectMacro(DataSet, vtkDataSet);
virtual void SetDataSet(vtkDataSet*);
// Description:
// Set/Get the histograms for the data this volume property is used for.
// Obviously those histograms must have been computed using the same
// data as the DataSet Ivar above.
vtkGetObjectMacro(HistogramSet, vtkKWHistogramSet);
virtual void SetHistogramSet(vtkKWHistogramSet*);
// Description:
// Set/Get the current component controlled by the widget
virtual void SetSelectedComponent(int);
vtkGetMacro(SelectedComponent, int);
// Description:
// Set/Get the window/level for those transfer functions that support
// this mode (SetInteractiveWindowLevel will trigger interactive events)
// IsInWindowLevelMode return true if part of this widget is in
// window/level mode.
virtual void SetWindowLevel(double window, double level);
virtual void SetInteractiveWindowLevel(double window, double level);
virtual int IsInWindowLevelMode();
// Description:
// Set/Get if the widget is in "Interactive Apply" mode, i.e.
// changes will be propagated during most/all interactions, not just
// at the end of them.
vtkBooleanMacro(InteractiveApplyMode, int);
vtkSetMacro(InteractiveApplyMode, int);
vtkGetMacro(InteractiveApplyMode, int);
// Description:
// Set/Get the 'Interactive Apply' button visibility
vtkBooleanMacro(InteractiveApplyButtonVisibility, int);
virtual void SetInteractiveApplyButtonVisibility(int);
vtkGetMacro(InteractiveApplyButtonVisibility, int);
// Description:
// Set/Get the scalar opacity unit distance visibility
vtkBooleanMacro(ScalarOpacityUnitDistanceVisibility, int);
virtual void SetScalarOpacityUnitDistanceVisibility(int);
vtkGetMacro(ScalarOpacityUnitDistanceVisibility, int);
// Description:
// Set/Get the HSV color selector visibility
vtkBooleanMacro(HSVColorSelectorVisibility, int);
virtual void SetHSVColorSelectorVisibility(int);
vtkGetMacro(HSVColorSelectorVisibility, int);
// Description:
// Set/Get the component selection widget visibility
vtkBooleanMacro(ComponentSelectionVisibility, int);
virtual void SetComponentSelectionVisibility(int);
vtkGetMacro(ComponentSelectionVisibility, int);
// Description:
// Set/Get the interpolation type widget visibility
vtkBooleanMacro(InterpolationTypeVisibility, int);
virtual void SetInterpolationTypeVisibility(int);
vtkGetMacro(InterpolationTypeVisibility, int);
// Description:
// Get the bottom frame, a frame that is always packed at the bottom of
// the whole widget, and can be used to add more user-defined widgets
vtkGetObjectMacro(BottomFrame, vtkKWFrame);
// Description:
// Get the main edit frame, so that it can be collapsed manually
vtkGetObjectMacro(EditorFrame, vtkKWFrameWithLabel);
// Description:
// Set/Get the material widget + enable shading visibility
vtkBooleanMacro(MaterialPropertyVisibility, int);
virtual void SetMaterialPropertyVisibility(int);
vtkGetMacro(MaterialPropertyVisibility, int);
// Description:
// Set the material property button position to the top frame (default)
// or to the scalar opacity user frame, or color user frame.
//BTX
enum
{
MaterialPropertyPositionTop,
MaterialPropertyPositionBottomFrame,
MaterialPropertyPositionScalarOpacityUserFrame,
MaterialPropertyPositionScalarColorUserFrame
};
//ETX
virtual void SetMaterialPropertyPosition(int);
vtkGetMacro(MaterialPropertyPosition, int);
virtual void SetMaterialPropertyPositionToTop();
virtual void SetMaterialPropertyPositionToBottomFrame();
virtual void SetMaterialPropertyPositionToScalarOpacityUserFrame();
virtual void SetMaterialPropertyPositionToScalarColorUserFrame();
// Description:
// Set/Get the gradient opacity function visibility
vtkBooleanMacro(GradientOpacityFunctionVisibility, int);
virtual void SetGradientOpacityFunctionVisibility(int);
vtkGetMacro(GradientOpacityFunctionVisibility, int);
// Description:
// Set/Get the component weight visibility
vtkBooleanMacro(ComponentWeightsVisibility, int);
virtual void SetComponentWeightsVisibility(int);
vtkGetMacro(ComponentWeightsVisibility, int);
// Description:
// If true, an "Enable Shading" checkbox will be displayed and will
// control the shading flag of all components at once
// (based on the first one). If false, the shading flag will be available
// on a per-component basis in the shading dialog.
vtkBooleanMacro(EnableShadingForAllComponents, int);
virtual void SetEnableShadingForAllComponents(int);
vtkGetMacro(EnableShadingForAllComponents, int);
// Description:
// Update the whole UI depending on the value of the Ivars
virtual void Update();
// Description:
// Set/Get if the scalar color transfer function should be used to color
// each point in the scalar opacity editor. This also makes sure that
// any changes made to one or the other will be propagated accordingly.
// This also enables the user to pick a color by double-clicking on
// the scalar opacity points.
vtkBooleanMacro(UseScalarColorFunctionInScalarOpacityEditor, int);
virtual void SetUseScalarColorFunctionInScalarOpacityEditor(int);
vtkGetMacro(UseScalarColorFunctionInScalarOpacityEditor, int);
// Description:
// Merge both scalar opacity and color editors.
// This will put both editors in synchronized/locked mode, the scalar
// color function in the editor will be hidden (only the color ramp will
// remain), and the opacity editor will use the scalar color function
// to color its points. Double clicking on a point will popup a color
// selector.
virtual void MergeScalarOpacityAndColorEditors();
// Description:
// Specifies commands to associate with the widget.
// 'VolumePropertyChangedCommand' is invoked when the volume property has
// changed (i.e. at the end of the user interaction), whereas
// 'VolumePropertyChangingCommand' is invoked when the volume property is
// changing (i.e. during the user interaction itself).
// The need for a '...ChangedCommand' and '...ChangingCommand' can be
// explained as follows: the former can be used to be notified about any
// changes made to this widget *after* the corresponding user interaction has
// been performed (say, after releasing the mouse button that was dragging
// a slider, or after clicking on a checkbutton). The later can be set
// *additionally* to be notified about the intermediate changes that
// occur *during* the corresponding user interaction (say, *while* dragging
// a slider). While setting '...ChangedCommand' is enough to be notified
// about any changes, setting '...ChangingCommand' is an application-specific
// choice that is likely to depend on how fast you want (or can) answer to
// rapid changes occuring during a user interaction, if any.
// The 'object' argument is the object that will have the method called on
// it. The 'method' argument is the name of the method to be called and any
// arguments in string form. If the object is NULL, the method is still
// evaluated as a simple command.
virtual void SetVolumePropertyChangedCommand(
vtkObject *object,const char *method);
virtual void SetVolumePropertyChangingCommand(
vtkObject *object,const char *method);
// Description:
// Set/Get whether the above commands should be called or not.
vtkSetMacro(DisableCommands, int);
vtkGetMacro(DisableCommands, int);
vtkBooleanMacro(DisableCommands, int);
// Description:
// Set the method used to compute the whole range of the various transfer
// function editors. If set to Data, the scalar range of the data is used.
// If no data is available or set to FunctionPoints, the range of the
// function points already in the editor is used. If set to
// DataAndFunctionPointsthe the largest of the two ranges mentioned
// previously is used.
//BTX
enum
{
WholeRangeComputationMethodData = 1,
WholeRangeComputationMethodFunctionPoints = 2,
WholeRangeComputationMethodDataAndFunctionPoints = 3
};
//ETX
virtual void SetWholeRangeComputationMethod(int);
vtkGetMacro(WholeRangeComputationMethod, int);
virtual void SetWholeRangeComputationMethodToData();
virtual void SetWholeRangeComputationMethodToFunctionPoints();
virtual void SetWholeRangeComputationMethodToDataAndFunctionPoints();
// Description:
// Access the objects
vtkGetObjectMacro(ScalarOpacityFunctionEditor, vtkKWPiecewiseFunctionEditor);
vtkGetObjectMacro(ScalarColorFunctionEditor, vtkKWColorTransferFunctionEditor);
vtkGetObjectMacro(GradientOpacityFunctionEditor, vtkKWPiecewiseFunctionEditor);
vtkGetObjectMacro(ScalarOpacityUnitDistanceScale, vtkKWScaleWithEntry);
vtkGetObjectMacro(HSVColorSelector, vtkKWHSVColorSelector);
vtkGetObjectMacro(MaterialPropertyWidget, vtkKWVolumeMaterialPropertyWidget);
// Description:
// Pack or repack the UI
virtual void Pack();
// Description:
// Update the "enable" state of the object and its internal parts.
// Depending on different Ivars (this->Enabled, the application's
// Limited Edition Mode, etc.), the "enable" state of the object is updated
// and propagated to its internal parts/subwidgets. This will, for example,
// enable/disable parts of the widget UI, enable/disable the visibility
// of 3D widgets, etc.
virtual void UpdateEnableState();
// Description:
// Callbacks. Internal, do not use.
virtual void SelectedComponentCallback(int);
virtual void InterpolationTypeCallback(int type);
virtual void EnableShadingCallback(int state);
virtual void MaterialPropertyChangedCallback();
virtual void MaterialPropertyChangingCallback();
virtual void InteractiveApplyCallback(int state);
virtual void ScalarOpacityFunctionChangedCallback();
virtual void ScalarOpacityFunctionChangingCallback();
virtual void DoubleClickOnScalarOpacityPointCallback(int id);
virtual void WindowLevelModeCallback(int mode);
virtual void LockOpacityAndColorCallback(int state);
virtual void ScalarOpacityUnitDistanceChangedCallback(double value);
virtual void ScalarOpacityUnitDistanceChangingCallback(double value);
virtual void RGBTransferFunctionChangedCallback();
virtual void RGBTransferFunctionChangingCallback();
virtual void RGBTransferFunctionSelectionChangedCallback();
virtual void EnableGradientOpacityCallback(int val);
virtual void GradientOpacityFunctionChangedCallback();
virtual void GradientOpacityFunctionChangingCallback();
virtual void HSVColorSelectionChangedCallback(double h, double s, double v);
virtual void HSVColorSelectionChangingCallback(double h, double s, double v);
virtual void ComponentWeightChangedCallback(int index, double value);
virtual void ComponentWeightChangingCallback(int index, double value);
protected:
vtkKWVolumePropertyWidget();
~vtkKWVolumePropertyWidget();
// Description:
// Create the widget.
virtual void CreateWidget();
vtkVolumeProperty *VolumeProperty;
vtkDataSet *DataSet;
vtkKWHistogramSet *HistogramSet;
int SelectedComponent;
int DisableCommands;
int EnableShadingForAllComponents;
int MaterialPropertyPosition;
int WholeRangeComputationMethod;
int InteractiveApplyMode;
int InteractiveApplyButtonVisibility;
int ScalarOpacityUnitDistanceVisibility;
int HSVColorSelectorVisibility;
int ComponentSelectionVisibility;
int InterpolationTypeVisibility;
int MaterialPropertyVisibility;
int GradientOpacityFunctionVisibility;
int ComponentWeightsVisibility;
int UseScalarColorFunctionInScalarOpacityEditor;
// Commands
char *VolumePropertyChangedCommand;
char *VolumePropertyChangingCommand;
virtual void InvokeObjectMethodCommand(const char *command);
virtual void InvokeVolumePropertyChangedCommand();
virtual void InvokeVolumePropertyChangingCommand();
// GUI
vtkKWFrameWithLabel *EditorFrame;
vtkKWHSVColorSelector *HSVColorSelector;
vtkKWFrame *InnerLeftFrame;
vtkKWScalarComponentSelectionWidget *ComponentSelectionWidget;
vtkKWMenuButtonWithLabel *InterpolationTypeOptionMenu;
vtkKWVolumeMaterialPropertyWidget *MaterialPropertyWidget;
vtkKWCheckButton *EnableShadingCheckButton;
vtkKWCheckButton *InteractiveApplyCheckButton;
vtkKWPiecewiseFunctionEditor *ScalarOpacityFunctionEditor;
vtkKWScaleWithEntry *ScalarOpacityUnitDistanceScale;
vtkKWColorTransferFunctionEditor *ScalarColorFunctionEditor;
vtkKWCheckButton *LockOpacityAndColorCheckButton;
vtkKWPiecewiseFunctionEditor *GradientOpacityFunctionEditor;
vtkKWMenuButton *EnableGradientOpacityOptionMenu;
vtkKWScaleWithEntrySetWithLabel *ComponentWeightScaleSet;
vtkKWFrame *BottomFrame;
int LockOpacityAndColor[VTK_MAX_VRCOMP];
int WindowLevelMode[VTK_MAX_VRCOMP];
// Are the components independent of each other?
virtual int GetIndependentComponents();
// Update HSV selector
virtual void UpdateHSVColorSelectorFromScalarColorFunctionEditor();
// This methods will be overriden in subclasses so that something
// different than the DataSet ivar will be used to compute the
// corresponding items
virtual int GetNumberOfComponents();
virtual int GetDataSetScalarRange(int comp, double range[2]);
virtual int GetDataSetAdjustedScalarRange(int comp, double range[2]);
virtual const char* GetDataSetScalarName();
virtual int GetDataSetScalarOpacityUnitDistanceRangeAndResolution(
double range[2], double *resolution);
private:
vtkKWVolumePropertyWidget(const vtkKWVolumePropertyWidget&); // Not implemented
void operator=(const vtkKWVolumePropertyWidget&); // Not implemented
};
#endif
|