1 数据封装
-
所有数据对象如image或surface都包含在DataNode中,这些DataNode描述数据本身(mitk::BaseData及其派生类),如:
- 以二维或三维的渲染方式呈现(一个mitk::Mapper列表); - 与它关联的交互器mitk::Interactor; - 属性列表如名称、可视性和不透明度等;
-
关于数据对象在空间/时间中的位置信息被存储在一个被附着在数据本身的Geometry中,而不是附着在节点DataNode;
-
BaseData:mitk::BaseData是所有数据对象的基类,它继承自itk::DataObject;
-
DataNode:这个类封装了BaseData对象并提供统一的处理;
-
DataStorage:MITK DataStorage用于管理和存储DataNode,它提供如下功能:
- 添加和删除节点; - 高级功能如:获取当前DataStorage中所有特定数据类型(如image或surface)、特定名称或其他属性的数据节点DataNode; - 示例:
mitk::DataNode::Pointer resultNode = mitk::DataNode::New(); // create data node
std::string nameOfResultImage = node->GetName(); // get property "name" of the original node,this is a convenience method
nameOfResultImage.append("Otsu"); // extend the "name" to "nameOtsu"
resultNode->SetProperty("name", mitk::StringProperty::New(nameOfResultImage) ); // write name property to new node
resultNode->SetProperty("binary", mitk::BoolProperty::New(true) ); // set binary property of new node true
resultNode->SetData( mitk::ImportItkImage ( filter->GetOutput() ) ); // set data of new node
this->GetDataStorage()->Add(resultNode, node); // add new node to datastorage
- 添加一个自己的数据类型
步骤:
(1)添加你的数据类型;
(2)添加reader和writer并且register它们;
(3)添加mapper;