28 #ifndef __vtkMRMLSubjectHierarchyNode_h 29 #define __vtkMRMLSubjectHierarchyNode_h 35 class vtkCallbackCommand;
70 SubjectHierarchyItemAddedEvent = 62000,
100 vtkIdList* itemIDsToShow =
nullptr;
107 void PrintSelf(ostream& os, vtkIndent indent)
override;
112 virtual void ReadItemFromXML(
const char** atts);
114 void WriteXML(ostream& of,
int indent)
override;
131 vtkIdType GetSceneItemID();
135 void SetItemName(vtkIdType itemID, std::string name);
138 std::string GetItemName(vtkIdType itemID);
140 void SetItemLevel(vtkIdType itemID, std::string level);
142 std::string GetItemLevel(vtkIdType itemID);
144 void SetItemOwnerPluginName(vtkIdType itemID, std::string ownerPluginName);
146 std::string GetItemOwnerPluginName(vtkIdType itemID);
148 void SetItemExpanded(vtkIdType itemID,
bool expanded);
150 bool GetItemExpanded(vtkIdType itemID);
153 void SetItemUID(vtkIdType itemID, std::string uidName, std::string uidValue);
156 std::string GetItemUID(vtkIdType itemID, std::string uidName);
159 void SetItemAttribute(vtkIdType itemID, std::string attributeName, std::string attributeValue);
162 bool RemoveItemAttribute(vtkIdType itemID, std::string attributeName);
165 std::string GetItemAttribute(vtkIdType itemID, std::string attributeName);
168 std::vector<std::string> GetItemAttributeNames(vtkIdType itemID);
172 bool HasItemAttribute(vtkIdType itemID, std::string attributeName);
176 void ItemModified(vtkIdType itemID);
180 void RequestOwnerPluginSearch(vtkIdType itemID);
184 void RequestOwnerPluginSearch(
vtkMRMLNode* dataNode);
194 void SetItemDataNode(vtkIdType itemID,
vtkMRMLNode* dataNode);
203 vtkIdType CreateItem(vtkIdType parentItemID,
vtkMRMLNode* dataNode,
const char* ownerPluginName=
nullptr);
210 vtkIdType CreateHierarchyItem(vtkIdType parentItemID, std::string name, std::string level);
215 vtkIdType CreateSubjectItem(vtkIdType parentItemID, std::string name);
220 vtkIdType CreateStudyItem(vtkIdType parentItemID, std::string name);
225 vtkIdType CreateFolderItem(vtkIdType parentItemID, std::string name);
231 bool RemoveItem(vtkIdType itemID,
bool removeDataNode=
true,
bool recursive=
true);
236 bool RemoveItemChildren(vtkIdType itemID,
bool removeDataNodes=
true,
bool recursive=
true);
241 void RemoveAllItems(
bool removeDataNode=
false);
245 void SetItemParent(vtkIdType itemID, vtkIdType parentItemID,
bool enableCircularCheck=
true);
248 vtkIdType GetItemParent(vtkIdType itemID);
251 int GetItemPositionUnderParent(vtkIdType itemID);
254 vtkIdType GetItemByPositionUnderParent(vtkIdType parentItemID,
int position);
260 void GetItemChildren(vtkIdType itemID, std::vector<vtkIdType>& childIDs,
bool recursive=
false);
262 void GetItemChildren(vtkIdType itemID, vtkIdList* childIDs,
bool recursive=
false);
266 bool ReparentItemByDataNode(vtkIdType itemID,
vtkMRMLNode* newParentNode);
270 bool MoveItem(vtkIdType itemID, vtkIdType beforeItemID);
278 vtkIdType GetItemByUID(
const char* uidName,
const char* uidValue);
285 vtkIdType GetItemByUIDList(
const char* uidName,
const char* uidValue);
290 vtkIdType GetItemByDataNode(
vtkMRMLNode* dataNode);
295 vtkIdType GetItemByName(std::string name);
303 void GetItemsByName(std::string name, vtkIdList* foundItemIds,
bool contains=
false);
310 vtkIdType GetItemChildWithName(vtkIdType parentItemID, std::string name,
bool recursive=
false);
316 void GetDataNodesInBranch(vtkIdType itemID, vtkCollection* dataNodeCollection,
const char* childClass=
nullptr);
328 void SetDisplayVisibilityForBranch(vtkIdType itemID,
int visible);
332 int GetDisplayVisibilityForBranch(vtkIdType itemID);
337 void SetItemDisplayVisibility(vtkIdType itemID,
int visible);
339 int GetItemDisplayVisibility(vtkIdType itemID);
348 bool IsItemLevel(vtkIdType itemID, std::string level);
353 bool IsItemVirtualBranchParent(vtkIdType itemID);
361 std::string GetAttributeFromItemAncestor(vtkIdType itemID, std::string attributeName, std::string level=
"");
365 vtkIdType GetItemAncestorAtLevel(vtkIdType itemID, std::string level);
370 bool IsAnyNodeInBranchTransformed(vtkIdType itemID,
bool includeParentItem=
true,
vtkMRMLTransformNode* exceptionNode=
nullptr);
373 static void DeserializeUIDList(std::string uidListString, std::vector<std::string>& deserializedUIDList);
379 std::vector<vtkIdType> GetItemsReferencedFromItemByDICOM(vtkIdType itemID);
382 void GetItemsReferencedFromItemByDICOM(vtkIdType itemID, vtkIdList* referencingIdList);
388 std::vector<vtkIdType> GetItemsReferencingItemByDICOM(vtkIdType itemID);
391 void GetItemsReferencingItemByDICOM(vtkIdType itemID, vtkIdList* referencingIdList);
394 std::string GenerateUniqueItemName(std::string name);
397 int GetNumberOfItems();
401 int GetNumberOfItemChildren(vtkIdType itemID,
bool recursive=
false);
404 void PrintItem(vtkIdType itemID, ostream& os, vtkIndent indent);
414 static void ItemEventCallback(vtkObject* caller,
unsigned long eid,
void* clientData,
void* callData);
424 friend class vtkInternal;
virtual void WriteNodeBodyXML(ostream &of, int indent)
Write this node's body to a MRML file in XML format.
static const std::string SUBJECTHIERARCHY_VERSION_ATTRIBUTE_NAME
static const vtkIdType INVALID_ITEM_ID
vtkSmartPointer< vtkCallbackCommand > ItemEventCallbackCommand
Command handling events from subject hierarchy items.
void operator=(const vtkMRMLNode &)
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
MRML node to represent a complete subject hierarchy tree.
virtual void Copy(vtkMRMLNode *node)
Copy node contents from another node of the same type. Does not copy node ID and Scene. Performs deep copy - an independent copy is created from all data, including bulk data.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
static const std::string SUBJECTHIERARCHY_NAME_VALUE_SEPARATOR
Event invoked when item resolving finished (e.g. after scene import)
virtual void WriteXML(ostream &of, int indent)
static vtkIdType GetInvalidItemID()
Python accessor for the invalid ID.
static const std::string SUBJECTHIERARCHY_SEPARATOR
void PrintSelf(ostream &os, vtkIndent indent) override
Event invoked when item resolving starts (e.g. after scene import)
Abstract class that contains graphical display properties for displayable nodes.
virtual const char * GetNodeTagName()=0
Abstract Superclass for all specific types of MRML nodes.