21#ifndef __qMRMLSegmentsModel_h
22#define __qMRMLSegmentsModel_h
25#include <QStandardItemModel>
29#include <ctkVTKObject.h>
32#include "qSlicerSegmentationsModuleWidgetsExport.h"
34class qMRMLSegmentsModelPrivate;
103 QModelIndexList
indexes(QString segmentID)
const;
136 virtual Qt::ItemFlags
segmentFlags(QString segmentID,
int column)
const;
159 static void onEvent(vtkObject* caller,
unsigned long event,
void* clientData,
void* callData);
176 QScopedPointer<qMRMLSegmentsModelPrivate>
d_ptr;
void setColorColumn(int column)
int opacityColumn() const
int visibilityColumn() const
virtual void updateFromSegments()
Updates all items from the segments in the segmentation model.
void setStatusColumn(int column)
virtual void onSegmentAdded(QString segmentID)
Called when a segment is added to the segmentation node.
virtual void onSegmentRemoved(QString segmentID)
Called when a segment is removed from the segmentation node.
virtual void rebuildFromSegments()
Removes all items and regenerates the model from the segments in the segmentation node.
QModelIndex indexFromSegmentID(QString segmentID, int column=0) const
Returns the index for the given segment ID.
QScopedPointer< qMRMLSegmentsModelPrivate > d_ptr
int layerColumn
Control in which column the segment layer is displayed (qMRMLSegmentsModel::LayerRole).
vtkMRMLSegmentationNode * segmentationNode() const
The segmentation node that is used to populate the model.
virtual void updateItemDataFromSegment(QStandardItem *item, QString segmentID, int column)
Update QStandardItem data associated using segmentID and column.
QModelIndexList indexes(QString segmentID) const
Return all the QModelIndexes (all the columns) for a given segment ID.
QString segmentIDFromIndex(const QModelIndex &index) const
Returns the segment ID for the given index.
void setVisibilityColumn(int column)
QStandardItemModel Superclass
virtual void onItemChanged(QStandardItem *item)
Invoked when an item in the model is changed.
void updateItemsFromSegmentID(QString segmentID)
Update all of the the QStandardItem associated with a segment ID.
static Q_INVOKABLE QString terminologyTooltipForSegment(vtkSegment *segment)
Assemble terminology info string (for tooltips) from a segment's terminology tags.
virtual void updateItemFromSegment(QStandardItem *item, QString segmentID, int column)
Update QStandardItem associated using segmentID and column.
void updateItemsFromColumnIndex(int column)
Update all of the the QStandardItem associated with a column.
QString segmentIDFromItem(QStandardItem *item) const
Returns the segment ID for the given item.
void requestSelectItems(QList< vtkIdType > itemIDs)
Signal requesting selecting items in the tree.
void setOpacityColumn(int column)
void reorderItems()
Rearrange the order of the rows to match the indices of the segments in the MRML node.
virtual void updateSegmentFromItem(QString segmentID, QStandardItem *item)
Update a segment in the MRML node using the associated QStandardItem.
~qMRMLSegmentsModel() override
QStandardItem * itemFromSegmentID(QString segmentID, int column=0) const
Returns the item for the given segment ID.
qMRMLSegmentsModel(QObject *parent=nullptr)
int opacityColumn
Control in which column the segment opacity is displayed (Qt::EditRole).
QVTK_OBJECT int nameColumn
Control in which column the segment name is displayed.
qMRMLSegmentsModel(qMRMLSegmentsModelPrivate *pimpl, QObject *parent=nullptr)
void segmentAboutToBeModified(const QString &segmentID)
static void onEvent(vtkObject *caller, unsigned long event, void *clientData, void *callData)
void setNameColumn(int column)
virtual int maxColumnId() const
Must be reimplemented in subclasses that add new column types.
void setLayerColumn(int layer)
int statusColumn
Control in which column the segment status is displayed (qMRMLSegmentsModel::StatusRole).
virtual void onSegmentOrderModified()
Called when a the order of segment in the segmentation node is modified.
virtual void setSegmentationNode(vtkMRMLSegmentationNode *segmentation)
virtual void onSegmentModified(QString segmentID)
Called when a segment is modified in the segmentation node.
virtual Qt::ItemFlags segmentFlags(QString segmentID, int column) const
virtual void onDisplayNodeModified()
Called when the vtkMRMLSegmentationDisplayNode is modified.
virtual void updateSegmentFromItemData(QString segmentID, QStandardItem *item)
Update a segment in the MRML node using the associated QStandardItem data.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node containing segmentations.
This class encapsulates a segment that is part of a segmentation.