• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

tests/volumevtk/volumevtk.cpp

Go to the documentation of this file.
00001 #include <QApplication>
00002 
00003 #include "DGVVolumePlotVTK.h"
00004 #include "DGVBlitzArrayCasterVTK.h"
00005 
00006 #include "vtkImageData.h"
00007 #include "vtkXMLImageDataWriter.h"
00008 
00009 const int Size = 128;
00010 
00011 typedef double plotType;
00012 
00013 int main(int argc, char *argv[])
00014 {
00015         QApplication app(argc,argv);
00016     Array<plotType,3> gaussian(Size,Size,Size);
00017     firstIndex x;
00018     secondIndex y;
00019     thirdIndex z;
00020 
00022     plotType amplitude = 100.0, stdDev_x = Size/2, stdDev_y = Size/2, stdDev_z = Size/2, x0 = 0, y0 = Size/2, z0 = 0;
00023     gaussian = amplitude*exp( -( (x-x0)/stdDev_x*(x-x0)/stdDev_x + (y-y0)/stdDev_y*(y-y0)/stdDev_y + (z-z0)/stdDev_z*(z-z0)/stdDev_z ) );
00024 
00026     DGVBlitzArrayCasterVTK<plotType> Blitz;
00027     vtkImageData *data = Blitz.arrayToVTKImageData(gaussian);
00028 
00029     vtkXMLImageDataWriter *XMLwriter = vtkXMLImageDataWriter::New();
00030         XMLwriter->SetFileName("gaussian.vti");
00031         XMLwriter->SetDataModeToBinary();
00032         XMLwriter->SetInput(data);
00033         XMLwriter->Write();
00034 
00035     DGVVolumePlotVTK volumePlot;
00036         volumePlot.setData(gaussian);
00037         volumePlot.generatePlot();
00038         volumePlot.generateAxes();
00039 
00040     volumePlot.show();
00041 
00042     app.exec();
00043 
00044     XMLwriter->Delete();
00045     data->Delete();
00046 
00047     return EXIT_SUCCESS;
00048 }

Generated on Wed Sep 8 2010 01:36:52 for DGV by  doxygen 1.7.1