shamantou blog site

shamantou@gmail.com

导航

vtkImageReslice
if(!image)image=getImageData();
int* n = image->GetExtent();
//int nPos= (n[5]-n[4])/2;
if(!resliceSagittal)resliceSagittal=vtkImageReslice::New();
resliceSagittal->SetInput(image);
resliceSagittal->GetInput()->SetUpdateExtentToWholeExtent();
resliceSagittal->SetResliceAxesOrigin(0,0,0);
resliceSagittal->SetOutputDimensionality(2);
resliceSagittal->SetOutputSpacing(DataSpacing[0],DataSpacing[1],DataSpacing[2]);
resliceSagittal->InterpolateOn();
resliceSagittal->SetResliceAxesDirectionCosines(1,0,0,
0,1,0,
0,0,1);
resliceSagittal->Update();
resliceSagittal->SetBackgroundLevel(Form1->wcenter+30);

vtkImageMapToWindowLevelColors *sagColors=vtkImageMapToWindowLevelColors::New();
sagColors->SetInput(resliceSagittal->GetOutput());
sagColors->SetWindow(Form1->wwidth);
sagColors->SetLevel(Form1->wcenter);
Form1->wwidth=sagColors->GetWindow();
Form1->wcenter=sagColors->GetLevel();

_planeActorXY2=vtkImageActor::New();
_planeActorXY2->SetInput(sagColors->GetOutput());
_xRenderer->AddProp(_planeActorXY2);

sagColors->Delete();


Hi Sebastien,

The SetResliceAxesDirectionCosines() takes 3 vectors to make the
class more general, i.e. to allow a person to specify the x,y,z
axes of an output volume. For a single slice, take the cross
product of the x and y vectors to get a z vector. Then, use
SetResliceAxesOrigin() to specify a point that lies on the slice
plane.

- David


最后一个参数用于指定在面上面的一个点


数据分析,可以得到,vtkimagereslice返回的2个点为相对的顶点坐标,是实际在空间中的位置坐标,origin返回的是实际的平面的中心坐标。

app->p3DSurfaceView4->pSection->GetPoint1(xyz1);
app->p3DSurfaceView4->pSection->GetPoint2(xyz2);
app->p3DSurfaceView4->pSection->GetNormal(normal);
app->p3DSurfaceView4->pSection->GetOrigin(origin);

TRACE("xyz1:%f\t%f\t%f\n",xyz1[0],xyz1[1],xyz1[2]);
TRACE("xyz2:%f\t%f\t%f\n",xyz2[0],xyz2[1],xyz2[2]);
TRACE("normal:%f\t%f\t%f\n",normal[0],normal[1],normal[2]);
TRACE("origin:%f\t%f\t%f\n\n",origin[0],origin[1],origin[2]);



xyz1:249.755737 -0.244141 80.844879
xyz2:-0.244141 249.755737 80.844879
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 80.844879

xyz1:249.755737 -0.244141 85.007439
xyz2:-0.244141 249.755737 85.007439
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 85.007439

xyz1:249.755737 -0.244141 85.701200
xyz2:-0.244141 249.755737 85.701200
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 85.701200

xyz1:249.755737 -0.244141 86.394960
xyz2:-0.244141 249.755737 86.394960
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 86.394960

xyz1:249.755737 -0.244141 87.088720
xyz2:-0.244141 249.755737 87.088720
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 87.088720

xyz1:249.755737 -0.244141 88.476240
xyz2:-0.244141 249.755737 88.476240
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 88.476240

xyz1:249.755737 -0.244141 89.170000
xyz2:-0.244141 249.755737 89.170000
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 89.170000

xyz1:249.755737 -0.244141 91.251280
xyz2:-0.244141 249.755737 91.251280
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 91.251280

xyz1:249.755737 -0.244141 91.945040
xyz2:-0.244141 249.755737 91.945040
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 91.945040

xyz1:249.755737 -0.244141 92.638800
xyz2:-0.244141 249.755737 92.638800
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 92.638800

xyz1:249.755737 -0.244141 94.720080
xyz2:-0.244141 249.755737 94.720080
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 94.720080

xyz1:249.755737 -0.244141 95.413841
xyz2:-0.244141 249.755737 95.413841
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 95.413841

xyz1:249.755737 -0.244141 101.657681
xyz2:-0.244141 249.755737 101.657681
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 101.657681

xyz1:249.755737 -0.244141 112.757842
xyz2:-0.244141 249.755737 112.757842
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 112.757842

xyz1:249.755737 -0.244141 119.695443
xyz2:-0.244141 249.755737 119.695443
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 119.695443

xyz1:249.755737 -0.244141 126.633044
xyz2:-0.244141 249.755737 126.633044
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 126.633044

xyz1:249.755737 -0.244141 128.020564
xyz2:-0.244141 249.755737 128.020564
normal:0.000000 0.000000 1.000000
origin:-0.244141 -0.244141 128.020564
<< C++常见实用库域名过户的问题 >>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最近发表

Powered By Z-Blog 1.8 Arwen Build 81206 Copyright 2006-2009 | ooplab.org | shamantou@gmail.com | 沪ICP备08011244号 | Some Rights Reserved.