21#ifndef __vtkMRMLSegmentationNode_h
22#define __vtkMRMLSegmentationNode_h
35class vtkCallbackCommand;
60 void PrintSelf(ostream& os, vtkIndent indent)
override;
69 void WriteXML(ostream& of,
int indent)
override;
137 const std::vector<std::string>& segmentIDs = std::vector<std::string>(), vtkIntArray* labelValues =
nullptr);
156 vtkOrientedImageData* mergedLabelmapGeometry =
nullptr, vtkStringArray* segmentIDs =
nullptr, vtkIntArray* labelValues =
nullptr);
195 std::string editedSegmentID=
"", std::string maskSegmentID=
"",
221 vtkWarningMacro(
"vtkSegmentation::SetMasterRepresentationToBinaryLabelmap() method is deprecated, please use SetSourceRepresentationToBinaryLabelmap method instead");
227 vtkWarningMacro(
"vtkSegmentation::SetMasterRepresentationToClosedSurface() method is deprecated, please use SetSourceRepresentationToClosedSurface method instead");
275 std::string segmentName =
"",
double color[3] =
nullptr, std::string segmentId =
"");
280 std::string segmentName =
"",
double color[3] =
nullptr, std::string segmentId =
"");
MRML node to represent discrete color information.
Class to hold information about a node reference.
Abstract Superclass for all specific types of MRML nodes.
MRML node for representing a volume (image stack).
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for representing segmentation display attributes.
vtkMRMLSegmentationNode(const vtkMRMLSegmentationNode &)
std::string SegmentListFilterOptions
void GetSegmentCenterRAS(const std::string &segmentID, double centerRAS[3])
void OnSegmentRemoved(const char *segmentId)
static void SegmentationModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
Callback function for all events from the segmentation object.
static vtkMRMLSegmentationNode * New()
void OnSourceRepresentationModified()
std::string AddSegmentFromBinaryLabelmapRepresentation(vtkOrientedImageData *imageData, std::string segmentName="", double color[3]=nullptr, std::string segmentId="")
virtual bool GetBinaryLabelmapRepresentation(const std::string segmentId, vtkOrientedImageData *outputBinaryLabelmap)
void SetLabelmapConversionColorTableNodeID(const char *labelmapConversionColorTableNodeID)
void RemoveSegment(const std::string &segmentID)
Delete segment from segmentation.
void ApplyTransform(vtkAbstractTransform *transform) override
vtkSegmentation * Segmentation
Segmentation object to store the actual data.
void CreateDefaultDisplayNodes() override
Create and observe a segmentation display node.
@ SegmentationChangedEvent
@ ReferenceImageGeometryChangedEvent
static const char * ConvertMaskModeToString(int mode)
Convert between constants IDs to/from string.
static std::string GetReferenceImageGeometryReferenceRole()
Expose reference identifier to get the volume node defining the reference image geometry if any.
const char * GetNodeTagName() override
Get unique node XML tag name (like Volume, Model)
virtual bool CreateBinaryLabelmapRepresentation()
Generate binary labelmap representation for all segments.
virtual vtkIdType GetSegmentSubjectHierarchyItem(std::string segmentID, vtkMRMLSubjectHierarchyNode *shNode)
static int ConvertMaskModeFromString(const char *modeStr)
double * GetSegmentCenter(const std::string &segmentID) VTK_SIZEHINT(3)
Get position of the segment's center (in the segmentation node's coordinate system)
virtual bool SetMasterRepresentationToBinaryLabelmap()
void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference) override
Reimplemented to invoke ReferenceImageGeometryChangedEvent.
void GetSegmentCenter(const std::string &segmentID, double center[3])
static const char * GetLabelmapConversionColorTableNodeReferenceRole()
virtual bool GenerateEditMask(vtkOrientedImageData *maskImage, int editMode, vtkOrientedImageData *referenceGeometry, std::string editedSegmentID="", std::string maskSegmentID="", vtkOrientedImageData *sourceVolume=nullptr, double editableIntensityRange[2]=nullptr, vtkMRMLSegmentationDisplayNode *displayNode=nullptr)
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Reimplemented to invoke ReferenceImageGeometryChangedEvent.
vtkSmartPointer< vtkCallbackCommand > SegmentationModifiedCallbackCommand
Command handling events from segmentation object.
virtual void OnSubjectHierarchyUIDAdded(vtkMRMLSubjectHierarchyNode *shNode, vtkIdType itemWithNewUID)
void SetAndObserveSegmentation(vtkSegmentation *segmentation)
Set and observe segmentation object.
void GetRASBounds(double bounds[6]) override
void OnSegmentAdded(const char *segmentId)
bool CanApplyNonLinearTransforms() const override
@ EditAllowedEverywhere
Modification is allowed everywhere.
@ EditAllowed_Last
Insert valid types above this line.
@ EditAllowedInsideAllSegments
Modification is allowed inside all segments.
@ EditAllowedOutsideVisibleSegments
Modification is allowed outside all visible segments.
@ EditAllowedInsideSingleSegment
Modification is allowed only over the area covered by segment specified in MaskSegmentID.
@ EditAllowedInsideVisibleSegments
Modification is allowed inside all visible segments.
@ EditAllowedOutsideAllSegments
Modification is allowed outside all segments.
void OnSegmentModified(const char *segmentId)
virtual bool GenerateMergedLabelmap(vtkOrientedImageData *mergedImageData, int extentComputationMode, vtkOrientedImageData *mergedLabelmapGeometry=nullptr, const std::vector< std::string > &segmentIDs=std::vector< std::string >(), vtkIntArray *labelValues=nullptr)
virtual bool SetSourceRepresentationToBinaryLabelmap()
virtual bool GetClosedSurfaceRepresentation(const std::string segmentId, vtkPolyData *outputClosedSurface)
const char * GetLabelmapConversionColorTableNodeID()
static const char * GetSegmentIDAttributeName()
void PrintSelf(ostream &os, vtkIndent indent) override
virtual bool SetMasterRepresentationToClosedSurface()
virtual void SetReferenceImageGeometryParameterFromVolumeNode(vtkMRMLScalarVolumeNode *volumeNode)
Set reference image geometry conversion parameter from the volume node, keeping reference.
virtual std::string AddSegmentFromClosedSurfaceRepresentation(vtkPolyData *polyData, std::string segmentName="", double color[3]=nullptr, std::string segmentId="")
virtual void RemoveBinaryLabelmapRepresentation()
Remove binary labelmap representation for all segments.
virtual bool CreateClosedSurfaceRepresentation()
virtual vtkPolyData * GetClosedSurfaceInternalRepresentation(const std::string segmentId)
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Reimplemented to invoke ReferenceImageGeometryChangedEvent.
~vtkMRMLSegmentationNode() override
bool SegmentListFilterEnabled
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void GetBounds(double bounds[6]) override
double SegmentCenterTmp[4]
virtual vtkOrientedImageData * GetBinaryLabelmapInternalRepresentation(const std::string segmentId)
vtkMRMLCopyContentMacro(vtkMRMLSegmentationNode)
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create a segmentation storage node.
virtual bool GenerateMergedLabelmapForAllSegments(vtkOrientedImageData *mergedImageData, int extentComputationMode=vtkSegmentation::EXTENT_UNION_OF_EFFECTIVE_SEGMENTS, vtkOrientedImageData *mergedLabelmapGeometry=nullptr, vtkStringArray *segmentIDs=nullptr, vtkIntArray *labelValues=nullptr)
void operator=(const vtkMRMLSegmentationNode &)
void ApplyTransformMatrix(vtkMatrix4x4 *transformMatrix) override
static const char * GetLabelmapConversionColorTableNodeReferenceMRMLAttributeName()
virtual bool SetSourceRepresentationToClosedSurface()
vtkMRMLSegmentationNode()
double * GetSegmentCenterRAS(const std::string &segmentID) VTK_SIZEHINT(3)
vtkMRMLColorTableNode * GetLabelmapConversionColorTableNode()
virtual void RemoveClosedSurfaceRepresentation()
Remove closed surface representation for all segments.
vtkMRMLNode * CreateNodeInstance() override
Create instance of a GAD node.
void ReadXMLAttributes(const char **atts) override
Set node attributes from name/value pairs.
A superclass for other storage nodes.
MRML node to represent a complete subject hierarchy tree.
Image data containing orientation information.
This class encapsulates a segmentation that can contain multiple segments and multiple representation...
@ EXTENT_UNION_OF_EFFECTIVE_SEGMENTS
Extent is computed as union of effective extent of all segments.