21 #ifndef __qSlicerSegmentEditorAbstractEffect_h 22 #define __qSlicerSegmentEditorAbstractEffect_h 25 #include "qSlicerSegmentationsEditorEffectsExport.h" 35 #include "vtkWeakPointer.h" 37 class qSlicerSegmentEditorAbstractEffectPrivate;
48 class vtkRenderWindow;
49 class vtkRenderWindowInteractor;
69 Q_PROPERTY(QString name READ name WRITE setName)
74 Q_PROPERTY(
bool perSegment READ perSegment WRITE setPerSegment)
80 Q_PROPERTY(
bool requireSegments READ requireSegments WRITE setRequireSegments)
86 Q_PROPERTY(
bool showEffectCursorInSliceView READ showEffectCursorInSliceView WRITE setShowEffectCursorInSliceView)
90 Q_PROPERTY(
bool showEffectCursorInThreeDView READ showEffectCursorInThreeDView WRITE setShowEffectCursorInThreeDView)
106 ModificationModeRemoveAll
117 virtual QIcon
icon() {
return QIcon(); };
120 Q_INVOKABLE
virtual const QString
helpText()
const {
return QString(); };
127 Q_INVOKABLE
virtual void activate();
131 Q_INVOKABLE
virtual void deactivate();
134 Q_INVOKABLE
virtual bool active();
136 Q_INVOKABLE
virtual void modifySelectedSegmentByLabelmap(
vtkOrientedImageData* modifierLabelmap,
137 ModificationMode modificationMode,
const int modificationExtent[6],
bool bypassMasking =
false);
138 Q_INVOKABLE
virtual void modifySelectedSegmentByLabelmap(
vtkOrientedImageData* modifierLabelmap,
139 ModificationMode modificationMode,
bool bypassMasking =
false);
140 Q_INVOKABLE
virtual void modifySelectedSegmentByLabelmap(
vtkOrientedImageData* modifierLabelmap,
141 ModificationMode modificationMode,
QList<int> extent,
bool bypassMasking =
false);
142 Q_INVOKABLE
virtual void modifySegmentByLabelmap(
vtkMRMLSegmentationNode* segmentationNode,
const char* segmentID,
143 vtkOrientedImageData* modifierLabelmap, ModificationMode modificationMode,
bool bypassMasking =
false);
144 Q_INVOKABLE
virtual void modifySegmentByLabelmap(
vtkMRMLSegmentationNode* segmentationNode,
const char* segmentID,
145 vtkOrientedImageData* modifierLabelmap, ModificationMode modificationMode,
const int modificationExtent[6],
bool bypassMasking =
false);
157 virtual QCursor createCursor(
qMRMLWidget* viewWidget);
165 { Q_UNUSED(callerInteractor); Q_UNUSED(eid); Q_UNUSED(viewWidget);
return false; };
172 { Q_UNUSED(callerViewNode); Q_UNUSED(eid); Q_UNUSED(viewWidget); };
176 virtual void setMRMLDefaults() = 0;
195 virtual void updateGUIFromMRML() = 0;
199 virtual void updateMRMLFromGUI() = 0;
212 Q_INVOKABLE QFrame* optionsFrame();
215 Q_INVOKABLE QFormLayout* optionsLayout();
219 Q_INVOKABLE
void addActor2D(
qMRMLWidget* viewWidget, vtkActor2D* actor);
222 Q_INVOKABLE
void removeActor2D(
qMRMLWidget* viewWidget, vtkActor2D* actor);
226 Q_INVOKABLE
void addActor3D(
qMRMLWidget* viewWidget, vtkProp3D* actor);
229 Q_INVOKABLE
void removeActor3D(
qMRMLWidget* viewWidget, vtkProp3D* actor);
234 Q_INVOKABLE
void addOptionsWidget(QWidget* newOptionsWidget);
235 Q_INVOKABLE
void addOptionsWidget(QLayout* newOptionsWidget);
237 Q_INVOKABLE QWidget* addLabeledOptionsWidget(QString label, QWidget* newOptionsWidget);
238 Q_INVOKABLE QWidget* addLabeledOptionsWidget(QString label, QLayout* newOptionsWidget);
241 virtual QString name()
const;
244 virtual void setName(QString name);
247 virtual bool perSegment()
const;
250 virtual void setPerSegment(
bool perSegment);
253 virtual bool requireSegments()
const;
255 virtual void setRequireSegments(
bool requireSegments);
259 Q_INVOKABLE
void cursorOff(
qMRMLWidget* viewWidget);
261 Q_INVOKABLE
void cursorOn(
qMRMLWidget* viewWidget);
265 Q_INVOKABLE
void selectEffect(QString effectName);
271 void setCallbackSlots(QObject* receiver,
const char* selectEffectSlot,
const char* updateVolumeSlot,
const char* saveStateForUndoSlot);
280 Q_INVOKABLE QString parameter(QString name);
283 Q_INVOKABLE
int integerParameter(QString name);
286 Q_INVOKABLE
double doubleParameter(QString name);
291 Q_INVOKABLE
void setParameter(QString name, QString value);
294 Q_INVOKABLE
void setParameterDefault(QString name, QString value);
301 Q_INVOKABLE
void setCommonParameter(QString name, QString value);
304 Q_INVOKABLE
void setCommonParameterDefault(QString name, QString value);
309 Q_INVOKABLE
void setParameter(QString name,
int value);
312 Q_INVOKABLE
void setParameterDefault(QString name,
int value);
314 Q_INVOKABLE
void setCommonParameter(QString name,
int value);
317 Q_INVOKABLE
void setCommonParameterDefault(QString name,
int value);
322 Q_INVOKABLE
void setParameter(QString name,
double value);
325 Q_INVOKABLE
void setParameterDefault(QString name,
double value);
327 Q_INVOKABLE
void setCommonParameter(QString name,
double value);
330 Q_INVOKABLE
void setCommonParameterDefault(QString name,
double value);
335 Q_INVOKABLE
bool parameterDefined(QString name);
338 Q_INVOKABLE
bool commonParameterDefined(QString name);
345 Q_INVOKABLE
int confirmCurrentSegmentVisible();
359 void setShowEffectCursorInSliceView(
bool show);
360 void setShowEffectCursorInThreeDView(
bool show);
362 bool showEffectCursorInSliceView();
363 bool showEffectCursorInThreeDView();
374 Q_INVOKABLE
void saveStateForUndo();
377 Q_INVOKABLE
static vtkRenderWindow* renderWindow(
qMRMLWidget* viewWidget);
379 Q_INVOKABLE
static vtkRenderer* renderer(
qMRMLWidget* viewWidget);
386 Q_INVOKABLE
static QPoint rasToXy(QVector3D ras,
qMRMLSliceWidget* sliceWidget);
391 static void xyzToRas(
double inputXyz[3],
double outputRas[3],
qMRMLSliceWidget* sliceWidget);
393 Q_INVOKABLE
static QVector3D xyzToRas(QVector3D inputXyz,
qMRMLSliceWidget* sliceWidget);
395 static void xyToRas(QPoint xy,
double outputRas[3],
qMRMLSliceWidget* sliceWidget);
397 static void xyToRas(
double xy[2],
double outputRas[3],
qMRMLSliceWidget* sliceWidget);
399 Q_INVOKABLE
static QVector3D xyToRas(QPoint xy,
qMRMLSliceWidget* sliceWidget);
411 Q_INVOKABLE
static void forceRender(
qMRMLWidget* viewWidget);
412 Q_INVOKABLE
static void scheduleRender(
qMRMLWidget* viewWidget);
421 bool m_Active{
false};
427 bool m_PerSegment{
true};
429 bool m_RequireSegments{
true};
431 bool m_ShowEffectCursorInSliceView{
true};
432 bool m_ShowEffectCursorInThreeDView{
false};
434 double m_FillValue{1.0};
435 double m_EraseValue{0.0};
442 QScopedPointer<qSlicerSegmentEditorAbstractEffectPrivate>
d_ptr;
This class encapsulates a segment that is part of a segmentation.
vtkWeakPointer< vtkSegment > m_AlreadyConfirmedSegmentVisible
virtual void sourceVolumeNodeChanged()
virtual bool processInteractionEvents(vtkRenderWindowInteractor *callerInteractor, unsigned long eid, qMRMLWidget *viewWidget)
virtual Q_INVOKABLE const QString helpText() const
Get help text for effect to be displayed in the help box.
Abstract class for segment editor effects.
virtual void masterVolumeNodeChanged()
Deprecated. Override sourceVolumeNodeChanged() method instead.
Image data containing orientation information.
virtual void referenceGeometryChanged()
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
QString m_Name
Name of the effect.
Parameter set node for the segment editor widget.
virtual void setupOptionsFrame()
QScopedPointer< qSlicerSegmentEditorAbstractEffectPrivate > d_ptr
virtual void processViewNodeEvents(vtkMRMLAbstractViewNode *callerViewNode, unsigned long eid, qMRMLWidget *viewWidget)
virtual QIcon icon()
Get icon for effect to be displayed in segment editor.
virtual void layoutChanged()
Simple mechanism to let the effects know that the layout has changed.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...