日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

vtk类之vtkImageReslice:基本算法,对体数据沿着轴进行切片

發(fā)布時(shí)間:2024/7/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vtk类之vtkImageReslice:基本算法,对体数据沿着轴进行切片 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

沿著軸方向切割體數(shù)據(jù)。

vtkImageReslice 是幾何圖形過(guò)濾器中的瑞士軍刀。他可以排列,旋轉(zhuǎn),翻轉(zhuǎn),縮放,重新采樣,變形, 還有隨意再任何效率與圖像質(zhì)量組合下,渲染圖像。簡(jiǎn)單的操作,像排列,重新采樣和渲染高效功能,與被人所熟知的vtkImagePermute、 vtkImageResample 和 vtkImagePad一樣。有一些任務(wù),vtkImageReslice更適合做這些事情。

1)對(duì)一個(gè)圖像應(yīng)用簡(jiǎn)單的旋轉(zhuǎn),縮放和平移。有一個(gè)更好的注意是,先使用vtkImageChangeInformation,把圖像的坐標(biāo)系原點(diǎn)更新到圖像中心點(diǎn),以便尺度和旋轉(zhuǎn)發(fā)生中心而不是環(huán)繞圖像的左下角。

2)通過(guò)方法SetInformationInput對(duì)一個(gè)數(shù)據(jù)集重新采樣,以匹配另一個(gè)數(shù)據(jù)集。例如,比較兩個(gè)圖像或者組合兩幅圖像。可以我不在同一個(gè)坐標(biāo)系空間上的2幅圖像,同時(shí)通過(guò)方法SetResliceTransform 應(yīng)用線性或非線性變換。

3)從一個(gè)體數(shù)據(jù)中提取圖像切片卷。最方便的方法來(lái)執(zhí)行此操作是使用 SetResliceAxesDirectionCosines() 指定切片的方向。方向余弦形式給出 x、 y 和 z 軸的輸出向量。SetOutputDimensionality(2) 用于指定的方法想要輸出一個(gè)切片,而不是一個(gè)卷。SetResliceAxesOrigin()方法,設(shè)置切片將經(jīng)過(guò)的該origin空間點(diǎn)。你也可以同時(shí)使用ResliceAxes 和ResliceTransform ,為了從體數(shù)據(jù)中導(dǎo)出切片序列,你需要應(yīng)用變換信息。transformation?

應(yīng)用實(shí)例:

#-*- coding: UTF-8 -*- #------------------------------------------------------------------------------- # Name: 模塊2 # Purpose: # # Author: ankier # # Created: 07-01-2013 # Copyright: (c) Ankier 2013 # Licence: <your licence> #-------------------------------------------------------------------------------from ActorFactory import ActorFactory from vtk import * from glo import *class ResliceActorFactory(ActorFactory):def __init__(self):ActorFactory.__init__(self)#定義一塊板子self.__PlaneSource = vtkPlaneSource()self.__PlaneSource.SetOrigin(-50, -50, 0)self.__PlaneSource.SetPoint1(50, -50 , 0)self.__PlaneSource.SetPoint2(-50 , 50 , 0) self.__PlaneSource.SetXResolution(50)self.__PlaneSource.SetYResolution(50)self.__Input = None#定義圖像切片類self.__ImageReslice = vtkImageReslice()globalInstance = Global.GetInstance()transform = globalInstance.GetOrthoViewFrame().GetOrthoPlanesFactory().GetAxialPlane()._Transformprint transformself.__ImageReslice.SetResliceTransform(transform)self.__ImageReslice.InterpolateOn()self.__ImageReslice.SetOptimization(2)self.__ImageReslice.SetBackgroundLevel(1023)self.__ImageReslice.SetInterpolationModeToLinear()self.__ImageReslice.SetOutputDimensionality(2)self.__LookupTable = vtkLookupTable() self.__LookupTable.SetNumberOfTableValues(256)self.__LookupTable.Build()for i in range(256):self.__LookupTable.SetTableValue(i, i/255.0, i/255.0, i/255.0)self.__MapToColor = vtkImageMapToColors()self.__MapToColor.SetLookupTable(self.__LookupTable)self.__MapToColor.SetInputConnection(self.__ImageReslice.GetOutputPort())#設(shè)置板子的紋理映射類self.__TexturePlane= vtkTextureMapToPlane()self.__TexturePlane.SetInput(self.__PlaneSource.GetOutput())#設(shè)置紋理類。self.__Texture = vtkTexture()self.__Texture.InterpolateOn()self.__Texture.RepeatOff() # only necessary if interpolation is on#設(shè)置Poly Data,從紋理映射器重,得到被filter的輸出數(shù)據(jù)self.__PolyDataMapper = vtkPolyDataMapper()self.__PolyDataMapper.SetInput(self.__TexturePlane.GetOutput())def UpdateData(self):(min,max) = self.__Input.GetScalarRange() self.__LookupTable.SetTableRange(min,max)self.__ImageReslice.SetInput(self.__Input)self.__Texture.MapColorScalarsThroughLookupTableOff()self.__Texture.SetInput(self.__MapToColor.GetOutput())def SetInput(self, input):self.__Input = inputdef _MakeActors(self):self.UpdateData()actor = self._NewActor()actor.SetMapper(self.__PolyDataMapper)actor.SetTexture(self.__Texture)return [actor]

?

轉(zhuǎn)載于:https://www.cnblogs.com/ankier/archive/2013/01/07/2850192.html

總結(jié)

以上是生活随笔為你收集整理的vtk类之vtkImageReslice:基本算法,对体数据沿着轴进行切片的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。