I want to get a slice by codes as below, and I can get the image.but I want to know how to get the
slice image’s size, its width and height.
static double obliqueX[3] = { cos(angle), 0, -sin(angle) };
static double obliqueY[3] = { 0, 1, 0 };
static double obliqueZ[3] = { sin(angle), 0, cos(angle) };
vtkSmartPointer<vtkMatrix4x4> resliceAxes =
vtkSmartPointer<vtkMatrix4x4>::New();
vtkSmartPointer<vtkImageReslice> reslice =
vtkSmartPointer<vtkImageReslice>::New();
reslice->SetInputData(m_ImageData);
reslice->SetOutputDimensionality(2);
reslice->SetResliceAxesDirectionCosines(obliqueX, obliqueY, obliqueZ);
reslice->SetResliceAxesOrigin(center);
reslice->SetInterpolationModeToLinear();
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();
vtkSmartPointer<vtkImageMapToColors> colorMap =
vtkSmartPointer<vtkImageMapToColors>::New();
colorMap->SetLookupTable(colorTable);
colorMap->SetInputConnection(reslice->GetOutputPort());
colorMap->Update();