Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes
qMRMLSegmentsModel Class Reference

Item model for segments. More...

#include <Modules/Loadable/Segmentations/Widgets/qMRMLSegmentsModel.h>

Inheritance diagram for qMRMLSegmentsModel:
Inheritance graph
[legend]
Collaboration diagram for qMRMLSegmentsModel:
Collaboration graph
[legend]

Public Types

enum  SegmentTableItemDataRole { SegmentIDRole = Qt::UserRole + 1, IndexRole, VisibilityRole, StatusRole }
 
typedef QStandardItemModel Superclass
 

Properties

int colorColumn
 
int layerColumn
 Control in which column the segment layer is displayed (qMRMLSegmentsModel::LayerRole). More...
 
int nameColumn
 Control in which column the segment name is displayed. More...
 
int opacityColumn
 Control in which column the segment opacity is displayed (Qt::EditRole). More...
 
int statusColumn
 Control in which column the segment status is displayed (qMRMLSegmentsModel::StatusRole). More...
 
int visibilityColumn
 

Signals

void requestSelectItems (QList< vtkIdType > itemIDs)
 Signal requesting selecting items in the tree. More...
 
void segmentAboutToBeModified (const QString &segmentID)
 

Public Member Functions

int colorColumn () const
 
QModelIndexList indexes (QString segmentID) const
 Return all the QModelIndexes (all the columns) for a given segment ID. More...
 
QModelIndex indexFromSegmentID (QString segmentID, int column=0) const
 
QStandardItem * itemFromSegmentID (QString segmentID, int column=0) const
 
int layerColumn () const
 
int nameColumn () const
 
int opacityColumn () const
 
 qMRMLSegmentsModel (QObject *parent=nullptr)
 
vtkMRMLSegmentationNodesegmentationNode () const
 The segmentation node that is used to populate the model. More...
 
QString segmentIDFromIndex (const QModelIndex &index) const
 Returns the segment ID for the given index. More...
 
QString segmentIDFromItem (QStandardItem *item) const
 
void setColorColumn (int column)
 
void setLayerColumn (int layer)
 
void setNameColumn (int column)
 
void setOpacityColumn (int column)
 
virtual void setSegmentationNode (vtkMRMLSegmentationNode *segmentation)
 
void setStatusColumn (int column)
 
void setVisibilityColumn (int column)
 
int statusColumn () const
 
int visibilityColumn () const
 
 ~qMRMLSegmentsModel () override
 

Static Public Member Functions

static Q_INVOKABLE QString terminologyTooltipForSegment (vtkSegment *segment)
 Assemble terminology info string (for tooltips) from a segment's terminology tags. More...
 

Protected Slots

virtual void onItemChanged (QStandardItem *item)
 Invoked when an item in the model is changed. More...
 
void updateColumnCount ()
 

Protected Member Functions

virtual int maxColumnId () const
 Must be reimplemented in subclasses that add new column types. More...
 
virtual void onDisplayNodeModified ()
 Called when the vtkMRMLSegmentationDisplayNode is modified. More...
 
virtual void onSegmentAdded (QString segmentID)
 Called when a segment is added to the segmentation node. More...
 
virtual void onSegmentModified (QString segmentID)
 Called when a segment is modified in the segmentation node. More...
 
virtual void onSegmentOrderModified ()
 Called when a the order of segment in the segmentation node is modified. More...
 
virtual void onSegmentRemoved (QString segmentID)
 Called when a segment is removed from the segmentation node. More...
 
 qMRMLSegmentsModel (qMRMLSegmentsModelPrivate *pimpl, QObject *parent=nullptr)
 
virtual void rebuildFromSegments ()
 Removes all items and regenerates the model from the segments in the segmentation node. More...
 
void reorderItems ()
 Rearrange the order of the rows to match the indices of the segments in the MRML node. More...
 
virtual Qt::ItemFlags segmentFlags (QString segmentID, int column) const
 
virtual void updateFromSegments ()
 Updates all items from the segments in the segmentation model. More...
 
virtual void updateItemDataFromSegment (QStandardItem *item, QString segmentID, int column)
 Update QStandardItem data associated using segmentID and column. More...
 
virtual void updateItemFromSegment (QStandardItem *item, QString segmentID, int column)
 Update QStandardItem associated using segmentID and column. More...
 
void updateItemsFromColumnIndex (int column)
 Update all of the the QStandardItem associated with a column. More...
 
void updateItemsFromSegmentID (QString segmentID)
 Update all of the the QStandardItem associated with a segment ID. More...
 
virtual void updateSegmentFromItem (QString segmentID, QStandardItem *item)
 Update a segment in the MRML node using the associated QStandardItem. More...
 
virtual void updateSegmentFromItemData (QString segmentID, QStandardItem *item)
 Update a segment in the MRML node using the associated QStandardItem data. More...
 

Static Protected Member Functions

static void onEvent (vtkObject *caller, unsigned long event, void *clientData, void *callData)
 

Protected Attributes

QScopedPointer< qMRMLSegmentsModelPrivate > d_ptr
 

Detailed Description

Item model for segments.

Associated with a vtkMRMLSegmentation node. This model creates one model item for each segment in the vtkSegmentation. Individual segment items are updated only if the associated segment is updated (vtkSegmentation::SegmentModified)

Definition at line 46 of file qMRMLSegmentsModel.h.

Member Typedef Documentation

◆ Superclass

typedef QStandardItemModel qMRMLSegmentsModel::Superclass

Definition at line 76 of file qMRMLSegmentsModel.h.

Member Enumeration Documentation

◆ SegmentTableItemDataRole

Enumerator
SegmentIDRole 
IndexRole 
VisibilityRole 
StatusRole 

Definition at line 68 of file qMRMLSegmentsModel.h.

Property Documentation

◆ colorColumn

int qMRMLSegmentsModel::colorColumn
readwrite

Control in which column the segment color is displayed (qMRMLSegmentsModel::VisibilityRole). A value of -1 (default) hides the column

Definition at line 58 of file qMRMLSegmentsModel.h.

◆ layerColumn

int qMRMLSegmentsModel::layerColumn
readwrite

Control in which column the segment layer is displayed (qMRMLSegmentsModel::LayerRole).

Definition at line 64 of file qMRMLSegmentsModel.h.

◆ nameColumn

int qMRMLSegmentsModel::nameColumn
readwrite

Control in which column the segment name is displayed.

Definition at line 52 of file qMRMLSegmentsModel.h.

◆ opacityColumn

int qMRMLSegmentsModel::opacityColumn
readwrite

Control in which column the segment opacity is displayed (Qt::EditRole).

Definition at line 60 of file qMRMLSegmentsModel.h.

◆ statusColumn

int qMRMLSegmentsModel::statusColumn
readwrite

Control in which column the segment status is displayed (qMRMLSegmentsModel::StatusRole).

Definition at line 62 of file qMRMLSegmentsModel.h.

◆ visibilityColumn

int qMRMLSegmentsModel::visibilityColumn
readwrite

Control in which column the segment visibility is displayed (Qt::DecorationRole). A value of -1 (default) hides the column

Definition at line 55 of file qMRMLSegmentsModel.h.

Constructor & Destructor Documentation

◆ qMRMLSegmentsModel() [1/2]

qMRMLSegmentsModel::qMRMLSegmentsModel ( QObject *  parent = nullptr)

◆ ~qMRMLSegmentsModel()

qMRMLSegmentsModel::~qMRMLSegmentsModel ( )
override

◆ qMRMLSegmentsModel() [2/2]

qMRMLSegmentsModel::qMRMLSegmentsModel ( qMRMLSegmentsModelPrivate *  pimpl,
QObject *  parent = nullptr 
)
protected

Member Function Documentation

◆ colorColumn()

int qMRMLSegmentsModel::colorColumn ( ) const

◆ indexes()

QModelIndexList qMRMLSegmentsModel::indexes ( QString  segmentID) const

Return all the QModelIndexes (all the columns) for a given segment ID.

◆ indexFromSegmentID()

QModelIndex qMRMLSegmentsModel::indexFromSegmentID ( QString  segmentID,
int  column = 0 
) const

◆ itemFromSegmentID()

QStandardItem* qMRMLSegmentsModel::itemFromSegmentID ( QString  segmentID,
int  column = 0 
) const

◆ layerColumn()

int qMRMLSegmentsModel::layerColumn ( ) const

◆ maxColumnId()

virtual int qMRMLSegmentsModel::maxColumnId ( ) const
protectedvirtual

Must be reimplemented in subclasses that add new column types.

◆ nameColumn()

int qMRMLSegmentsModel::nameColumn ( ) const

◆ onDisplayNodeModified()

virtual void qMRMLSegmentsModel::onDisplayNodeModified ( )
protectedvirtual

Called when the vtkMRMLSegmentationDisplayNode is modified.

◆ onEvent()

static void qMRMLSegmentsModel::onEvent ( vtkObject *  caller,
unsigned long  event,
void *  clientData,
void *  callData 
)
staticprotected

◆ onItemChanged

virtual void qMRMLSegmentsModel::onItemChanged ( QStandardItem *  item)
protectedvirtualslot

Invoked when an item in the model is changed.

◆ onSegmentAdded()

virtual void qMRMLSegmentsModel::onSegmentAdded ( QString  segmentID)
protectedvirtual

Called when a segment is added to the segmentation node.

◆ onSegmentModified()

virtual void qMRMLSegmentsModel::onSegmentModified ( QString  segmentID)
protectedvirtual

Called when a segment is modified in the segmentation node.

◆ onSegmentOrderModified()

virtual void qMRMLSegmentsModel::onSegmentOrderModified ( )
protectedvirtual

Called when a the order of segment in the segmentation node is modified.

◆ onSegmentRemoved()

virtual void qMRMLSegmentsModel::onSegmentRemoved ( QString  segmentID)
protectedvirtual

Called when a segment is removed from the segmentation node.

◆ opacityColumn()

int qMRMLSegmentsModel::opacityColumn ( ) const

◆ rebuildFromSegments()

virtual void qMRMLSegmentsModel::rebuildFromSegments ( )
protectedvirtual

Removes all items and regenerates the model from the segments in the segmentation node.

◆ reorderItems()

void qMRMLSegmentsModel::reorderItems ( )
protected

Rearrange the order of the rows to match the indices of the segments in the MRML node.

◆ requestSelectItems

void qMRMLSegmentsModel::requestSelectItems ( QList< vtkIdType >  itemIDs)
signal

Signal requesting selecting items in the tree.

◆ segmentAboutToBeModified

void qMRMLSegmentsModel::segmentAboutToBeModified ( const QString &  segmentID)
signal

Emitted when a segment property (e.g., name) is about to be changed. Can be used for capturing the current state of the segment, before it is modified.

◆ segmentationNode()

vtkMRMLSegmentationNode* qMRMLSegmentsModel::segmentationNode ( ) const

The segmentation node that is used to populate the model.

◆ segmentFlags()

virtual Qt::ItemFlags qMRMLSegmentsModel::segmentFlags ( QString  segmentID,
int  column 
) const
protectedvirtual

◆ segmentIDFromIndex()

QString qMRMLSegmentsModel::segmentIDFromIndex ( const QModelIndex &  index) const

Returns the segment ID for the given index.

◆ segmentIDFromItem()

QString qMRMLSegmentsModel::segmentIDFromItem ( QStandardItem *  item) const

◆ setColorColumn()

void qMRMLSegmentsModel::setColorColumn ( int  column)

◆ setLayerColumn()

void qMRMLSegmentsModel::setLayerColumn ( int  layer)

◆ setNameColumn()

void qMRMLSegmentsModel::setNameColumn ( int  column)

◆ setOpacityColumn()

void qMRMLSegmentsModel::setOpacityColumn ( int  column)

◆ setSegmentationNode()

virtual void qMRMLSegmentsModel::setSegmentationNode ( vtkMRMLSegmentationNode segmentation)
virtual

◆ setStatusColumn()

void qMRMLSegmentsModel::setStatusColumn ( int  column)

◆ setVisibilityColumn()

void qMRMLSegmentsModel::setVisibilityColumn ( int  column)

◆ statusColumn()

int qMRMLSegmentsModel::statusColumn ( ) const

◆ terminologyTooltipForSegment()

static Q_INVOKABLE QString qMRMLSegmentsModel::terminologyTooltipForSegment ( vtkSegment segment)
static

Assemble terminology info string (for tooltips) from a segment's terminology tags.

◆ updateColumnCount

void qMRMLSegmentsModel::updateColumnCount ( )
protectedslot

Recompute the number of columns in the model. Called when a [some]Column property is set. Needs maxColumnId() to be reimplemented in subclasses

◆ updateFromSegments()

virtual void qMRMLSegmentsModel::updateFromSegments ( )
protectedvirtual

Updates all items from the segments in the segmentation model.

◆ updateItemDataFromSegment()

virtual void qMRMLSegmentsModel::updateItemDataFromSegment ( QStandardItem *  item,
QString  segmentID,
int  column 
)
protectedvirtual

Update QStandardItem data associated using segmentID and column.

◆ updateItemFromSegment()

virtual void qMRMLSegmentsModel::updateItemFromSegment ( QStandardItem *  item,
QString  segmentID,
int  column 
)
protectedvirtual

Update QStandardItem associated using segmentID and column.

◆ updateItemsFromColumnIndex()

void qMRMLSegmentsModel::updateItemsFromColumnIndex ( int  column)
protected

Update all of the the QStandardItem associated with a column.

◆ updateItemsFromSegmentID()

void qMRMLSegmentsModel::updateItemsFromSegmentID ( QString  segmentID)
protected

Update all of the the QStandardItem associated with a segment ID.

◆ updateSegmentFromItem()

virtual void qMRMLSegmentsModel::updateSegmentFromItem ( QString  segmentID,
QStandardItem *  item 
)
protectedvirtual

Update a segment in the MRML node using the associated QStandardItem.

◆ updateSegmentFromItemData()

virtual void qMRMLSegmentsModel::updateSegmentFromItemData ( QString  segmentID,
QStandardItem *  item 
)
protectedvirtual

Update a segment in the MRML node using the associated QStandardItem data.

◆ visibilityColumn()

int qMRMLSegmentsModel::visibilityColumn ( ) const

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLSegmentsModelPrivate> qMRMLSegmentsModel::d_ptr
protected

Definition at line 176 of file qMRMLSegmentsModel.h.


The documentation for this class was generated from the following file: