21#ifndef __vtkMRMLSegmentationStorageNode_h
22#define __vtkMRMLSegmentationStorageNode_h
26#define SUPPORT_4D_SPATIAL_NRRD
31#ifdef SUPPORT_4D_SPATIAL_NRRD
33 #include <itkImageRegionIteratorWithIndex.h>
43class vtkInformationStringKey;
44class vtkInformationIntegerVectorKey;
65#ifdef SUPPORT_4D_SPATIAL_NRRD
69 typedef itk::Image<unsigned char, 4> BinaryLabelmap4DImageType;
70 typedef itk::ImageRegionIteratorWithIndex<BinaryLabelmap4DImageType> BinaryLabelmap4DIteratorType;
76 void PrintSelf(ostream& os, vtkIndent indent)
override;
84 void WriteXML(ostream& of,
int indent)
override;
139#ifdef SUPPORT_4D_SPATIAL_NRRD
MRML node containing segmentations.
void PrintSelf(ostream &os, vtkIndent indent) override
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void CreateRepresentationsBySerializedNames(vtkSegmentation *segmentation, std::string representationNames)
Create representations based on serialized representation names string.
std::string SerializeContainedRepresentationNames(vtkSegmentation *segmentation)
Serialize contained representation names in a string.
const char * GetNodeTagName() override
Get node XML tag name (like Storage, Model)
virtual int ReadPolyDataRepresentation(vtkMRMLSegmentationNode *segmentationNode, std::string path)
Read a poly data representation to file.
int WriteDataInternal(vtkMRMLNode *refNode) override
Write data from a referenced node.
void AddPolyDataFileNames(std::string path, vtkSegmentation *segmentation)
~vtkMRMLSegmentationStorageNode() override
const char * GetDefaultWriteFileExtension() override
virtual int ReadBinaryLabelmapRepresentation(vtkMRMLSegmentationNode *segmentationNode, std::string path)
Read binary labelmap representation from nrrd file (3D spatial + list)
virtual int WriteBinaryLabelmapRepresentation(vtkMRMLSegmentationNode *segmentationNode, std::string path)
Write binary labelmap representation to file.
static bool GetSegmentMetaDataFromDicitionary(std::string &headerValue, itk::MetaDataDictionary dictionary, int segmentIndex, std::string keyName)
Get the metadata string for the segment and key from the dictionary.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
void InitializeSupportedWriteFileTypes() override
Initialize all the supported write file types.
static std::string GetImageExtentAsString(int extent[6])
virtual int ReadBinaryLabelmapRepresentation4DSpatial(vtkMRMLSegmentationNode *segmentationNode, std::string path)
Read binary labelmap representation from 4D spatial nrrd file - obsolete.
void ResetSupportedWriteFileTypes()
Reset supported write file types. Called when source representation is changed.
void Copy(vtkMRMLNode *node) override
Copy the node's attributes to this object.
static void GetSegmentColorFromString(double color[3], std::string colorString)
virtual int WritePolyDataRepresentation(vtkMRMLSegmentationNode *segmentationNode, std::string path)
Write a poly data representation to file.
static std::string GetImageExtentAsString(vtkOrientedImageData *image)
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
static void GetImageExtentFromString(int extent[6], std::string extentValue)
static void SetSegmentTagsFromString(vtkSegment *segment, std::string tagsValue)
static void AddToExtent(int extent[6], int extentToAdd[6])
void InitializeSupportedReadFileTypes() override
Initialize all the supported read file types.
static std::string GetSegmentationMetaDataKey(const std::string &keyName)
vtkMRMLSegmentationNode * GetAssociatedDataNode()
Get data node that is associated with this storage node.
static std::string GetSegmentTagsAsString(vtkSegment *segment)
static std::string GetSegmentMetaDataKey(int segmentIndex, const std::string &keyName)
bool CanReadInReferenceNode(vtkMRMLNode *refNode) override
Return true if the reference node can be read in.
static bool GetSegmentationMetaDataFromDicitionary(std::string &headerValue, itk::MetaDataDictionary dictionary, std::string keyName)
Get the metadata string for the segmentation key from the dictionary.
static vtkMRMLSegmentationStorageNode * New()
int ReadDataInternal(vtkMRMLNode *refNode) override
Read data and set it in the referenced node.
static std::string GetSegmentColorAsString(vtkMRMLSegmentationNode *segmentationNode, const std::string &segmentId)
vtkMRMLSegmentationStorageNode()
void operator=(const vtkMRMLStorageNode &)
Image data containing orientation information.
This class encapsulates a segment that is part of a segmentation.
This class encapsulates a segmentation that can contain multiple segments and multiple representation...