KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWWindowLevelPresetSelector.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Copyright (c) 1998-2003 Kitware Inc. 469 Clifton Corporate Parkway,
4 Clifton Park, NY, 12065, USA.
5 
6 All rights reserved. No part of this software may be reproduced, distributed,
7 or modified, in any form or by any means, without permission in writing from
8 Kitware Inc.
9 
10 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
11 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
12 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
13 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 
15 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
16 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
17 PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
18 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
19 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20 
21 =========================================================================*/
22 // .NAME vtkKWWindowLevelPresetSelector - a window level preset selector.
23 // .SECTION Description
24 // This class is a widget that can be used to store and apply window/level
25 // presets.
26 // .SECTION Thanks
27 // This work is part of the National Alliance for Medical Image
28 // Computing (NAMIC), funded by the National Institutes of Health
29 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
30 // Information on the National Centers for Biomedical Computing
31 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
32 // .SECTION See Also
33 // vtkKWPresetSelector
34 
35 #ifndef __vtkKWWindowLevelPresetSelector_h
36 #define __vtkKWWindowLevelPresetSelector_h
37 
38 #include "vtkKWPresetSelector.h"
39 
40 class vtkKWWindowLevelPresetSelectorInternals;
41 
43 {
44 public:
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
49  // Description:
50  // Set/Get the window/level values for a given preset.
51  // Return 1 on success, 0 otherwise
52  virtual double GetPresetWindow(int id);
53  virtual int SetPresetWindow(int id, double window);
54  virtual double GetPresetLevel(int id);
55  virtual int SetPresetLevel(int id, double level);
56 
57  // Description:
58  // Set/Get the type for a given preset.
59  // The type column can be used, for example, to put the medical modality
60  // a specific presets applies to (say, CT, MR)
61  // The type field is not displayed as a column by default, but this
62  // can be changed using the SetTypeColumnVisibility() method.
63  // This column can not be edited.
64  // Return 1 on success, 0 otherwise
65  virtual int SetPresetType(int id, const char *type);
66  virtual const char* GetPresetType(int id);
67 
68  // Description:
69  // Set/Get the visibility of the type column. Hidden by default.
70  // No effect if called before Create().
71  virtual void SetTypeColumnVisibility(int);
72  virtual int GetTypeColumnVisibility();
73  vtkBooleanMacro(TypeColumnVisibility, int);
74 
75  // Description:
76  // Query if the pool has a given window/level preset in a group
77  virtual int HasPresetWithGroupWithWindowLevel(
78  const char *group, double window, double level);
79 
80  // Description:
81  // Most (if not all) of the information associated to a preset (say group,
82  // comment, filename, creation time, thumbnail and screenshot) is stored
83  // under the hood as user slots using the corresponding API (i.e.
84  // Set/GetPresetUserSlotAs...()). Since each slot requires a unique name,
85  // the following methods are provided to retrieve the slot name for
86  // the preset fields. This can be useful to avoid collision between
87  // the default slots and your own user slots. Note that the default slot
88  // names can be changed too, but doing so will not transfer the value
89  // stored at the old slot name to the new slot name (it is up to you to do
90  // so, if needed).
91  virtual void SetPresetTypeSlotName(const char *);
92  virtual const char* GetPresetTypeSlotName();
93 
94  // Description:
95  // Some constants
96  //BTX
97  static const char *WindowColumnName;
98  static const char *LevelColumnName;
99  static const char *TypeColumnName;
100  //ETX
101 
102  // Description:
103  // Callback invoked when the user ends editing a specific preset field
104  // located at cell ('row', 'col').
105  // The main purpose of this method is to perform a final validation of
106  // the edit window's contents 'text'.
107  // This method returns the value that is to become the new contents
108  // for that cell.
109  // The next step (updating) is handled by PresetCellUpdateCallback
110  virtual const char* PresetCellEditEndCallback(
111  int row, int col, const char *text);
112 
113  // Description:
114  // Callback invoked when the user successfully updated the preset field
115  // located at ('row', 'col') with the new contents 'text', as a result
116  // of editing the corresponding cell interactively.
117  virtual void PresetCellUpdatedCallback(int row, int col, const char *text);
118 
119 protected:
122 
123  // Description:
124  // Create the columns.
125  // Subclasses should override this method to add their own columns and
126  // display their own preset fields (do not forget to call the superclass
127  // first).
128  virtual void CreateColumns();
129 
130  // Description:
131  // Update the preset row, i.e. add a row for that preset if it is not
132  // displayed already, hide it if it does not match GroupFilter, and
133  // update the table columns with the corresponding preset fields.
134  // Subclass should override this method to display their own fields.
135  // Return 1 on success, 0 if the row was not (or can not be) updated.
136  // Subclasses should call the parent's UpdatePresetRow, and abort
137  // if the result is not 1.
138  virtual int UpdatePresetRow(int id);
139 
140  // Description:
141  // Get the index of a given column
142  virtual int GetWindowColumnIndex();
143  virtual int GetLevelColumnIndex();
144  virtual int GetTypeColumnIndex();
145 
146  // PIMPL Encapsulation for STL containers
147  //BTX
148  vtkKWWindowLevelPresetSelectorInternals *Internals;
149  //ETX
150 
151 private:
152 
154  void operator=(const vtkKWWindowLevelPresetSelector&); // Not implemented
155 };
156 
157 #endif