vtkImageReslice: can not get slice, extent are all 0
I have a series of images, each of which stores its pixel data (double) in
m_pImagePixel. I would like to get the slice along x, y and z directions at
center of pixel data block. Following are what I did.
1. create image pixel data of whole series : p3DImageData.
2. use vtkImageImporter to load p3DImageData;
3. use vtkImageReslice to get data from vtkImageImporter;
4. get slice along x,y,z.
Following is the code. I used three 4x4 matrix to change direction and get
images by using the same m_reslice. However,
(1) the extent are 0, regardless which direction is used;
(2) when axialElements is used, I can get correct pixel data for display.
But using coronalElements and sagittalElements generate messy pixel data in
void * p = m_reslice->GetOutput()->GetScalarPointer();
memcpy( pAxialSliceData, (double *)p, image_width * image_height*
// when changed to coronal or sagital directions, differnet 4x4 matrix is
used and memcpy() will use image_width * image_depth * sizeof (double) and
image_height * image_depth * sizeof (double) respectively .