Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLIOOptionsDescription.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
18#ifndef __vtkMRMLIOOptionsDescription_h
19#define __vtkMRMLIOOptionsDescription_h
20
21#include "vtkMRMLLogicExport.h"
22
23#include <vtkObject.h>
24#include <vtkSmartPointer.h>
25#include <vtkVariant.h>
26
27#include <string>
28#include <vector>
29
31
38class VTK_MRML_LOGIC_EXPORT vtkMRMLIOOptionsDescription : public vtkObject
39{
40public:
42 vtkTypeMacro(vtkMRMLIOOptionsDescription, vtkObject);
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
48
52
54 std::string GetFileName();
56 std::vector<std::string> GetFileNames();
57
59
60 void AddBoolOption(const std::string& property, const std::string& label, const std::string& toolTip, bool defaultValue);
61 void AddIntOption(const std::string& property, const std::string& label, const std::string& toolTip, int defaultValue, int minimum, int maximum);
62 void AddDoubleOption(const std::string& property, //
63 const std::string& label,
64 const std::string& toolTip,
65 double defaultValue,
66 double minimum,
67 double maximum,
68 int decimals);
69 void AddStringOption(const std::string& property, const std::string& label, const std::string& toolTip, const std::string& defaultValue);
70 void AddStringListOption(const std::string& property,
71 const std::string& label,
72 const std::string& toolTip,
73 const std::vector<std::string>& defaultValue,
74 const std::string& separator = ";");
76 void AddEnumOption(const std::string& property, const std::string& label, const std::string& toolTip, const vtkVariant& defaultValue);
77 void AddEnumChoice(const std::string& property, const vtkVariant& value, const std::string& label);
79 void AddNodeOption(const std::string& property,
80 const std::string& label,
81 const std::string& toolTip,
82 const std::string& defaultNodeID,
83 const std::vector<std::string>& nodeClasses,
84 bool noneEnabled);
86
88
89 void SetOptionEnabled(const std::string& property, bool enabled);
90 void SetOptionVisible(const std::string& property, bool visible);
92 void SetOptionWidget(const std::string& property, const std::string& widget);
94 void SetOptionShowHidden(const std::string& property, bool showHidden);
96
99 bool HasOption(const std::string& property);
102
105 vtkVariant GetOptionValue(const std::string& property);
107 bool GetBoolOptionValue(const std::string& property, bool defaultValue = false);
108
111
113 int GetOptionIndex(const std::string& property);
114
116
119 std::string GetNthOptionProperty(int index);
121 std::string GetNthOptionType(int index);
122 std::string GetNthOptionLabel(int index);
123 std::string GetNthOptionToolTip(int index);
125 std::string GetNthOptionWidget(int index);
126 bool GetNthOptionEnabled(int index);
127 bool GetNthOptionVisible(int index);
131 vtkVariant GetNthOptionValue(int index);
133 std::vector<std::string> GetNthOptionStringListValue(int index);
135 std::string GetNthOptionSeparator(int index);
137 bool GetNthOptionHasRange(int index);
138 double GetNthOptionMinimum(int index);
139 double GetNthOptionMaximum(int index);
141 int GetNthOptionDecimals(int index);
144 vtkVariant GetNthOptionChoiceValue(int index, int choiceIndex);
145 std::string GetNthOptionChoiceLabel(int index, int choiceIndex);
147 std::vector<std::string> GetNthOptionNodeClasses(int index);
148 bool GetNthOptionNoneEnabled(int index);
149 bool GetNthOptionShowHidden(int index);
151
153 std::string ToJSON();
154
155protected:
158
159private:
161 void operator=(const vtkMRMLIOOptionsDescription&) = delete;
162
163 class vtkInternal;
164 vtkInternal* Internal;
165};
166
167#endif
vtkMRMLIOProperties * GetDefaults()
std::vector< std::string > GetFileNames()
Get all file names from the properties.
bool GetNthOptionHasRange(int index)
Returns true if the option has a range (int and double options).
void AddIntOption(const std::string &property, const std::string &label, const std::string &toolTip, int defaultValue, int minimum, int maximum)
int GetNthOptionDecimals(int index)
Number of decimals of a double option. Returns -1 if not specified.
std::string GetNthOptionType(int index)
Option type: "bool", "int", "double", "string", "stringList", "enum", or "node".
double GetNthOptionMinimum(int index)
std::vector< std::string > GetNthOptionNodeClasses(int index)
Node classes, whether "None" can be selected, and whether hidden nodes are shown (node options).
std::string GetFileName()
Get the file name from the properties. If multiple file names are specified then the first one is ret...
std::string GetNthOptionToolTip(int index)
void SetOptionEnabled(const std::string &property, bool enabled)
Set additional attributes of an option.
void SetOptionShowHidden(const std::string &property, bool showHidden)
Show nodes that are hidden from editors in node selectors.
void AddDoubleOption(const std::string &property, const std::string &label, const std::string &toolTip, double defaultValue, double minimum, double maximum, int decimals)
void SetOptionWidget(const std::string &property, const std::string &widget)
Hint for choosing a specific widget (for example "colorTable").
bool GetNthOptionNoneEnabled(int index)
void RemoveAllOptions()
Remove all options.
int GetNthOptionNumberOfChoices(int index)
Choices of an enum option.
void SetDefaults(vtkMRMLIOProperties *defaults)
Default values specified by the application (for example, from user settings).
bool GetNthOptionEnabled(int index)
void AddEnumChoice(const std::string &property, const vtkVariant &value, const std::string &label)
int GetOptionIndex(const std::string &property)
Get index of the option that sets the specified property. Returns -1 if not found.
static vtkMRMLIOOptionsDescription * New()
std::string ToJSON()
Get the description of all options as JSON.
bool GetNthOptionVisible(int index)
vtkVariant GetNthOptionChoiceValue(int index, int choiceIndex)
std::string GetNthOptionChoiceLabel(int index, int choiceIndex)
vtkVariant GetNthOptionValue(int index)
std::string GetNthOptionLabel(int index)
void AddNodeOption(const std::string &property, const std::string &label, const std::string &toolTip, const std::string &defaultNodeID, const std::vector< std::string > &nodeClasses, bool noneEnabled)
Add an option for selecting a MRML node. The value is the node ID.
void AddStringOption(const std::string &property, const std::string &label, const std::string &toolTip, const std::string &defaultValue)
void SetProperties(vtkMRMLIOProperties *properties)
Context and current values of options (for example, edited by the user). These values take precedence...
~vtkMRMLIOOptionsDescription() override
vtkMRMLIOProperties * GetProperties()
void SetOptionVisible(const std::string &property, bool visible)
void AddStringListOption(const std::string &property, const std::string &label, const std::string &toolTip, const std::vector< std::string > &defaultValue, const std::string &separator=";")
void PrintSelf(ostream &os, vtkIndent indent) override
bool HasOption(const std::string &property)
void AddBoolOption(const std::string &property, const std::string &label, const std::string &toolTip, bool defaultValue)
Add an option. If an option already exists for the property then it is replaced.
std::string GetNthOptionWidget(int index)
Hint for choosing a specific widget (for example "colorTable"). Empty if not specified.
void GetOptionValues(vtkMRMLIOProperties *values)
Get the effective values of all options. Options that have empty string or string list values are not...
std::vector< std::string > GetNthOptionStringListValue(int index)
Effective value of a string list option.
void AddEnumOption(const std::string &property, const std::string &label, const std::string &toolTip, const vtkVariant &defaultValue)
Add an option that can have one of the values added by AddEnumChoice().
bool GetBoolOptionValue(const std::string &property, bool defaultValue=false)
Effective value of a boolean option. Returns defaultValue if the option is not found.
std::string GetNthOptionProperty(int index)
int GetNumberOfOptions()
Number of options.
std::string GetNthOptionSeparator(int index)
Separator of items of a string list option.
double GetNthOptionMaximum(int index)
vtkVariant GetOptionValue(const std::string &property)
bool GetNthOptionShowHidden(int index)