12 #include "MeshFromPeaksCLP.h" 14 #include "vtkPolyDataWriter.h" 27 main (
int argc,
char const* argv[])
31 typedef double PixelType;
32 typedef itk::VectorImage<PixelType, 3> InputImageType;
41 InputImageType::Pointer inputImage;
45 MeshCreatorType::Pointer filter = MeshCreatorType::New();
47 filter->SetInput( inputImage );
49 if (_ColorScheme ==
"DIRECTION") { filter->SetColorScheme(MeshCreatorType::DIRECTION); }
50 if (_ColorScheme ==
"FIXED") { filter->SetColorScheme(MeshCreatorType::FIXED); }
52 filter->SetColorPeak(_ColorPeak[0], _ColorPeak[1], _ColorPeak[2]);
53 filter->SetMaxNumberOfPeaks(_MaxNumber);
55 filter->SetScale( _Scale );
56 filter->SetTubeRadius( _TubeRadius );
58 filter->SetFlip(_Flip[0], _Flip[1], _Flip[2]);
59 filter->SetBoxView(_BoxView[0], _BoxView[1], _BoxView[2], _BoxView[3], _BoxView[4], _BoxView[5]);
60 filter->SetSliceView(_SliceView[0], _SliceView[1], _SliceView[2]);
63 if (_ShowProgressArg.isSet())
64 filter->AddObserver( itk::ProgressEvent(), observer );
65 if (_SingleThreadArg.isSet())
66 filter->SetNumberOfThreads(1);
67 filter->SetDebug(_DebugArg.isSet());
69 std::cout <<
"Generating mesh ... " << std::flush;
73 std::cout << clock.GetMean() <<
"s elapsed" << std::endl;
75 MeshCreatorType::OutputMeshPolyDataType* mesh = filter->GetOutput();
77 if (_OutputFileArg.isSet())
86 vtk::VisualizePolyData(mesh, _Angle, _WindowSize, !_NoNormalArg.isSet(), !_NoLightingArg.isSet(), _Zoom, _PNGFile, _BackgroundColor);
helper functions specifically used in dmritool
Generate a mesh from given peaks.
void ReadVectorImage(const std::string &filename, SmartPointer< VectorImage< PixelType, 3 > > &image, const std::string &printInfo="Reading Image:")
static PeakType GetPeakType(const std::string &str)
SmartPointer< Self > Pointer
#define utlGlobalException(cond, expout)
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 const *argv[])
Gnerate mesh from peaks.
void WriteVtkPolyData(vtkPolyData *mesh, const std::string &filename)