[vtkusers] Problems with vtkImageReslice

wvalenzuela waldo.valenzuela at hotmail.com
Thu Sep 13 03:57:13 EDT 2012


I am new in vtk, and I am working with vtkImageReslice to get image from a
volume of images. I don't understand how vtkImageReslice compute the width
and height of the image that produce.

My data is: 12 images of 512x512 pixels, pixelspace is 0.55x0.55, space
between slice is 5.6.

I am using this code to read the data:
        vtkImageImport		*reader = vtkImageImport::New();
    
	reader->SetWholeExtent(0, 512, 0, 512, 0, 12);
	reader->SetDataSpacing(0.55, 0.55, 5.6);
	reader->SetDataOrigin( -115.9,-211.13,-35.52);
	reader->SetDataExtentToWholeExtent();
	reader->SetImportVoidPointer(outdata);
	reader->SetDataScalarTypeToFloat();

to read a orthogonal cutting plane YZ slice, located in  the middle of the
volume,  I use this:

        vtkImageReslice *w_sliceplane = vtkImageReslice::New();
	w_sliceplane->SetAutoCropOutput( true);
	w_sliceplane->SetInformationInput( reader->GetOutput());
	w_sliceplane->SetInput(reader->GetOutput());
	w_sliceplane->SetOptimization( true);
	w_sliceplane->SetResliceAxesOrigin(24.1, -71.1, -1.9);// middle of the
volume.
	w_sliceplane->SetInterpolationModeToCubic();
	w_sliceplane->SetOutputDimensionality( 2);
	w_sliceplane->SetBackgroundLevel( 1024);
        w_sliceplane->SetOutputSpacing(0.55, 0.55, 5.6);
        double u[3] = {0,0,-1};
        double v[3] = {0,1,0};
        double k[3] = {1,0,0};
        w_sliceplane->SetResliceAxesDirectionCosines(u,v,k);

to get the image and the information of the image, I use this:

        w_sliceplane->Update();
        vtkImageData	*tempIm;
	tempIm = w_sliceplane->GetOutput();
        tempIm->Update();
	tempIm->GetWholeExtent( imExtent);
	tempIm->GetSpacing( space);
	tempIm->GetOrigin( origin);	
        int imagewidth = imExtent[ 1]-imExtent[ 0]+1 ;//get width image
        int imageheight = imExtent[ 3]-imExtent[ 2]+1 ;// get height image.
	float* image = tempIm->GetScalarPointer();

NOW THE PROBLEM: the value stored in imagewidth and imageheight are 512 and
114.
I DON'T KNOW HOW VTK COMPUTE THE VALUE 114.

if we look the data info width pixel space is lest than 1, and the volume
have 512 pixels, because of this the imagewidth is 512.
In the other hand, the space between slices is 5.6 (bigger than 1), and the
volume have 12 pixels, in this case the imageheight is 114. THIS SHOULD BE
12 OR I'M WRONG. Also, thought it might be 12x5.6=67.




--
View this message in context: http://vtk.1045678.n5.nabble.com/Problems-with-vtkImageReslice-tp5716038.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list