Created
March 8, 2017 14:17
-
-
Save daviddoria/99fa99c52aa07ee78b7e7412e74d592f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vtkCellData.h> | |
#include <vtkSmartPointer.h> | |
#include <vtkUniformGrid.h> | |
#include <vtkUnsignedIntArray.h> | |
#include <vtkXMLImageDataWriter.h> | |
int main(int, char *[]) { | |
// Create a grid | |
vtkSmartPointer<vtkUniformGrid> uniformGrid = | |
vtkSmartPointer<vtkUniformGrid>::New(); | |
unsigned int voxelsPerDimension = 2; | |
// The "+1"s are because this is setting how many points are in the grid, and | |
// the cells are implied by the points | |
uniformGrid->SetDimensions(voxelsPerDimension + 1, voxelsPerDimension + 1, | |
voxelsPerDimension + 1); | |
uniformGrid->SetSpacing(1., 1., 1.); | |
uniformGrid->SetOrigin(0.0, 0.0, 0.0); | |
uniformGrid->BlankCell(0); | |
uniformGrid->Modified(); | |
vtkSmartPointer<vtkXMLImageDataWriter> imageDataWriter = | |
vtkXMLImageDataWriter::New(); | |
imageDataWriter->SetInputData(uniformGrid); | |
imageDataWriter->SetFileName("uniformgrid.vti"); | |
imageDataWriter->Write(); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment