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

#include <Modules/Loadable/Segmentations/Logic/vtkSlicerSegmentationsModuleLogic.h>

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

Public Types

enum  { MODE_REPLACE = 0, MODE_MERGE_MAX, MODE_MERGE_MIN, MODE_MERGE_MASK }
 
enum  SegmentStatus {
  NotStarted, InProgress, Completed, Flagged,
  LastStatus
}
 
typedef vtkSlicerModuleLogic Superclass
 
- Public Types inherited from vtkSlicerModuleLogic
typedef vtkMRMLAbstractLogic Superclass
 
- Public Types inherited from vtkMRMLAbstractLogic
typedef vtkObject Superclass
 
typedef void(vtkMRMLAbstractLogic::* TaskFunctionPointer) (void *clientdata)
 

Public Member Functions

virtual const char * GetClassName ()
 
vtkMRMLSegmentationNodeGetDefaultSegmentationNode ()
 Get default segmentation node. All new segmentation nodes are initialized to the content of this node. More...
 
bool GetDefaultSurfaceSmoothingEnabled ()
 Get/Set default closed surface smoothing enabled flag for new segmentation nodes. More...
 
bool ImportLabelmapToSegmentationNodeWithTerminology (vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLSegmentationNode *segmentationNode, std::string terminologyContextName, std::string insertBeforeSegmentId="")
 
virtual int IsA (const char *type)
 
vtkMRMLSegmentationNodeLoadSegmentationFromFile (const char *filename, bool autoOpacities=true, const char *nodeName=nullptr, vtkMRMLColorTableNode *colorTableNode=nullptr)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void SetDefaultSurfaceSmoothingEnabled (bool enabled)
 
bool SetTerminologyToSegmentationFromLabelmapNode (vtkMRMLSegmentationNode *segmentationNode, vtkMRMLLabelMapVolumeNode *labelmapNode, std::string terminologyContextName)
 
- Public Member Functions inherited from vtkSlicerModuleLogic
virtual vtkSlicerApplicationLogicGetApplicationLogic ()
 Get access to overall application state. More...
 
virtual vtkMRMLAbstractLogicGetModuleLogic (const char *moduleName)
 Convenience method for getting another module's logic from the application logic. More...
 
std::string GetModuleShareDirectory () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void SetModuleShareDirectory (const std::string &shareDirectory)
 
- Public Member Functions inherited from vtkMRMLAbstractLogic
virtual vtkMRMLApplicationLogicGetMRMLApplicationLogic () const
 Get access to overall application state. More...
 
vtkMRMLSceneGetMRMLScene () const
 Return a reference to the current MRML scene. More...
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual void SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic)
 
void SetMRMLScene (vtkMRMLScene *newScene)
 Set and observe the MRMLScene. More...
 

Static Public Member Functions

static bool ApplyParentTransformToOrientedImageData (vtkMRMLTransformableNode *transformableNode, vtkOrientedImageData *orientedImageData, bool linearInterpolation=false, double backgroundColor[4]=nullptr)
 
static bool ApplyParentTransformToPolyData (vtkMRMLTransformableNode *transformableNode, vtkPolyData *polyData)
 
static bool ClearSegment (vtkMRMLSegmentationNode *segmentationNode, std::string segmentID)
 Clear the contents of a single segment. More...
 
static void CollapseBinaryLabelmaps (vtkMRMLSegmentationNode *segmentationNode, bool forceToSingleLayer)
 
static bool CopyOrientedImageDataToVolumeNode (vtkOrientedImageData *orientedImageData, vtkMRMLVolumeNode *volumeNode, bool shallowCopy=true, bool shiftImageDataExtentToZeroStart=true)
 
static bool CreateLabelmapVolumeFromOrientedImageData (vtkOrientedImageData *orientedImageData, vtkMRMLLabelMapVolumeNode *labelmapVolumeNode)
 
static vtkOrientedImageDataCreateOrientedImageDataFromVolumeNode (vtkMRMLScalarVolumeNode *volumeNode, vtkMRMLTransformNode *outputParentTransformNode=nullptr)
 
static vtkDataObject * CreateRepresentationForOneSegment (vtkSegmentation *segmentation, std::string segmentID, std::string representationName)
 
static vtkSegmentCreateSegmentFromLabelmapVolumeNode (vtkMRMLLabelMapVolumeNode *labelmapVolumeNode, vtkMRMLSegmentationNode *segmentationNode=nullptr)
 
static vtkSegmentCreateSegmentFromModelNode (vtkMRMLModelNode *modelNode, vtkMRMLSegmentationNode *segmentationNode=nullptr)
 
static int DoesLabelmapContainSingleLabel (vtkMRMLLabelMapVolumeNode *labelmapVolumeNode)
 
static bool ExportAllSegmentsToLabelmapNode (vtkMRMLSegmentationNode *segmentationNode, vtkMRMLLabelMapVolumeNode *labelmapNode, int extentComputationMode=vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS)
 
static bool ExportAllSegmentsToModels (vtkMRMLSegmentationNode *segmentationNode, vtkIdType folderItemId)
 
static bool ExportSegmentsBinaryLabelmapRepresentationToFiles (std::string destinationFolder, vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *segmentIds=nullptr, std::string extension="nrrd", bool useCompression=false, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, int extentComputationMode=vtkSegmentation::EXTENT_REFERENCE_GEOMETRY, vtkMRMLColorTableNode *colorTableNode=nullptr)
 
static bool ExportSegmentsClosedSurfaceRepresentationToFiles (std::string destinationFolder, vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *segmentIds=nullptr, std::string fileFormat="STL", bool lps=true, double sizeScale=1.0, bool merge=false)
 
static bool ExportSegmentsToLabelmapNode (vtkMRMLSegmentationNode *segmentationNode, std::vector< std::string > &segmentIDs, vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, int extentComputationMode=vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS, vtkMRMLColorTableNode *colorTableNode=nullptr)
 
static bool ExportSegmentsToLabelmapNode (vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *segmentIDs, vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, int extentComputationMode=vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS, vtkMRMLColorTableNode *colorTableNode=nullptr)
 
static bool ExportSegmentsToModels (vtkMRMLSegmentationNode *segmentationNode, std::vector< std::string > &segmentIDs, vtkIdType folderItemId)
 
static bool ExportSegmentsToModels (vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *segmentIds, vtkIdType folderItemId)
 
static bool ExportSegmentToRepresentationNode (vtkSegment *segment, vtkMRMLNode *representationNode)
 
static bool ExportVisibleSegmentsToLabelmapNode (vtkMRMLSegmentationNode *segmentationNode, vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLVolumeNode *referenceVolumeNode=nullptr, int extentComputationMode=vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS)
 
static bool ExportVisibleSegmentsToModels (vtkMRMLSegmentationNode *segmentationNode, vtkIdType folderItemId)
 
static void GenerateMergedLabelmapInReferenceGeometry (vtkMRMLSegmentationNode *segmentationNode, vtkMRMLVolumeNode *referenceVolumeNode, vtkStringArray *segmentIDs, int extentComputationMode, vtkOrientedImageData *mergedLabelmap_Reference)
 
static void GetAllLabelValues (vtkIntArray *labels, vtkImageData *labelmap)
 Utility function that returns all non-empty label values in a labelmap. More...
 
static void GetLabelValuesFromColorNode (vtkMRMLSegmentationNode *segmentationNode, vtkMRMLColorTableNode *colorTableNode, vtkStringArray *segmentIds, vtkIntArray *labelValues)
 
static vtkMRMLSegmentationNodeGetSegmentationNodeForSegment (vtkMRMLScene *scene, vtkSegment *segment, std::string &segmentId)
 
static vtkMRMLSegmentationNodeGetSegmentationNodeForSegmentation (vtkMRMLScene *scene, vtkSegmentation *segmentation)
 
static vtkMRMLSegmentationNodeGetSegmentationNodeForSegmentSubjectHierarchyItem (vtkIdType segmentShItemID, vtkMRMLScene *scene)
 Utility function for getting the segmentation node for a segment subject hierarchy item. More...
 
static bool GetSegmentBinaryLabelmapRepresentation (vtkMRMLSegmentationNode *segmentationNode, std::string segmentID, vtkOrientedImageData *imageData, bool applyParentTransform=true)
 
static bool GetSegmentClosedSurfaceRepresentation (vtkMRMLSegmentationNode *segmentationNode, std::string segmentID, vtkPolyData *polyData, bool applyParentTransform=true)
 
static vtkSegmentGetSegmentForSegmentSubjectHierarchyItem (vtkIdType segmentShItemID, vtkMRMLScene *scene)
 Utility function for getting the segment object for a segment subject hierarchy item. More...
 
static bool GetSegmentRepresentation (vtkMRMLSegmentationNode *segmentationNode, std::string segmentID, std::string representationName, vtkDataObject *segmentRepresentation, bool applyParentTransform=true)
 
static int GetSegmentStatus (vtkSegment *segment)
 Returns the value of the status tag for the given segment. More...
 
static const char * GetSegmentStatusAsHumanReadableString (int segmentStatus)
 Get the human readable segment status from the SegmentStatus enum value. More...
 
static const char * GetSegmentStatusAsMachineReadableString (int segmentStatus)
 Get the machine readable segment status from the SegmentStatus enum value. More...
 
static int GetSegmentStatusFromMachineReadableString (std::string statusString)
 Get the enum segment status from a machine string. More...
 
static bool GetSharedSegmentIDsInMask (vtkMRMLSegmentationNode *segmentationNode, std::string sharedSegmentID, vtkOrientedImageData *mask, const int extent[6], std::vector< std::string > &segmentIDs, int maskThreshold=0.0, bool includeInputSharedSegmentID=false)
 
static const char * GetStatusTagName ()
 Returns the name of the status tag. More...
 
static bool GetTransformBetweenRepresentationAndSegmentation (vtkMRMLTransformableNode *representationNode, vtkMRMLSegmentationNode *segmentationNode, vtkGeneralTransform *representationToSegmentationTransform)
 
static bool ImportLabelmapToSegmentationNode (vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLSegmentationNode *segmentationNode, std::string insertBeforeSegmentId="")
 
static bool ImportLabelmapToSegmentationNode (vtkOrientedImageData *labelmapImage, vtkMRMLSegmentationNode *segmentationNode, std::string baseSegmentName="", std::string insertBeforeSegmentId="")
 
static bool ImportLabelmapToSegmentationNode (vtkMRMLLabelMapVolumeNode *labelmapNode, vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *updatedSegmentIDs)
 
static bool ImportLabelmapToSegmentationNode (vtkOrientedImageData *labelmapImage, vtkMRMLSegmentationNode *segmentationNode, vtkStringArray *updatedSegmentIDs, vtkGeneralTransform *labelmapToSegmentationTransform=nullptr)
 
static bool ImportModelsToSegmentationNode (vtkIdType folderItemId, vtkMRMLSegmentationNode *segmentationNode, std::string insertBeforeSegmentId="")
 Import models in a folder into the segmentation as segments. More...
 
static bool ImportModelToSegmentationNode (vtkMRMLModelNode *modelNode, vtkMRMLSegmentationNode *segmentationNode, std::string insertBeforeSegmentId="")
 Import model into the segmentation as a segment. More...
 
static int IsTypeOf (const char *type)
 
static vtkSlicerSegmentationsModuleLogicNew ()
 
static bool ReconvertAllRepresentations (vtkMRMLSegmentationNode *segmentationNode, const std::vector< std::string > &segmentIDs={})
 
static vtkSlicerSegmentationsModuleLogicSafeDownCast (vtkObject *o)
 
static bool SetBinaryLabelmapToSegment (vtkOrientedImageData *labelmap, vtkMRMLSegmentationNode *segmentationNode, std::string segmentID, int mergeMode=MODE_REPLACE, const int extent[6]=nullptr, bool minimumOfAllSegments=false, std::vector< std::string > segmentIdsToOverwrite={})
 
static void SetSegmentStatus (vtkSegment *segment, int status)
 Returns the value of the status tag for the given segment. More...
 
- Static Public Member Functions inherited from vtkSlicerModuleLogic
static int IsTypeOf (const char *type)
 
static vtkSlicerModuleLogicNew ()
 The Usual vtk class functions. More...
 
static vtkSlicerModuleLogicSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkMRMLAbstractLogic
static int IsTypeOf (const char *type)
 
static vtkMRMLAbstractLogicNew ()
 
static vtkMRMLAbstractLogicSafeDownCast (vtkObject *o)
 

Protected Member Functions

void OnMRMLSceneNodeAdded (vtkMRMLNode *node) override
 Handle MRML node added events. More...
 
void RegisterNodes () override
 Register MRML Node classes to Scene. Gets called automatically when the MRMLScene is attached to this logic class. More...
 
void SetMRMLSceneInternal (vtkMRMLScene *newScene) override
 
 vtkSlicerSegmentationsModuleLogic ()
 
 ~vtkSlicerSegmentationsModuleLogic () override
 
- Protected Member Functions inherited from vtkSlicerModuleLogic
 vtkSlicerModuleLogic ()
 
 ~vtkSlicerModuleLogic () override
 
- Protected Member Functions inherited from vtkMRMLAbstractLogic
int EndModify (bool wasModifying)
 
virtual bool EnterMRMLLogicsCallback () const
 
virtual bool EnterMRMLNodesCallback () const
 
virtual bool EnterMRMLSceneCallback () const
 
bool GetDisableModifiedEvent () const
 
int GetInMRMLLogicsCallbackFlag () const
 
int GetInMRMLNodesCallbackFlag () const
 
int GetInMRMLSceneCallbackFlag () const
 
vtkCallbackCommand * GetMRMLLogicsCallbackCommand ()
 
vtkObserverManagerGetMRMLLogicsObserverManager () const
 
vtkCallbackCommand * GetMRMLNodesCallbackCommand ()
 
vtkObserverManagerGetMRMLNodesObserverManager () const
 
vtkCallbackCommand * GetMRMLSceneCallbackCommand ()
 
vtkObserverManagerGetMRMLSceneObserverManager () const
 
int GetPendingModifiedEventCount () const
 
int GetProcessingMRMLSceneEvent () const
 Return the event id currently processed or 0 if any. More...
 
int InvokePendingModifiedEvent ()
 
void Modified () override
 
virtual void ObserveMRMLScene ()
 
virtual void OnMRMLNodeModified (vtkMRMLNode *)
 
virtual void OnMRMLSceneEndBatchProcess ()
 
virtual void OnMRMLSceneEndClose ()
 
virtual void OnMRMLSceneEndImport ()
 
virtual void OnMRMLSceneEndRestore ()
 
virtual void OnMRMLSceneNew ()
 
virtual void OnMRMLSceneNodeRemoved (vtkMRMLNode *)
 
virtual void OnMRMLSceneStartBatchProcess ()
 
virtual void OnMRMLSceneStartClose ()
 
virtual void OnMRMLSceneStartImport ()
 
virtual void OnMRMLSceneStartRestore ()
 
virtual void ProcessMRMLLogicsEvents (vtkObject *caller, unsigned long event, void *callData)
 
virtual void ProcessMRMLNodesEvents (vtkObject *caller, unsigned long event, void *callData)
 
virtual void ProcessMRMLSceneEvents (vtkObject *caller, unsigned long event, void *callData)
 
void SetAndObserveMRMLSceneEventsInternal (vtkMRMLScene *newScene, vtkIntArray *events, vtkFloatArray *priorities=nullptr)
 
void SetDisableModifiedEvent (bool onOff)
 
void SetInMRMLLogicsCallbackFlag (int flag)
 
void SetInMRMLNodesCallbackFlag (int flag)
 
void SetInMRMLSceneCallbackFlag (int flag)
 
void SetProcessingMRMLSceneEvent (int event)
 
bool StartModify ()
 
virtual void UnobserveMRMLScene ()
 
virtual void UpdateFromMRMLScene ()
 
 vtkMRMLAbstractLogic ()
 
 ~vtkMRMLAbstractLogic () override
 

Static Protected Member Functions

static bool ExportSegmentsClosedSurfaceRepresentationToObjFile (std::string destinationFolder, vtkMRMLSegmentationNode *segmentationNode, std::vector< std::string > &segmentIDs, bool lps, double sizeScale)
 
static bool ExportSegmentsClosedSurfaceRepresentationToStlFiles (std::string destinationFolder, vtkMRMLSegmentationNode *segmentationNode, std::vector< std::string > &segmentIDs, bool lps, double sizeScale, bool merge)
 
static std::string GetSafeFileName (std::string originalName)
 
static void OnSubjectHierarchyUIDAdded (vtkObject *caller, unsigned long eid, void *clientData, void *callData)
 
- Static Protected Member Functions inherited from vtkMRMLAbstractLogic
static void MRMLLogicsCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData)
 MRMLLogicCallback is a static function to relay modified events from the logics. More...
 
static void MRMLNodesCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData)
 MRMLNodesCallback is a static function to relay modified events from the nodes. More...
 
static void MRMLSceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData)
 

Protected Attributes

vtkCallbackCommand * SubjectHierarchyUIDCallbackCommand
 Command handling subject hierarchy UID added events. More...
 

Detailed Description

Definition at line 50 of file vtkSlicerSegmentationsModuleLogic.h.

Member Typedef Documentation

◆ Superclass

Definition at line 55 of file vtkSlicerSegmentationsModuleLogic.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Set a labelmap image as binary labelmap representation into the segment defined by the segmentation node and segment ID. Master representation must be binary labelmap! Master representation changed event is disabled to prevent deletion of all other representation in all segments. The other representations in the given segment are re-converted. The extent of the segment binary labelmap is shrunk to the effective extent. Display update is triggered.

Parameters
mergeModeDetermines if the labelmap should replace the segment, combined with a maximum or minimum operation, or set under the mask.
extentIf extent is specified then only that extent of the labelmap is used.
Enumerator
MODE_REPLACE 
MODE_MERGE_MAX 
MODE_MERGE_MIN 
MODE_MERGE_MASK 

Definition at line 357 of file vtkSlicerSegmentationsModuleLogic.h.

◆ SegmentStatus

Enumerator
NotStarted 
InProgress 
Completed 
Flagged 
LastStatus 

Definition at line 380 of file vtkSlicerSegmentationsModuleLogic.h.

Constructor & Destructor Documentation

◆ vtkSlicerSegmentationsModuleLogic()

vtkSlicerSegmentationsModuleLogic::vtkSlicerSegmentationsModuleLogic ( )
protected

◆ ~vtkSlicerSegmentationsModuleLogic()

vtkSlicerSegmentationsModuleLogic::~vtkSlicerSegmentationsModuleLogic ( )
overrideprotected

Member Function Documentation

◆ ApplyParentTransformToOrientedImageData()

static bool vtkSlicerSegmentationsModuleLogic::ApplyParentTransformToOrientedImageData ( vtkMRMLTransformableNode transformableNode,
vtkOrientedImageData orientedImageData,
bool  linearInterpolation = false,
double  backgroundColor[4] = nullptr 
)
static

Apply the parent transform of a node to an oriented image data. Useful if we want to get a labelmap representation of a segmentation in the proper geometry for processing.

Returns
Success flag

◆ ApplyParentTransformToPolyData()

static bool vtkSlicerSegmentationsModuleLogic::ApplyParentTransformToPolyData ( vtkMRMLTransformableNode transformableNode,
vtkPolyData *  polyData 
)
static

Apply the parent transform of a node to a poly data. Useful if we want to get a surface or contours representation of a segmentation in the proper geometry for processing.

Returns
Success flag

◆ ClearSegment()

static bool vtkSlicerSegmentationsModuleLogic::ClearSegment ( vtkMRMLSegmentationNode segmentationNode,
std::string  segmentID 
)
static

Clear the contents of a single segment.

◆ CollapseBinaryLabelmaps()

static void vtkSlicerSegmentationsModuleLogic::CollapseBinaryLabelmaps ( vtkMRMLSegmentationNode segmentationNode,
bool  forceToSingleLayer 
)
static

Collapse all segments into fewer shared labelmap layers

Parameters
segmentationNodeNode containing the segmentation
forceToSingleLayerIf false, then the layers will not be overwritten by each other, if true then the layers can overwrite each other, but the result is guaranteed to have one layer
Returns
True if the representation was created, False otherwise

◆ CopyOrientedImageDataToVolumeNode()

static bool vtkSlicerSegmentationsModuleLogic::CopyOrientedImageDataToVolumeNode ( vtkOrientedImageData orientedImageData,
vtkMRMLVolumeNode volumeNode,
bool  shallowCopy = true,
bool  shiftImageDataExtentToZeroStart = true 
)
static

Create volume MRML node from oriented image data. Display node is not created.

Parameters
orientedImageDataOriented image data to create volume node from
scalarVolumeNodeVolume to be populated with the oriented image data.
shallowCopyIf true then voxel array is not duplicated.
shiftImageDataExtentToZeroStartAdjust image origin to make image extents start from zero. May be necessary for compatibility with some algorithms that assumes image extent start from 0.
Returns
Success flag

◆ CreateLabelmapVolumeFromOrientedImageData()

static bool vtkSlicerSegmentationsModuleLogic::CreateLabelmapVolumeFromOrientedImageData ( vtkOrientedImageData orientedImageData,
vtkMRMLLabelMapVolumeNode labelmapVolumeNode 
)
static

Create labelmap volume MRML node from oriented image data. Creates a display node if a display node does not exist. Shifts image extent to start from zero. Image is shallow-copied (voxel array is not duplicated).

Parameters
orientedImageDataOriented image data to create labelmap from
labelmapVolumeNodeLabelmap volume to be populated with the oriented image data. The volume node must exist and be added to the MRML scene.
Returns
Success flag

◆ CreateOrientedImageDataFromVolumeNode()

static vtkOrientedImageData* vtkSlicerSegmentationsModuleLogic::CreateOrientedImageDataFromVolumeNode ( vtkMRMLScalarVolumeNode volumeNode,
vtkMRMLTransformNode outputParentTransformNode = nullptr 
)
static

Create oriented image data from a volume node

Parameters
outputParentTransformNodeSpecifies the parent transform node where the created image data can be placed. NOTE: Need to take ownership of the created object! For example using vtkSmartPointer<vtkOrientedImageData>::Take

◆ CreateRepresentationForOneSegment()

static vtkDataObject* vtkSlicerSegmentationsModuleLogic::CreateRepresentationForOneSegment ( vtkSegmentation segmentation,
std::string  segmentID,
std::string  representationName 
)
static

Create representation of only one segment in a segmentation. Useful if only one segment is processed, and we do not want to convert all segments to a certain segmentation to save time. NOTE: Need to take ownership of the created object! For example using vtkSmartPointer<vtkDataObject>::Take

Returns
Representation of the specified segment if found or can be created, nullptr otherwise

◆ CreateSegmentFromLabelmapVolumeNode()

static vtkSegment* vtkSlicerSegmentationsModuleLogic::CreateSegmentFromLabelmapVolumeNode ( vtkMRMLLabelMapVolumeNode labelmapVolumeNode,
vtkMRMLSegmentationNode segmentationNode = nullptr 
)
static

Create segment from labelmap volume MRML node. The contents are set as binary labelmap representation in the segment. Returns nullptr if labelmap contains more than one label. In that case

See also
ImportLabelmapToSegmentationNode needs to be used. NOTE: Need to take ownership of the created object! For example using vtkSmartPointer<vtkSegment>::Take
Parameters
labelmapVolumeNodeModel node containing image data that will be the binary labelmap representation in the created segment
segmentationNodeSegmentation node that will be the container of the segment. It is used to get parent transform to make sure the created segment will be located the same place the image was, considering all transforms involved. nullptr value means that this consideration is not needed. Default value is nullptr.
Returns
Created segment that then can be added to the segmentation if needed. Need to take ownership of the created object! For example using vtkSmartPointer<vtkSegment>::Take

◆ CreateSegmentFromModelNode()

static vtkSegment* vtkSlicerSegmentationsModuleLogic::CreateSegmentFromModelNode ( vtkMRMLModelNode modelNode,
vtkMRMLSegmentationNode segmentationNode = nullptr 
)
static

Create segment from model MRML node. The contents are set as closed surface model representation in the segment. NOTE: Need to take ownership of the created object! For example using vtkSmartPointer<vtkSegment>::Take

Parameters
modelNodeModel node containing poly data that will be the closed surface representation in the created segment
segmentationNodeSegmentation node that will be the container of the segment. It is used to get parent transform to make sure the created segment will be located the same place the model was, considering all transforms involved. nullptr value means that this consideration is not needed. Default value is nullptr.
Returns
Created segment that then can be added to the segmentation if needed. Need to take ownership of the created object! For example using vtkSmartPointer<vtkSegment>::Take

◆ DoesLabelmapContainSingleLabel()

static int vtkSlicerSegmentationsModuleLogic::DoesLabelmapContainSingleLabel ( vtkMRMLLabelMapVolumeNode labelmapVolumeNode)
static

Utility function to determine if a labelmap contains a single label

Returns
0 if contains no label or multiple labels, the label if it contains a single one

◆ ExportAllSegmentsToLabelmapNode()

static bool vtkSlicerSegmentationsModuleLogic::ExportAllSegmentsToLabelmapNode ( vtkMRMLSegmentationNode segmentationNode,
vtkMRMLLabelMapVolumeNode labelmapNode,
int  extentComputationMode = vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS 
)
static

Export all segments into a multi-label labelmap volume node

Parameters
segmentationNodeSegmentation node from which the the segments are exported
labelmapNodeLabelmap node to export the segments to
extentComputationModeLabelmap extents will be determined based on this value. By default, the minimum necessary size is used. Set value to vtkSegmentation::EXTENT_REFERENCE_GEOMETRY to use reference geometry extent.

◆ ExportAllSegmentsToModels()

static bool vtkSlicerSegmentationsModuleLogic::ExportAllSegmentsToModels ( vtkMRMLSegmentationNode segmentationNode,
vtkIdType  folderItemId 
)
static

Export all segments into a folder, a model node from each segment

Parameters
segmentationNodeSegmentation node from which the the segments are exported
folderItemIdSubject hierarchy folder item ID to export the segments to

◆ ExportSegmentsBinaryLabelmapRepresentationToFiles()

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsBinaryLabelmapRepresentationToFiles ( std::string  destinationFolder,
vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  segmentIds = nullptr,
std::string  extension = "nrrd",
bool  useCompression = false,
vtkMRMLVolumeNode referenceVolumeNode = nullptr,
int  extentComputationMode = vtkSegmentation::EXTENT_REFERENCE_GEOMETRY,
vtkMRMLColorTableNode colorTableNode = nullptr 
)
static

Export binary surface representation of multiple segments to a single output volume.

Parameters
destinationFolderFolder name where segments will be exported to
segmentationNodeSegmentation node that has the export color node reference.
segmentIdsList of segment ids to get values for. The order of segmentIds dictates the order of the returned label values.
extensionThe file extension used for the output file. "nrrd" by default.
useCompressionIf compression should be applied to the output file.
referenceVolumeNodeIf specified, then the saved segmentation will match the geometry of referenceVolumeNode
extentComputationModeIf referenceVolumeNode is not specified then the saved segmentation extents will be determined based on this value.
colorTableNodeColor table node used to set the exported labelmap values for the segments.

◆ ExportSegmentsClosedSurfaceRepresentationToFiles()

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsClosedSurfaceRepresentationToFiles ( std::string  destinationFolder,
vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  segmentIds = nullptr,
std::string  fileFormat = "STL",
bool  lps = true,
double  sizeScale = 1.0,
bool  merge = false 
)
static

Export closed surface representation of multiple segments to files. Typically used for writing 3D printable model files.

Parameters
segmentationNodeSegmentation node from which the the segments are exported
destinationFolderFolder name where segments will be exported to
fileFormatOutput file format (STL or OBJ).
mergeMerge all models into a single mesh. Only applicable to STL format.
lpsSave files in LPS coordinate system. If set to false then RAS coordinate system is used.
segmentIdsList of segment IDs to export

◆ ExportSegmentsClosedSurfaceRepresentationToObjFile()

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsClosedSurfaceRepresentationToObjFile ( std::string  destinationFolder,
vtkMRMLSegmentationNode segmentationNode,
std::vector< std::string > &  segmentIDs,
bool  lps,
double  sizeScale 
)
staticprotected

◆ ExportSegmentsClosedSurfaceRepresentationToStlFiles()

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsClosedSurfaceRepresentationToStlFiles ( std::string  destinationFolder,
vtkMRMLSegmentationNode segmentationNode,
std::vector< std::string > &  segmentIDs,
bool  lps,
double  sizeScale,
bool  merge 
)
staticprotected

◆ ExportSegmentsToLabelmapNode() [1/2]

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsToLabelmapNode ( vtkMRMLSegmentationNode segmentationNode,
std::vector< std::string > &  segmentIDs,
vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLVolumeNode referenceVolumeNode = nullptr,
int  extentComputationMode = vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS,
vtkMRMLColorTableNode colorTableNode = nullptr 
)
static

Export multiple segments into a multi-label labelmap volume node

Parameters
segmentationNodeSegmentation node from which the the segments are exported
segmentIdsList of segment IDs to export
labelmapNodeLabelmap node to export the segments to
referenceVolumeNodeIf specified, then the merged labelmap node will match the geometry of referenceVolumeNode
extentComputationModeIf referenceVolumeNode is not specified then labelmap extents will be determined based on this value. By default, the minimum necessary size is used. Set value to vtkSegmentation::EXTENT_REFERENCE_GEOMETRY to use reference geometry extent.

◆ ExportSegmentsToLabelmapNode() [2/2]

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsToLabelmapNode ( vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  segmentIDs,
vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLVolumeNode referenceVolumeNode = nullptr,
int  extentComputationMode = vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS,
vtkMRMLColorTableNode colorTableNode = nullptr 
)
static

Export multiple segments into a multi-label labelmap volume node

Parameters
segmentationNodeSegmentation node from which the the segments are exported
segmentIdsList of segment IDs to export
labelmapNodeLabelmap node to export the segments to
referenceVolumeNodeIf specified, then the merged labelmap node will match the geometry of referenceVolumeNode
extentComputationModeIf referenceVolumeNode is not specified then labelmap extents will be determined based on this value. By default, the minimum necessary size is used. Set value to vtkSegmentation::EXTENT_REFERENCE_GEOMETRY to use reference geometry extent.

◆ ExportSegmentsToModels() [1/2]

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsToModels ( vtkMRMLSegmentationNode segmentationNode,
std::vector< std::string > &  segmentIDs,
vtkIdType  folderItemId 
)
static

Export multiple segments into a folder, a model node from each segment

Parameters
segmentationNodeSegmentation node from which the the segments are exported
segmentIdsList of segment IDs to export
folderItemIdSubject hierarchy folder item ID to export the segments to

◆ ExportSegmentsToModels() [2/2]

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentsToModels ( vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  segmentIds,
vtkIdType  folderItemId 
)
static

Export multiple segments into a folder, a model node from each segment

Parameters
segmentationNodeSegmentation node from which the the segments are exported
segmentIdsList of segment IDs to export
folderItemIdSubject hierarchy folder item ID to export the segments to

◆ ExportSegmentToRepresentationNode()

static bool vtkSlicerSegmentationsModuleLogic::ExportSegmentToRepresentationNode ( vtkSegment segment,
vtkMRMLNode representationNode 
)
static

Export segment to representation MRML node.

  1. If representation node is a labelmap node, then the binary labelmap representation of the segment is copied
  2. If representation node is a model node, then the closed surface representation is copied Otherwise return with failure.

◆ ExportVisibleSegmentsToLabelmapNode()

static bool vtkSlicerSegmentationsModuleLogic::ExportVisibleSegmentsToLabelmapNode ( vtkMRMLSegmentationNode segmentationNode,
vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLVolumeNode referenceVolumeNode = nullptr,
int  extentComputationMode = vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS 
)
static

Export visible segments into a multi-label labelmap volume node

Parameters
segmentationNodeSegmentation node from which the the visible segments are exported
labelmapNodeLabelmap node to export the segments to
referenceVolumeNodeIf specified, then the merged labelmap node will match the geometry of referenceVolumeNode
extentComputationModeIf referenceVolumeNode is not specified then labelmap extents will be determined based on this value. By default, the minimum necessary size is used. Set value to vtkSegmentation::EXTENT_REFERENCE_GEOMETRY to use reference geometry extent.

◆ ExportVisibleSegmentsToModels()

static bool vtkSlicerSegmentationsModuleLogic::ExportVisibleSegmentsToModels ( vtkMRMLSegmentationNode segmentationNode,
vtkIdType  folderItemId 
)
static

Export visible segments into a folder, a model node from each segment

Parameters
segmentationNodeSegmentation node from which the the segments are exported
folderItemIdSubject hierarchy folder item ID to export the segments to

◆ GenerateMergedLabelmapInReferenceGeometry()

static void vtkSlicerSegmentationsModuleLogic::GenerateMergedLabelmapInReferenceGeometry ( vtkMRMLSegmentationNode segmentationNode,
vtkMRMLVolumeNode referenceVolumeNode,
vtkStringArray *  segmentIDs,
int  extentComputationMode,
vtkOrientedImageData mergedLabelmap_Reference 
)
static

◆ GetAllLabelValues()

static void vtkSlicerSegmentationsModuleLogic::GetAllLabelValues ( vtkIntArray *  labels,
vtkImageData *  labelmap 
)
static

Utility function that returns all non-empty label values in a labelmap.

◆ GetClassName()

virtual const char* vtkSlicerSegmentationsModuleLogic::GetClassName ( )
virtual

Reimplemented from vtkSlicerModuleLogic.

◆ GetDefaultSegmentationNode()

vtkMRMLSegmentationNode* vtkSlicerSegmentationsModuleLogic::GetDefaultSegmentationNode ( )

Get default segmentation node. All new segmentation nodes are initialized to the content of this node.

◆ GetDefaultSurfaceSmoothingEnabled()

bool vtkSlicerSegmentationsModuleLogic::GetDefaultSurfaceSmoothingEnabled ( )

Get/Set default closed surface smoothing enabled flag for new segmentation nodes.

◆ GetLabelValuesFromColorNode()

static void vtkSlicerSegmentationsModuleLogic::GetLabelValuesFromColorNode ( vtkMRMLSegmentationNode segmentationNode,
vtkMRMLColorTableNode colorTableNode,
vtkStringArray *  segmentIds,
vtkIntArray *  labelValues 
)
static

Gets the label values for the current segment from the color node reference. Label values found by matching color + segment name. If a segment name is not found in the table, then the label value returned for the segment is the first label value outside the table range.

Parameters
segmentationNodeSegmentation node that has the export color node reference.
colorTableNodeColor table used to get the label values for the segments.
segmentIdsList of segment ids to get values for. The order of segmentIds dictates the order of the returned label values.
labelValuesOutput label values from the color node. Lenght of the array will be the same as the number of segmentIds.

◆ GetSafeFileName()

static std::string vtkSlicerSegmentationsModuleLogic::GetSafeFileName ( std::string  originalName)
staticprotected

Generate a safe file name from a given string. The method is in this logic so that it does not cause confusion throughout Slicer (there is an implementation already in qSlicerSaveDataDialogPrivate::nodeFileInfo and it would be good to keep a central one)

◆ GetSegmentationNodeForSegment()

static vtkMRMLSegmentationNode* vtkSlicerSegmentationsModuleLogic::GetSegmentationNodeForSegment ( vtkMRMLScene scene,
vtkSegment segment,
std::string &  segmentId 
)
static

Get segmentation node containing a given segment. As segments are out-of-MRML VTK objects, there is no direct link from it to its parent node, so must be found from the MRML scene.

Parameters
sceneMRML scene
segmentSegment to find
segmentIdOutput argument for the ID of the found segment
Returns
Segmentation node containing the given segment if any, nullptr otherwise

◆ GetSegmentationNodeForSegmentation()

static vtkMRMLSegmentationNode* vtkSlicerSegmentationsModuleLogic::GetSegmentationNodeForSegmentation ( vtkMRMLScene scene,
vtkSegmentation segmentation 
)
static

Get segmentation node containing a segmentation object. As segmentation objects are out-of-MRML VTK objects, there is no direct link from it to its parent node, so must be found from the MRML scene.

Parameters
sceneMRML scene
segmentationSegmentation to find
Returns
Segmentation node containing the given segmentation if any, nullptr otherwise

◆ GetSegmentationNodeForSegmentSubjectHierarchyItem()

static vtkMRMLSegmentationNode* vtkSlicerSegmentationsModuleLogic::GetSegmentationNodeForSegmentSubjectHierarchyItem ( vtkIdType  segmentShItemID,
vtkMRMLScene scene 
)
static

Utility function for getting the segmentation node for a segment subject hierarchy item.

◆ GetSegmentBinaryLabelmapRepresentation()

static bool vtkSlicerSegmentationsModuleLogic::GetSegmentBinaryLabelmapRepresentation ( vtkMRMLSegmentationNode segmentationNode,
std::string  segmentID,
vtkOrientedImageData imageData,
bool  applyParentTransform = true 
)
static

Convenience function to get binary labelmap representation of a segment in a segmentation. Uses

See also
GetSegmentRepresentation A duplicate of the oriented image data is copied into the argument image data, with the segmentation's parent transform applied if requested (on by default). The oriented image data can be used directly for processing, or to create a labelmap volume using
CreateLabelmapVolumeFromOrientedImageData.
Parameters
segmentationNodeInput segmentation node containing the segment to extract
segmentIDSegment identifier of the segment to extract
imageDataOutput oriented image data into which the segment binary labelmap is copied
applyParentTransformFlag determining whether to apply parent transform of the segmentation node. If on, then the oriented image data is in RAS, otherwise in the segmentation node's coordinate frame. On by default
Returns
Success flag

◆ GetSegmentClosedSurfaceRepresentation()

static bool vtkSlicerSegmentationsModuleLogic::GetSegmentClosedSurfaceRepresentation ( vtkMRMLSegmentationNode segmentationNode,
std::string  segmentID,
vtkPolyData *  polyData,
bool  applyParentTransform = true 
)
static

Convenience function to get closed surface representation of a segment in a segmentation. Uses

See also
GetSegmentRepresentation A duplicate of the closed surface data is copied into the argument image data, with the segmentation's parent transform applied if requested (on by default).
Parameters
segmentationNodeInput segmentation node containing the segment to extract
segmentIDSegment identifier of the segment to extract
polyDataOutput polydata into which the segment polydata is copied
applyParentTransformFlag determining whether to apply parent transform of the segmentation node. If on, then the oriented image data is in RAS, otherwise in the segmentation node's coordinate frame. On by default
Returns
Success flag

◆ GetSegmentForSegmentSubjectHierarchyItem()

static vtkSegment* vtkSlicerSegmentationsModuleLogic::GetSegmentForSegmentSubjectHierarchyItem ( vtkIdType  segmentShItemID,
vtkMRMLScene scene 
)
static

Utility function for getting the segment object for a segment subject hierarchy item.

◆ GetSegmentRepresentation()

static bool vtkSlicerSegmentationsModuleLogic::GetSegmentRepresentation ( vtkMRMLSegmentationNode segmentationNode,
std::string  segmentID,
std::string  representationName,
vtkDataObject *  segmentRepresentation,
bool  applyParentTransform = true 
)
static

Convenience function to get a specified representation of a segment in a segmentation. A duplicate of the representation data object is copied into the argument output object, with the segmentation's parent transform applied if requested (on by default).

Parameters
segmentationNodeInput segmentation node containing the segment to extract
segmentIDSegment identifier of the segment to extract
representationNameName of the requested representation
segmentRepresentationOutput representation data object into which the given representation in the segment is copied
applyParentTransformFlag determining whether to apply parent transform of the segmentation node. On by default
Returns
Success flag

◆ GetSegmentStatus()

static int vtkSlicerSegmentationsModuleLogic::GetSegmentStatus ( vtkSegment segment)
static

Returns the value of the status tag for the given segment.

◆ GetSegmentStatusAsHumanReadableString()

static const char* vtkSlicerSegmentationsModuleLogic::GetSegmentStatusAsHumanReadableString ( int  segmentStatus)
static

Get the human readable segment status from the SegmentStatus enum value.

◆ GetSegmentStatusAsMachineReadableString()

static const char* vtkSlicerSegmentationsModuleLogic::GetSegmentStatusAsMachineReadableString ( int  segmentStatus)
static

Get the machine readable segment status from the SegmentStatus enum value.

◆ GetSegmentStatusFromMachineReadableString()

static int vtkSlicerSegmentationsModuleLogic::GetSegmentStatusFromMachineReadableString ( std::string  statusString)
static

Get the enum segment status from a machine string.

◆ GetSharedSegmentIDsInMask()

static bool vtkSlicerSegmentationsModuleLogic::GetSharedSegmentIDsInMask ( vtkMRMLSegmentationNode segmentationNode,
std::string  sharedSegmentID,
vtkOrientedImageData mask,
const int  extent[6],
std::vector< std::string > &  segmentIDs,
int  maskThreshold = 0.0,
bool  includeInputSharedSegmentID = false 
)
static

Get the list of segment IDs in the same shared labelmap that are contained within the mask

Parameters
segmentationNodeNode containing the segmentation
sharedSegmentIDSegment ID of the segment that contains the shared labelmap to be checked
maskMask labelmap
segmentIDsOutput list of segment IDs under the mask
includeInputSharedSegmentIDIf false, sharedSegmentID will not be added to the list of output segment IDs even if it is within the mask

◆ GetStatusTagName()

static const char* vtkSlicerSegmentationsModuleLogic::GetStatusTagName ( )
static

Returns the name of the status tag.

◆ GetTransformBetweenRepresentationAndSegmentation()

static bool vtkSlicerSegmentationsModuleLogic::GetTransformBetweenRepresentationAndSegmentation ( vtkMRMLTransformableNode representationNode,
vtkMRMLSegmentationNode segmentationNode,
vtkGeneralTransform *  representationToSegmentationTransform 
)
static

Get transform between a representation node (e.g. labelmap or model) and a segmentation node. Useful if we want to add a representation to a segment, and we want to make sure that the segment will be located the same place the representation node was. The output transform is the representation node's parent transform concatenated with the inverse of the segmentation's parent transform. It needs to be applied on the representation.

Parameters
representationNodeTransformable node which contains the representation we want to add to the segment
segmentationNodeSegmentation node that will contain the segment to which the representation is added. It is the representation node's parent transform concatenated with the inverse of the segmentation's parent transform.
representationToSegmentationTransformGeneral transform between the representation node and the segmentation node.
Returns
Success flag

◆ ImportLabelmapToSegmentationNode() [1/4]

static bool vtkSlicerSegmentationsModuleLogic::ImportLabelmapToSegmentationNode ( vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLSegmentationNode segmentationNode,
std::string  insertBeforeSegmentId = "" 
)
static

Import all labels from a labelmap node to a segmentation node, each label to a separate segment. The colors of the new segments are set from the color table corresponding to the labelmap volume.

Parameters
insertBeforeSegmentIdNew segments will be inserted before this segment.

◆ ImportLabelmapToSegmentationNode() [2/4]

static bool vtkSlicerSegmentationsModuleLogic::ImportLabelmapToSegmentationNode ( vtkOrientedImageData labelmapImage,
vtkMRMLSegmentationNode segmentationNode,
std::string  baseSegmentName = "",
std::string  insertBeforeSegmentId = "" 
)
static

Import all labels from a labelmap image to a segmentation node, each label to a separate segment The colors of the new segments are randomly generated, unless terminology context is specified, in which case the terminology entries are attempted to be mapped to the imported labels LabelmapImage is defined in the segmentation node's coordinate system (parent transform of the segmentation node is not used during import).

Parameters
baseSegmentNamePrefix for the names of the new segments. Empty by default, in which case the prefix will be "Label"

◆ ImportLabelmapToSegmentationNode() [3/4]

static bool vtkSlicerSegmentationsModuleLogic::ImportLabelmapToSegmentationNode ( vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  updatedSegmentIDs 
)
static

Update segmentation from segments in a labelmap node.

Parameters
updatedSegmentIDsDefines how label values 1..N are mapped to segment IDs (0..N-1).

◆ ImportLabelmapToSegmentationNode() [4/4]

static bool vtkSlicerSegmentationsModuleLogic::ImportLabelmapToSegmentationNode ( vtkOrientedImageData labelmapImage,
vtkMRMLSegmentationNode segmentationNode,
vtkStringArray *  updatedSegmentIDs,
vtkGeneralTransform *  labelmapToSegmentationTransform = nullptr 
)
static

Update segmentation from segments in a labelmap node.

Parameters
updatedSegmentIDsDefines how label values 1..N are mapped to segment IDs (0..N-1).

◆ ImportLabelmapToSegmentationNodeWithTerminology()

bool vtkSlicerSegmentationsModuleLogic::ImportLabelmapToSegmentationNodeWithTerminology ( vtkMRMLLabelMapVolumeNode labelmapNode,
vtkMRMLSegmentationNode segmentationNode,
std::string  terminologyContextName,
std::string  insertBeforeSegmentId = "" 
)

Import all labels from a labelmap node to a segmentation node, each label to a separate segment. Terminology and color is set to the segments based on the color table corresponding to the labelmap volume node.

Parameters
terminologyContextNameTerminology context the entries of which are mapped to the labels imported from the labelmap node
insertBeforeSegmentIdNew segments will be inserted before this segment.

◆ ImportModelsToSegmentationNode()

static bool vtkSlicerSegmentationsModuleLogic::ImportModelsToSegmentationNode ( vtkIdType  folderItemId,
vtkMRMLSegmentationNode segmentationNode,
std::string  insertBeforeSegmentId = "" 
)
static

Import models in a folder into the segmentation as segments.

◆ ImportModelToSegmentationNode()

static bool vtkSlicerSegmentationsModuleLogic::ImportModelToSegmentationNode ( vtkMRMLModelNode modelNode,
vtkMRMLSegmentationNode segmentationNode,
std::string  insertBeforeSegmentId = "" 
)
static

Import model into the segmentation as a segment.

◆ IsA()

virtual int vtkSlicerSegmentationsModuleLogic::IsA ( const char *  type)
virtual

Reimplemented from vtkSlicerModuleLogic.

◆ IsTypeOf()

static int vtkSlicerSegmentationsModuleLogic::IsTypeOf ( const char *  type)
static

◆ LoadSegmentationFromFile()

vtkMRMLSegmentationNode* vtkSlicerSegmentationsModuleLogic::LoadSegmentationFromFile ( const char *  filename,
bool  autoOpacities = true,
const char *  nodeName = nullptr,
vtkMRMLColorTableNode colorTableNode = nullptr 
)

Load segmentation from file

Parameters
filenamePath and name of file containing segmentation (nrrd, vtm, etc.)
autoOpacitiesOptional flag determining whether segment opacities are calculated automatically based on containment. True by default.
nodeNameOptional string to use for the segmentation node name.
colorTableNodeOptional color node used to name the segments and set segment color.
Returns
Loaded segmentation node

◆ New()

static vtkSlicerSegmentationsModuleLogic* vtkSlicerSegmentationsModuleLogic::New ( )
static

◆ OnMRMLSceneNodeAdded()

void vtkSlicerSegmentationsModuleLogic::OnMRMLSceneNodeAdded ( vtkMRMLNode node)
overrideprotectedvirtual

Handle MRML node added events.

Reimplemented from vtkMRMLAbstractLogic.

◆ OnSubjectHierarchyUIDAdded()

static void vtkSlicerSegmentationsModuleLogic::OnSubjectHierarchyUIDAdded ( vtkObject *  caller,
unsigned long  eid,
void *  clientData,
void *  callData 
)
staticprotected

Callback function observing UID added events for subject hierarchy nodes. In case the newly added UID is a volume node referenced from a segmentation, its geometry will be set as image geometry conversion parameter. The "other order", i.e. when the volume is loaded first and the segmentation second, should be handled at loading time of the segmentation (because then we already know about the volume)

◆ PrintSelf()

void vtkSlicerSegmentationsModuleLogic::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

◆ ReconvertAllRepresentations()

static bool vtkSlicerSegmentationsModuleLogic::ReconvertAllRepresentations ( vtkMRMLSegmentationNode segmentationNode,
const std::vector< std::string > &  segmentIDs = {} 
)
static

Reconvert all representations in the segmentation from the master representation

Parameters
segmentationNodeNode containing the segmentation
sharedSegmentIDSegment IDs to be converted. If empty, all segments will be converted.
Returns
True if the representation was created, False otherwise

◆ RegisterNodes()

void vtkSlicerSegmentationsModuleLogic::RegisterNodes ( )
overrideprotectedvirtual

Register MRML Node classes to Scene. Gets called automatically when the MRMLScene is attached to this logic class.

Reimplemented from vtkMRMLAbstractLogic.

◆ SafeDownCast()

static vtkSlicerSegmentationsModuleLogic* vtkSlicerSegmentationsModuleLogic::SafeDownCast ( vtkObject *  o)
static

◆ SetBinaryLabelmapToSegment()

static bool vtkSlicerSegmentationsModuleLogic::SetBinaryLabelmapToSegment ( vtkOrientedImageData labelmap,
vtkMRMLSegmentationNode segmentationNode,
std::string  segmentID,
int  mergeMode = MODE_REPLACE,
const int  extent[6] = nullptr,
bool  minimumOfAllSegments = false,
std::vector< std::string >  segmentIdsToOverwrite = {} 
)
static

◆ SetDefaultSurfaceSmoothingEnabled()

void vtkSlicerSegmentationsModuleLogic::SetDefaultSurfaceSmoothingEnabled ( bool  enabled)

◆ SetMRMLSceneInternal()

void vtkSlicerSegmentationsModuleLogic::SetMRMLSceneInternal ( vtkMRMLScene newScene)
overrideprotectedvirtual

Called each time a new scene is set. Can be reimplemented in derivated classes. Doesn't observe the scene by default, that means that UpdateFromMRMLScene() won't be called by default when a scene is imported, closed or restored, only when a new scene is set.

See also
SetAndObserveMRMLSceneInternal() SetAndObserveMRMLSceneEventsInternal()
UpdateFromMRMLScene()

Reimplemented from vtkMRMLAbstractLogic.

◆ SetSegmentStatus()

static void vtkSlicerSegmentationsModuleLogic::SetSegmentStatus ( vtkSegment segment,
int  status 
)
static

Returns the value of the status tag for the given segment.

◆ SetTerminologyToSegmentationFromLabelmapNode()

bool vtkSlicerSegmentationsModuleLogic::SetTerminologyToSegmentationFromLabelmapNode ( vtkMRMLSegmentationNode segmentationNode,
vtkMRMLLabelMapVolumeNode labelmapNode,
std::string  terminologyContextName 
)

Assign terminology to segments in a segmentation node based on the labels of a labelmap node. Match is made based on the 3dSlicerLabel terminology type attribute. If the terminology context does not contain that attribute, match cannot be made.

Parameters
terminologyContextNameTerminology context the entries of which are mapped to the labels imported from the labelmap node

Member Data Documentation

◆ SubjectHierarchyUIDCallbackCommand

vtkCallbackCommand* vtkSlicerSegmentationsModuleLogic::SubjectHierarchyUIDCallbackCommand
protected

Command handling subject hierarchy UID added events.

Definition at line 461 of file vtkSlicerSegmentationsModuleLogic.h.


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