Reputation: 55
I understand that this can be a very basic VTK image processing question. After reading api documentation, I can't fully comprehend the idea.
My question: What does setExtent, setOrigin and setSpacing means in a 3D image using vtkImageData ?
Position_in_space_point = origin + spacing. Then why do we need to setExtent?
From http://www.vtk.org/doc/nightly/html/classvtkImageData.html#a08f18365c7178f8f595b08403db27a55, it says that setExtent is defined by the first and last point on each axis. Am I missing something?
Thank you :)
Upvotes: 4
Views: 2952
Reputation: 1611
These settings specifies the dimension and position of your vtkImageData object.
SetExtent sets the dimensions in each axis. e.g. a dataset of 50 images and width/height of 512/512
myVtkImageData->SetExtent(0,511,0,511,0,49);
SetSpacing sets the size of a voxel (size in each direction x,y,z) in your dataset.
(default)
myVtkImageData->SetSpacing(1,1,1);
SetOrigin sets the position in 3D space of point 0 0 0 (first pixel)
(default)
myVtkImageData->SetOrigin(0,0,0)
Upvotes: 4