Algorithm@Volume Rendering
Misc Stream
vtkStreamingDemandDrivenPipeline
Executive supporting partial updates.
vtkStreamingDemandDrivenPipeline is an executive that supports updating only a portion of the dataset in the pipeline. This is the style of pipeline update that is provided by the old-style VTK 4.x pipeline. Instead of always updating an entire dataset, this executive supports asking for pieces or sub-extents.
範例:
vtkStreamingDemandDrivenPipeline *exec=
vtkStreamingDemandDrivenPipeline::SafeDownCast(elev->GetExecutive());
exec->SetUpdateNumberOfPieces(exec->GetOutputInformation(0), numProcs);
exec->SetUpdatePiece(exec->GetOutputInformation(0), myid);
APIs:
int PropagateUpdateExtent(int outputPort) int SetUpdateExtentToWholeExtent(vtkInformation *) virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) virtual int Update() virtual int Update(int port) virtual int UpdateWholeExtent() int SetMaximumNumberOfPieces(vtkInformation *, int n) int GetMaximumNumberOfPieces(vtkInformation *) int SetWholeExtent(vtkInformation *, int extent[6]) void GetWholeExtent(vtkInformation *, int extent[6]) int *GetWholeExtent(vtkInformation *) int SetUpdateExtent(vtkInformation *, int extent[6]) void GetUpdateExtent(vtkInformation *, int extent[6]) int *GetUpdateExtent(vtkInformation *) int SetUpdateExtent(vtkInformation *, int piece, int numPieces, int ghostLevel) int SetUpdatePiece(vtkInformation *, int piece) int GetUpdatePiece(vtkInformation *) int SetUpdateNumberOfPieces(vtkInformation *, int n) int GetUpdateNumberOfPieces(vtkInformation *) int SetUpdateGhostLevel(vtkInformation *, int n) int GetUpdateGhostLevel(vtkInformation *) int SetRequestExactExtent(int port, int flag) int GetRequestExactExtent(int port) int SetExtentTranslator(vtkInformation *, vtkExtentTranslator *translator) vtkExtentTranslator *GetExtentTranslator(vtkInformation *info) int SetWholeBoundingBox(int port, double bb[6]) void GetWholeBoundingBox(int port, double bb[6]) double *GetWholeBoundingBox(int port)
Misc Filters
vtkElevationFilter
generate scalars along a specified direction.
vtkElevationFilter is a filter to generate scalar values from a dataset. The scalar values lie within a user specified range, and are generated by computing a projection of each dataset point onto a line. The line can be oriented arbitrarily. A typical example is to generate scalars based on elevation or height above a plane.
vtkElevationFilter範例:
vtkElevationFilter *elev = vtkElevationFilter::New();
elev->SetInput( shrink->GetOutput() );
elev->SetLowPoint(-1,-1,-1);
elev->SetHighPoint( 1, 1, 1);
elev->SetScalarRange(0,1);
或是在ParallelIso之中的例子
vtkElevationFilter *elev=vtkElevationFilter::New();
elev->SetInput(iso->GetOutput());
val = (myid+1) / static_cast(numProcs);
elev->SetScalarRange(val, val+0.001);
APIs:
- SetLowPoint: Define one end of the line (small scalar values).
- SetHighPoint: Define other end of the line (large scalar values).
- SetScalarRange: Specify range to map scalars into.
vtkMarchingCube@Isosurface
vtkMPI Misc API
要使用vtk作到平行化的應用程式,需要用到vtkMultiProcessController, vtkMPIController。
Parallel Pipeline:
- Initialize():
- The use of user-defined communicators are supported with vtkMPICommunicator and vtkMPIGroup.
- SetSingleMethod()
- SingleMethodExecute()
- Finalize():
作者為Geveci, Berk
API@vtkMPIController列表:
virtual void Initialize(int *argc, char ***argv) virtual void Finalize() virtual void SingleMethodExecute() virtual void MultipleMethodExecute() void Barrier() virtual void CreateOutputWindow() void SetCommunicator(vtkMPICommunicator *comm) int NoBlockSend(int *data, int length, int remoteProcessId, int tag, vtkMPICommunicator::Request &req)
Hi,
I am doing some research on medical visualization and real time volume
rendering. About display the reconstruction result, there are many system and algorithm
.
About reconstruction, I think the segmentation is key problem. Many company
or reseacrh unit use human expert to complish this task. In this area, some image
processing technique can be used but interaction by people is hardly avoid.
About rendering the reconstruction result or segmentation result, it is
a hot point in computer graphics. (that is what I do now). Two famous software
(free) is VTK and VolVis. These two system can be extend by yourself. I think it can
be satisfy your demand for display.
The problem for display 3D model od resconstrction is the data is too large
, so that it must be handled for several minutes and occupy a lot of memory. Extract
isosurface or disply volume data directlyare two methods fro display it. Both are slow
but the former is faster than later.
For visualization, the IEEE Visualization proceeding is a good collection
. Many new technique can be found in it. The 90, 91,92,93,94 can be found in tsinghua
library in microphoto format. Another publish collection is Visualization on
Biomedical computing proceeding and SPIE medical imaging series.
I expect we can discuss and study together or same interests by email.
BTW, there are Vis FAQ in Ohio university web site. I will post the address
here ASAP. Vtk Pipelines
- 讀入Datasets: 使用vtkImageReader, vtkDICOMImageReader...各類不同的Reader,將資料讀入,然後讀轉出成Geometry資訊。
- 設定屬性(Property): 使用vtkVolumeProperty作出VolProperty物件,再使用vtkPiecewiseFunction, vtkColorTransferFunction設定VolProperty的不透明度、顏色...的屬性,然後藉由SetScalarOpacity(Piecewise), SetColor(Color), SetInterpolationTypeToLinear(), ShadeOn(),來設定VolProperty的屬性。
- 設定幾何資訊(Mapper): 利用vtkVolumeRayCastMapper, vtkFixedPointVolumeRayCastMapper作出VolMapper物件。
- Actor2D, Actor, vtkVolume
- vtkRenderer
- RenderWindow
- RenderWindowInteractor, InteractorStyle
vtkDICOMImageReader API
所有的Member Functions列表:
void PrintSelf(ostream &os, vtkIndent indent) void SetDirectoryName(const char *dn) double *GetPixelSpacing() int GetWidth() int GetHeight() float *GetImagePositionPatient() int GetBitsAllocated() int GetPixelRepresentation() int GetNumberOfComponents() const char *GetTransferSyntaxUID() float GetRescaleSlope() float GetRescaleOffset() const char *GetPatientName() const char *GetStudyUID() const char *GetStudyID() float GetGantryAngle() virtual int CanReadFile(const char *fname) void SetFileName(const char *fn) virtual char *GetDirectoryName()
Pipelines@Volume Rendering
vtkImageData
topologically and geometrically regular array of data
vtkImageData is a data object that is a concrete implementation of vtkDataSet. vtkImageData represents a geometric structure that is a topological and geometrical regular array of points. Examples include volumes (voxel data) and pixmaps.
vtkFixedPointVolumeRayCastCompositeHelper -- A helper that generates composite images for the volume ray cast mapper. It will generate composite images using an alpha blending operation.
vtkFixedPointVolumeRayCastCompositeGOHelper -- A helper that generates composite images for the volume ray cast mapper.
想要使用VTK,作出Volume Render的應用程式(最終還是要作出Parallel化的版本),其間的Pipeline應為:
- 讀資料: 使用vtkImageReader類別,作出 ImgReader物件,然後使用SetFileName, SetDataScalarTypeToFloat, SetDataByteOrderToBigEndian, SetFileDimensionality, SetDataExtent, SetDataSpacing, SetHeaderSize..., 最後再用 Update來讀入這些圖形檔案(png, jpeg, dicom...)、或是raw-data(.vtk)的資訊。
- 設定VolRndr物件的Property: 使用vtkVolumeProperty作出VolProperty物件,然後使用
VolProperty->SetScalarOpacity(opacity); VolProperty->SetColor(color);
呼叫,加入Color、或是Piecewise的屬性。 - Piecewise屬性: 使用vtkPiecewiseFunction作出Opacity物件,然後使用
Opacity->AddPoint(500, 0.1)
呼叫,加入各點不透明度的資訊。 - Color屬性: 使用vtkColorTransferFunction作出Color物件,然後使用
Color->AddRGBPoint(0, 0.3, 0.3, 1.0)
呼叫,加入RGB顏色的資訊。 - 融合屬性: 使用vtkVolumeRayCastCompositeFunction作出compositeFun物件,目的是為了融合之前所作出Color屬性或是Piecewise屬性。
- 產生Geometry資訊: 使用vtkVolumeRayCastMapper,或是vtkFixedPointVolumeRayCastMapper作出VolMapper物件,兩者的區別,請看以下的說明:
VolMapper->SetVolumeRayCastFunction(Composite); //將Color、Piecewise的屬性,融合於VolProperty物件。 VolMapper->SetInput(ImgReader->GetOutput()); //將ImgReader讀入的Datasets轉成Geometry資訊。
- 使用vtkVolume作出VolRndr:
VolRndr->SetMapper(VolMapper); //加入VolMapper的幾何資訊 VolRndr->SetProperty(VolProperty); //加入VolProperty的顏色、Piecewise屬性。
- 使用vtkRenderer作出Rndr物件:
Rndr->AddVolume(VolRndr); //在記憶體中繪製VolRndr物件 Rndr->SetBackground(1., 1., 1.); //設定Rndr物件的屬性
- 使用vtkRenderWindow作出繪製視窗RndrWin物件:
RndrWin->AddRenderer(Rndr); //繪製視窗加入render物件 RndrWin->SetSize(500,500); //設定視窗大小屬性 RndrWin->SetInteractor(InterRen); //也可以加入繒製互動式視窗物件InterRen
- 使用vtkRenderWindowInteractor作出繪製互動視窗InterRen
RndrWin->Render(); //開始繪製 InterRen->Start(); //開始互動式視窗
vtkVolumeRayCastMapper vs. vtkFixedPointVolumeRayCastMapper
vtkVolumeRayCastMapper可以用來作isosurface,而處理的資料型態為unsigned char或是unsigned short。 vtkFixedPointVolumeRayCastMapper的資料型態為short或是more than one component,處理的範圍為unsigned char到double。Features of vtkFixedPointVolumeRayCastMapper
Space leaping is performed by creating a sub-sampled volume. 4x4x4 cells in the original volume are represented by a min, max, and combined gradient and flag value. The min max volume has three unsigned shorts per 4x4x4 group of cells from the original volume - one reprenting the minumum scalar index (the scalar value adjusted to fit in the 15 bit range), the maximum scalar index, and a third unsigned short which is both the maximum gradient opacity in the neighborhood (an unsigned char) and the flag that is filled in for the current lookup tables to indicate whether this region can be skipped.
Medical ITK
專針對醫學影像格式用的圖形函式庫MITK(Medical Image Toolkit)。
cvs snapshot
cvs -d :pserver:anonymous@mbi.dkfz-heidelberg.de:/usr/local/cvsroot login cvs -d :pserver:anonymous@mbi.dkfz-heidelberg.de:/usr/local/cvsroot co mitk
安裝方式和VTK一樣,但要ITK要先安裝起來
mkdir MitkBuild cd Mitkbuild ccmake ../mitk
但安裝前要先安裝ITK(Insight Segmentation and Registration Toolkit)
cvs -d :pserver:anoncvs@www.itk.org:/cvsroot/Insight login(empty password) cvs -d :pserver:anoncvs@www.itk.org:/cvsroot/Insight co Insight cvs -d :pserver:anoncvs@www.itk.org:/cvsroot/Insight co InsightDocuments cvs -d :pserver:anoncvs@www.itk.org:/cvsroot/Insight co InsightApplications
Parallel Rendering@學術機構
parallel volume render "paraview" site:public.kitware.com,會有比較好的搜尋結果出現。
打入"vtk parallel volume render Los Alamos",google就找出了學術搜索的文件ParallelApproach4EfficientlyVisualizing.pdf,在Los Alamos與Argonne學術領域的機構,對於"Visulization Large-Scale Time-varing Scientific Datasets"的需求是一致的。
可以聯絡的作者有:C. Charles Law, Amy Henderson -- Kitware Incorporated James Ahrens -- Los Alamos National LaboratoryStandford大學有開發關於volume rendering的技術。
Free Virtual Reality
http://mecca.louisville.edu/Staff/Sites/vtkFVR.html http://mecca.louisville.edu/Staff/Sites/vtkfvr.tar.gz http://www.freevr.org http://www.cvip.uofl.edu/~chuck
Triangles from 3D-Points
vtkPolyDataReader reader
reader SetFileName "../vtkData/assignment1.vtk"
reader Update
vtkPolyData data
data SetPoints [[reader GetOutput] GetPoints]
vtkDelaunay3D del
del SetInput data
del BoundingTriangulationOn
del SetTolerance 0.01
del SetAlpha 0.2
del BoundingTriangulationOff
vtkShrinkFilter shrink
shrink SetInput [del GetOutput]
shrink SetShrinkFactor 0.9
vtkElevationFilter elevation
elevation SetInput [shrink GetOutput]
elevation SetLowPoint 0 0 0
elevation SetHighPoint 0 0 1
eval elevation SetScalarRange 0 1
elevation ReleaseDataFlagOn
vtkWarpScalar warp
warp SetInput [elevation GetOutput]
warp SetScaleFactor -0.1vtkParallel Tests
Volume rendering of data stored in unstructured grid可使用vtkUnstructuredGridVolumeMapper來處理,可看範例程式 -- classvtkUnstructuredGridVolumeMapper。
vtkParallelCoordinatesActor
* Tcl - /Rendering/Testing/Tcl/TestParallelCoordinates.tcl
vtkParallelFactory
* C++
- /Parallel/Testing/Cxx/GenericCommunicator.cxx
- /Parallel/Testing/Cxx/MPIGroups.cxx
- /Parallel/Testing/Cxx/ParallelIso.cxx
- /Parallel/Testing/Cxx/TestPStream.cxx
- /Parallel/Testing/Cxx/ThreadedCommunicator.cxx
* Tcl - /Common/Testing/Tcl/TestSetGet.tcl
- /Parallel/Testing/Tcl/TestPolyDataPieces.tcl
- /Parallel/Testing/Tcl/TestUnstructuredPieces.tcl
vtkParallelRenderManager
* C++ - /Parallel/Testing/Cxx/PrmMagnify.cxx