VTK相關(guān)

Extents

The extent of a dataset is a set of 6 integers. It says what the first and last pixel indices are in each of the three directions. E.g.

int extent[6] = { i_min, i_max, j_min, j_max, k_min, k_max };

VTK images (and grids) do not always start at (i,j,k) = (0,0,0). They can start anywhere. They can even start at negative indices. One of the beautiful things about the VTK streaming pipeline is that VTK can take just one slice of an image e.g. at k=10 and pass just that one slice along the pipeline.

一個Dataset的Extent是一組6個整數(shù)。它指的是三個方向中每個方向的第一個和最后一個像素的索引。

VTK圖像(和網(wǎng)格)并不總是從(i,j,k)=(0,0,0)開始。它們可以從任何地方開始,甚至可以從負數(shù)的索引開始。VTK流水線管道的一個優(yōu)點之處在于,VTK可以只取圖像的一個Slice,例如,在k=10時,只將這一個Slice沿著流水線管道傳遞。


Bounds

The Bounds of an image are

double bounds[6] = { i_min*Spacing[0] + Origin[0], i_max*Spacing[0] + Origin[0],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? j_min*Spacing[1] + Origin[1], j_max*Spacing[1] + Origin[1],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? k_min*Spacing[2] + Origin[2], k_max*Spacing[2] + Origin[2] };

You can't directly set the bounds. First you need to decide how many pixels across your image will be (i.e. what the extent should be), and then you must find the origin and spacing that will produce the bounds that you need from the extent that you have. This is simple algebra.

In general, always set the extent to start at zero, e.g. [0, 9, 0, 9, 0, 9] for a 10x10x10 image. Calling SetDimensions(10,10,10) does exactly the same thing as SetExtent(0,9,0,9,0,9) but you should always do the latter to be explicit about where your extent starts.

你不能直接設(shè)置Bounds。首先你需要決定你的圖像將有多少像素(即Extent應(yīng)該是多少),然后你必須找到Origin(原點)和Spacing(間隔),以便從你的Extent中產(chǎn)生你需要的Bounds。

一般來說,總是將Extent設(shè)置為從0開始,例如,對于一個10x10x10的圖像,Extent為[0, 9, 0, 9, 0, 9]。調(diào)用SetDimensions(10,10,10)和SetExtent(0,9,0,9,0,9)的作用完全一樣,但你應(yīng)該總是使用后者(即SetExtent)來明確你的Extent從哪里開始。


參見:https://vtk.org/Wiki/VTK/Tutorials/Extents

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容