#define MatStack tgt::Singleton<tgt::MatrixStack>::getRef()
此处用了Singleton这个设计模式,具体实现可参照博文
这里的MatStack应该是矩阵栈顶
MatStack.multMatrix(volumeInport_.getData()->getPhysicalToWorldMatrix());
下面是volumeBase类, volumeport 是继承至base,此处用了观察者设计模式,流程图的port间应该都是用观察者模式驱动的。
class VRN_CORE_API VolumeBase : public Observable<VolumeObserver>
class VolumePort : public GenericPort<VolumeBase>
geometrytransformation process仅仅是调用了Geometry*->transform(tgt::mat4)
VolumeBase*->getWorldToVoxelMatrix()
->getVoxelToWorldMatrix()
SliceViewer::screenToVoxelPos
4种coordinate
1. voxel
2. volume
3. texture
4. world
Volume IO:
Volume:public VolumeBase 这个类仅仅是一个包裹的指针,并不涉及内存管理.它包含一个vector存储volumeRAM
VolumeRAM : public VolumeRepresentation 管理raw data 但是无法进行任何OpenGL 操作
VolumeRAM_X是VolumeAtomic< x >的别名,这个类管理内存
VolumeAtomic : public VolumeRAM
newVolume = new VolumeAtomic<T>(dimensions_); // allocate a chunk of data
IO问题描述:
1. 不同类型文件的读取写入:不同的reader,writer(modules/base/io文件中),以及初始化合适的reader。工厂模式比较合适。
2. 内存管理:在不同的时候可能有多个指针(volumeBase*)指向这块内存,这保证了在共享时无需复制,但是在不同线程间是否需要信号量?,何时释放?
IO步骤:
URLProperty->SerialierPopulation->VolumeSerizlizer->read()
1. 在vector中找合适reader
2. reader.read()
1. 查看volume header
2. 分配内存
3. 新建一个volumeBase* handle指向它
4. 新建一个volumelist* 包括handle并返回
Volume representation
a class storing the volume data (the voxels) in some form
RepresentationConverter : public RepresentationConverterBase
ConverterFactory 使用了设计模式中的工厂模式,在知乎上看到一个例子比较好的介绍了这个设计模式:
假设有代码包A和代码包B,
代码包B是代码包A的调用者,A向B暴露接口InterfaceA。
在A的内部结构中,实现了InterfaceA的有ClassA1,ClassA2,ClassA3,……ClassA100。但是B并不关心这些,因为对于B来说,A的功能只有一个,就是InterfaceA。
这个时候,B想要使用一个InterfaceA的实现,想要new一个出来,但又不想与代码包A中的复杂的构造逻辑耦合,怎么办?只能向代码包A中传递参数,交给代码包A自己选择到底是那个ClassA1还是A100被new出来。 而这个对构造过程进行选择的逻辑,就是工厂。
作者:兔子先生 链接:https://www.zhihu.com/question/24843188/answer/29171607
来源:知乎 著作权归作者所有,转载请联系作者获得授权。
voreen中的实现在于一个vector容器,制造的时候传入volume source,工厂在容器中找第一个能转变的converter。也就是说容器中converter类的顺序是重要的。
volume decorator
volume struct 运用了decorator设计模式:
装饰基类:
VolumeDecoratorIdentity : public VolumeBase, public VolumeObserver
装饰类:
- VolumeDecoratorReplace: Decorates a Volume, replacing a metadata item.
- VolumeDecoratorReplaceTransformation:replacing its physical-to-world transformation matrix.
- VolumeDecoratorReplaceSpacing:replacing its voxel spacing.
- VolumeDecoratorReplaceOffset: replacing its offset in physical coordinates.
- VolumeDecoratorReplaceRealWorldMapping: replacing its real-world mapping.
- VolumeDecoratorReplaceTimestep: replacing its timestep.
- 加粗
Ctrl + B
- 斜体
Ctrl + I
- 引用
Ctrl + Q
- 插入链接
Ctrl + L
- 插入代码
Ctrl + K
- 插入图片
Ctrl + G
- 提升标题
Ctrl + H
- 有序列表
Ctrl + O
- 无序列表
Ctrl + U
- 横线
Ctrl + R
- 撤销
Ctrl + Z
- 重做
Ctrl + Y
Markdown及扩展
#define MatStack tgt::Singleton<tgt::MatrixStack>::getRef()
此处用了Singleton这个设计模式,具体实现可参照博文
这里的MatStack应该是矩阵栈顶
使用简单的符号标识不同的标题,将某些文字标记为粗体或者斜体,创建一个链接等,详细语法参考帮助?。
本编辑器支持 Markdown Extra , 扩展了很多好用的功能。具体请参考Github.
表格
Markdown Extra 表格语法:
项目 | 价格 |
---|---|
Computer | $1600 |
Phone | $12 |
Pipe | $1 |
可以使用冒号来定义对齐方式:
项目 | 价格 | 数量 |
---|---|---|
Computer | 1600 元 | 5 |
Phone | 12 元 | 12 |
Pipe | 1 元 | 234 |
定义列表
-
Markdown Extra 定义列表语法: 项目1 项目2
- 定义 A
- 定义 B 项目3
- 定义 C
-
定义 D
定义D内容