[vtk-developers] vtkImageReslice with the problem of slice original

Jason 2130220212 at email.szu.edu.cn
Thu Apr 30 14:19:13 EDT 2015


Hi, David 

I cannot set the parameters like SetOutputOrigin, SetOutputSpacing,and
SetOutputExtent for vtkImageReslice, as I get a slice image by the cosin
value and one point's position.It will get a wrong slice if I set these
paremeters for vtkImageReslice, and here is my code:
static double axialElements[16] = {
	1, 0, 0, 0,
	0, 0.866025, -0.5, 0,
	0, 0.5, 0.866025, 0,
	0, 0, 0, 1 };	

vtkSmartPointer<vtkMatrix4x4> resliceAxes =
vtkSmartPointer<vtkMatrix4x4>::New();
resliceAxes->DeepCopy(axialElements);	
resliceAxes->SetElement(0, 3, 10);
resliceAxes->SetElement(1, 3, 10);
resliceAxes->SetElement(2, 3, 10);

vtkSmartPointer<vtkImageReslice> reslice =
vtkSmartPointer<vtkImageReslice>::New();
reslice->SetInput(connector->GetOutput());
reslice->SetOutputDimensionality(2);
reslice->SetResliceAxes(resliceAxes);
reslice->SetInterpolationModeToLinear();
reslice->AutoCropOutputOn();

vtkSmartPointer<vtkLookupTable> colorTable =
vtkSmartPointer<vtkLookupTable>::New();
colorTable->SetRange(0, 1000);
colorTable->SetValueRange(0.0, 1.0);
colorTable->SetSaturationRange(0.0, 0.0);
colorTable->SetRampToLinear();
colorTable->Build();

My purpose is to calculate the origin of image(2D) in 3D volume position,and
I can only get the bounds of the slice image through vtkImageActor :
vtkSmartPointer<vtkImageMapToColors> colorMap =
vtkSmartPointer<vtkImageMapToColors>::New();
colorMap->SetLookupTable(colorTable);
colorMap->SetInputConnection(reslice->GetOutputPort());

vtkSmartPointer<vtkImageActor> imgActor =
vtkSmartPointer<vtkImageActor>::New();
imgActor->SetInput(colorMap->GetOutput());
double extent[6]={0};
imgActor->GetBounds(extent);

Can I take point'(extent[0],extet[2]) as the original position of the slice
image ?
And calculate its corresponding position in 3D volume by  point = M*point' ?

I'm not so sure if this is right or not. Maybe there is a way to get the
original position(2D) by vtkImageReslice itself.





--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageReslice-with-the-problem-of-slice-original-tp5731694p5731718.html
Sent from the VTK - Dev mailing list archive at Nabble.com.


More information about the vtk-developers mailing list