Tuesday, 24 January 2017
VTK volume dimension
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)
The absolute size of a volume is determined by the 'Extent' x 'Spacing' (i.e. number of voxel multiply by size of the voxel). To downsample the volume (increase spacing), we should:
// Specify the size of the image data
imageData->SetExtent(-100/scale, 100/scale, -100/scale, 100/scale, -50/scale, 50/scale);
imageData->SetSpacing(scale, scale, scale);
void vtkImageData::GetDimensions(int *dOut)
{
const int* extent = this->Extent;
dOut[0] = extent[1] - extent[0] + 1;
dOut[1] = extent[3] - extent[2] + 1;
dOut[2] = extent[5] - extent[4] + 1;
}
Subscribe to:
Posts (Atom)