21 #ifndef __qMRMLSegmentsModel_h 22 #define __qMRMLSegmentsModel_h 25 #include <QStandardItemModel> 29 #include <ctkVTKObject.h> 32 #include "qSlicerSegmentationsModuleWidgetsExport.h" 34 class qMRMLSegmentsModelPrivate;
46 class Q_SLICER_MODULE_SEGMENTATIONS_WIDGETS_EXPORT
qMRMLSegmentsModel :
public QStandardItemModel
52 Q_PROPERTY (
int nameColumn READ nameColumn WRITE setNameColumn)
55 Q_PROPERTY (
int visibilityColumn READ visibilityColumn WRITE setVisibilityColumn)
58 Q_PROPERTY(
int colorColumn READ colorColumn WRITE setColorColumn)
60 Q_PROPERTY (
int opacityColumn READ opacityColumn WRITE setOpacityColumn)
62 Q_PROPERTY(
int statusColumn READ statusColumn WRITE setStatusColumn)
64 Q_PROPERTY(
int layerColumn READ layerColumn WRITE setLayerColumn)
70 SegmentIDRole = Qt::UserRole + 1,
80 int nameColumn()
const;
81 void setNameColumn(
int column);
82 int visibilityColumn()
const;
83 void setVisibilityColumn(
int column);
84 int colorColumn()
const;
85 void setColorColumn(
int column);
86 int opacityColumn()
const;
87 void setOpacityColumn(
int column);
88 int statusColumn()
const;
89 void setStatusColumn(
int column);
90 int layerColumn()
const;
91 void setLayerColumn(
int layer);
94 QString segmentIDFromIndex(
const QModelIndex &index)
const;
96 QString segmentIDFromItem(QStandardItem* item)
const;
98 QModelIndex indexFromSegmentID(QString segmentID,
int column=0)
const;
100 QStandardItem* itemFromSegmentID(QString segmentID,
int column=0)
const;
103 QModelIndexList indexes(QString segmentID)
const;
110 Q_INVOKABLE
static QString terminologyTooltipForSegment(
vtkSegment* segment);
115 void segmentAboutToBeModified(
const QString& segmentID);
122 virtual void onItemChanged(QStandardItem* item);
126 void updateColumnCount();
132 virtual void rebuildFromSegments();
134 virtual void updateFromSegments();
136 virtual Qt::ItemFlags segmentFlags(QString segmentID,
int column)
const;
139 virtual void updateItemFromSegment(QStandardItem* item, QString segmentID,
int column );
141 virtual void updateItemDataFromSegment(QStandardItem* item, QString segmentID,
int column );
143 virtual void updateSegmentFromItem(QString segmentID, QStandardItem* item );
145 virtual void updateSegmentFromItemData(QString segmentID, QStandardItem* item );
147 void updateItemsFromColumnIndex(
int column);
149 void updateItemsFromSegmentID(QString segmentID);
159 static void onEvent(vtkObject* caller,
unsigned long event,
void* clientData,
void* callData);
162 virtual int maxColumnId()
const;
165 virtual void onSegmentAdded(QString segmentID);
167 virtual void onSegmentRemoved(QString segmentID);
169 virtual void onSegmentModified(QString segmentID);
171 virtual void onSegmentOrderModified();
173 virtual void onDisplayNodeModified();
176 QScopedPointer<qMRMLSegmentsModelPrivate>
d_ptr;
This class encapsulates a segment that is part of a segmentation.
QScopedPointer< qMRMLSegmentsModelPrivate > d_ptr
A set of MRML Nodes that supports serialization and undo/redo.
QStandardItemModel Superclass
Abstract Superclass for all specific types of MRML nodes.
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...