20 #include "MeshFromSphericalFunctionTessellatedSamplesCLP.h" 21 #include "vtkPolyDataWriter.h" 37 main(
int argc,
char *argv[])
46 typedef float PixelType;
47 typedef itk::VectorImage<PixelType, 3> InputImageType;
49 InputImageType::Pointer inputImage = InputImageType::New();
54 InputSparseImageType::Pointer inputSparseImage = InputSparseImageType::New();
57 itk::ReadImage<InputSparseImageType, ReaderType>(_InputFile, inputSparseImage);
58 itk::ImageToImage<InputSparseImageType, InputImageType>(inputSparseImage, inputImage);
65 MeshCreatorType::Pointer filter = MeshCreatorType::New();
66 filter->SetScale( _Scale );
69 if (_Normalization==
"MIN_MAX") filter->SetNormalization( MeshCreatorType::MIN_MAX );
70 if (_Normalization==
"UNIT_MAX") filter->SetNormalization( MeshCreatorType::UNIT_MAX );
71 if (_Normalization==
"UNIT_INTEGRAL") filter->SetNormalization( MeshCreatorType::UNIT_INTEGRAL );
74 filter->SetRemoveNegativeValues(_RemoveNegativeValuesArg.isSet());
75 filter->SetStretch(!_NoStretchArg.isSet());
76 filter->SetInput( inputImage );
78 filter->SetBoxView(_BoxView[0], _BoxView[1], _BoxView[2], _BoxView[3], _BoxView[4], _BoxView[5]);
79 filter->SetSliceView(_SliceView[0], _SliceView[1], _SliceView[2]);
80 filter->SetFlip(_Flip[0], _Flip[1], _Flip[2]);
82 if (_BasicShape ==
"TETRAHEDRON") { filter->SetBasicShape(MeshCreatorType::SphereTessellatorType::TETRAHEDRON); }
83 if (_BasicShape ==
"OCTAHEDRON") { filter->SetBasicShape(MeshCreatorType::SphereTessellatorType::OCTAHEDRON); }
84 if (_BasicShape ==
"ICOSAHEDRON") { filter->SetBasicShape(MeshCreatorType::SphereTessellatorType::ICOSAHEDRON); }
85 filter->SetTessellationOrder(_TessellationOrder);
87 if (_ColorScheme ==
"DIRECTION") { filter->SetColorScheme(MeshCreatorType::DIRECTION); }
88 if (_ColorScheme ==
"MAGNITUDE") { filter->SetColorScheme(MeshCreatorType::MAGNITUDE); }
90 if (_SingleThreadArg.isSet())
91 filter->SetNumberOfThreads(1);
92 filter->SetDebug(_DebugArg.isSet());
95 filter->SetDataOrientations(grad);
97 std::cout <<
"Generating mesh ... " << std::flush;
100 MeshCreatorType::OutputMeshPolyDataType* mesh = filter->GetOutput();
102 if (_OutputFileArg.isSet())
111 vtk::VisualizePolyData(mesh, _Angle, _WindowSize, !_NoNormalArg.isSet(), !_NoLightingArg.isSet(), _Zoom, _PNGFile, _BackgroundColor);
Compute mesh from spherical samples in the pre-stored tessellated vertices.
helper functions specifically used in dmritool
void ReadVectorImage(const std::string &filename, SmartPointer< VectorImage< PixelType, 3 > > &image, const std::string &printInfo="Reading Image:")
bool IsSparseImage(const std::string &filename)
#define utlGlobalException(cond, expout)
Reads sparse image data from key and value files.
void VisualizePolyData(vtkPolyData *mesh, const std::vector< double > &angle={0.0, 0.0}, const std::vector< int > &windowSize={600, 600}, const bool useNormal=true, const bool lighting=true, const double zoom=1.0, const std::string &pngfile="", const std::vector< double > &bgColor={0, 0, 0})
int main(int argc, char *argv[])
Mesh From spherical samples using a given tessellation Create mesh (a spherical function) from discre...
An n-dimensional vector image with a sparse memory model.
void WriteVtkPolyData(vtkPolyData *mesh, const std::string &filename)