KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWVolumePropertyPresetSelector.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWVolumePropertyPresetSelector.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWVolumePropertyPresetSelector - a volume property preset selector.
15 // .SECTION Description
16 // This class is a widget that can be used to store and apply volume property
17 // presets.
18 // .SECTION Thanks
19 // This work is part of the National Alliance for Medical Image
20 // Computing (NAMIC), funded by the National Institutes of Health
21 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
22 // Information on the National Centers for Biomedical Computing
23 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
24 
25 #ifndef __vtkKWVolumePropertyPresetSelector_h
26 #define __vtkKWVolumePropertyPresetSelector_h
27 
28 #include "vtkKWPresetSelector.h"
29 
30 class vtkVolumeProperty;
31 class vtkKWVolumePropertyPresetSelectorInternals;
32 
34 {
35 public:
38  void PrintSelf(ostream& os, vtkIndent indent);
39 
40  // Description:
41  // Set/Get the volume property associated to the preset in the pool.
42  // Note that the volume property object passed as parameter is neither
43  // stored nor Register()'ed, only a copy is stored (and updated each
44  // time this method is called later on).
45  // Return 1 on success, 0 on error
46  virtual int SetPresetVolumeProperty(int id, vtkVolumeProperty *prop);
47  virtual vtkVolumeProperty* GetPresetVolumeProperty(int id);
48 
49  // Description:
50  // Set/Get the type for a given preset.
51  // The type column can be used, for example, to put the medical modality
52  // a specific presets applies to (say, CT, MR)
53  // The type field is not displayed as a column by default, but this
54  // can be changed using the SetTypeColumnVisibility() method.
55  // This column can not be edited.
56  // Return 1 on success, 0 otherwise
57  virtual int SetPresetType(int id, const char *type);
58  virtual const char* GetPresetType(int id);
59 
60  // Description:
61  // Set/Get if the volume property is designed with independent components
62  // in mind.
63  // IMPORTANT: this slot is a convenience slot that reflect the value
64  // of the vtkVolumeProperty's own IndependentComponents ivar. Each time
65  // the volume property preset is set (see SetPresetVolumeProperty), this
66  // slot is updated automatically, and vice-versa.
67  // It is provided for filtering purposes (i.e. so that you can use
68  // this slot in a preset filter constraint, and only show the presets
69  // that are relevant to your data, if it has independent components or not).
70  // Return 1 on success, 0 otherwise
71  virtual int GetPresetIndependentComponents(int id);
72  virtual int SetPresetIndependentComponents(int id, int flag);
73 
74  // Description:
75  // Set/Get if the volume property is designed with a specific blend mode
76  // in mind. Valid constants are the ones found in vtkVolumeMapper, i.e.
77  // vtkVolumeMapper::COMPOSITE_BLEND,
78  // vtkVolumeMapper::MAXIMUM_INTENSITY_BLEND,
79  // vtkVolumeMapper::MINIMUM_INTENSITY_BLEND.
80  // Return 1 on success, 0 otherwise
81  virtual int GetPresetBlendMode(int id);
82  virtual int SetPresetBlendMode(int id, int flag);
83  virtual int HasPresetBlendMode(int id);
84 
85  // Description:
86  // Set/Get if the normalized scalar values in the volume property are to
87  // be interpreted relative to an histogram of the scalars.
88  // Return 1 on success, 0 otherwise
89  virtual int GetPresetHistogramFlag(int id);
90  virtual int SetPresetHistogramFlag(int id, int flag);
91 
92  // Description:
93  // Query if the preset range falls inside a given range
94  // (the preset range is computed by checking the largest scalar range among
95  // the volume property transfer functions for component 0).
96  // Return 1 on success (or HistogramFlag is On), 0 on error
97  virtual int IsPresetRangeInsideRange(int id, double range[2]);
98 
99  // Description:
100  // Set/Get the visibility of the type column. Hidden by default.
101  // No effect if called before Create().
102  virtual void SetTypeColumnVisibility(int);
103  virtual int GetTypeColumnVisibility();
104  vtkBooleanMacro(TypeColumnVisibility, int);
105 
106  // Description:
107  // Add default normalized presets.
108  // The type parameter will be used to call SetPresetType on each new preset.
109  virtual void AddDefaultNormalizedPresets(const char *type);
110 
111  // Description:
112  // Add a preset filter constraint on the preset group field.
113  virtual void SetPresetFilterRangeConstraint(double range[2]);
114  virtual double* GetPresetFilterRangeConstraint();
115  virtual void DeletePresetFilterRangeConstraint();
116 
117  // Description:
118  // Query if a given preset matches the current preset filter constraints.
119  // Return 1 if match or if no filter was defined, 0 otherwise
120  // Override (augment) the superclass to handle range constraint (see
121  // SetPresetFilterRangeConstraint).
122  virtual int IsPresetFiltered(int id);
123 
124  // Description:
125  // Most (if not all) of the information associated to a preset (say group,
126  // comment, filename, creation time, thumbnail and screenshot) is stored
127  // under the hood as user slots using the corresponding API (i.e.
128  // Set/GetPresetUserSlotAs...()). Since each slot requires a unique name,
129  // the following methods are provided to retrieve the slot name for
130  // the preset fields. This can be useful to avoid collision between
131  // the default slots and your own user slots. Note that the default slot
132  // names can be changed too, but doing so will not transfer the value
133  // stored at the old slot name to the new slot name (it is up to you to do
134  // so, if needed).
135  virtual void SetPresetTypeSlotName(const char *);
136  virtual const char* GetPresetTypeSlotName();
137  virtual void SetPresetIndependentComponentsSlotName(const char *);
138  virtual const char* GetPresetIndependentComponentsSlotName();
139  virtual void SetPresetHistogramFlagSlotName(const char *);
140  virtual const char* GetPresetHistogramFlagSlotName();
141  virtual void SetPresetBlendModeSlotName(const char *);
142  virtual const char* GetPresetBlendModeSlotName();
143 
144  // Description:
145  // Some constants
146  //BTX
147  static const char *TypeColumnName;
148  //ETX
149 
150 protected:
153 
154  // Description:
155  // Create the columns.
156  // Subclasses should override this method to add their own columns and
157  // display their own preset fields (do not forget to call the superclass
158  // first).
159  virtual void CreateColumns();
160 
161  // Description:
162  // Update the preset row, i.e. add a row for that preset if it is not
163  // displayed already, hide it if it does not match GroupFilter, and
164  // update the table columns with the corresponding preset fields.
165  // Subclass should override this method to display their own fields.
166  // Return 1 on success, 0 if the row was not (or can not be) updated.
167  // Subclasses should call the parent's UpdatePresetRow, and abort
168  // if the result is not 1.
169  virtual int UpdatePresetRow(int id);
170 
171  // Description:
172  // Get the index of a given column.
173  virtual int GetTypeColumnIndex();
174 
175  // Description:
176  // Update the toolbar preset buttons state/visibility.
178 
179  // Description:
180  // Populate the pop-up context menu that is displayed when right-clicking
181  // on a give preset. It should replicate the commands available through the
182  // preset buttons.
183  virtual void PopulatePresetContextMenu(vtkKWMenu *menu, int id);
184 
185  // PIMPL Encapsulation for STL containers
186  //BTX
187  vtkKWVolumePropertyPresetSelectorInternals *Internals;
188  //ETX
189 
190 private:
191 
193  void operator=(const vtkKWVolumePropertyPresetSelector&); // Not implemented
194 };
195 
196 #endif