reorganization of sources, moving cmt pertaining structures into HEP folder
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
set( TESTS
|
||||
vtkViewerTest
|
||||
vtkContainerBoxTest
|
||||
vtkMuonScatter
|
||||
vtkStructuredGridTest
|
||||
vtkVoxRaytracerTest
|
||||
# vtkVoxImageTest
|
||||
# vtkTriangleMeshTest
|
||||
)
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#include "Detectors/MuonScatter.h"
|
||||
#include "Vtk/vtkMuonScatter.h"
|
||||
|
||||
#include "Vtk/uLibVtkViewer.h"
|
||||
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
int main()
|
||||
{
|
||||
MuonScatter event;
|
||||
event.LineIn().direction << 0, -1, 1, 0;
|
||||
event.LineIn().origin << 0, 1, -1, 1;
|
||||
|
||||
event.LineOut().direction << 0, -1, 0, 0;
|
||||
event.LineOut().origin << 0, -1, 0, 1;
|
||||
|
||||
Vtk::vtkMuonScatter v_event(event);
|
||||
v_event.AddPocaPoint(HPoint3f(0,0,0));
|
||||
|
||||
v_event.SaveToXMLFile("vtk_testing_muonevent.vtp");
|
||||
|
||||
Vtk::Viewer viewer;
|
||||
|
||||
// Vtk::Tie<Vtk::vtkMuonScatter> tms;
|
||||
// tms.DoAction();
|
||||
// Vtk::Tie<Vtk::Viewer> vms;
|
||||
// vms.DoAction();
|
||||
|
||||
viewer.AddPuppet(v_event);
|
||||
viewer.Start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Math/StructuredGrid.h"
|
||||
|
||||
#include "Vtk/vtkStructuredGrid.h"
|
||||
#include "Vtk/uLibVtkViewer.h"
|
||||
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
StructuredGrid grid(Vector3i(10,10,100));
|
||||
grid.SetSpacing(Vector3f(3,1,1));
|
||||
|
||||
Vtk::vtkStructuredGrid grid_viewer(grid);
|
||||
|
||||
Vtk::Viewer viewer;
|
||||
viewer.AddPuppet(grid_viewer);
|
||||
viewer.Start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Math/TriangleMesh.h"
|
||||
#include "Vtk/vtkTriangleMesh.h"
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
BEGIN_TESTING(Vtk Triangle Mesh);
|
||||
|
||||
// { // SIMPLE TESTS //
|
||||
|
||||
|
||||
// TriangleMesh mesh;
|
||||
|
||||
// mesh.AddPoint(Vector3f(0,0,0));
|
||||
// mesh.AddPoint(Vector3f(0,1,0));
|
||||
// mesh.AddPoint(Vector3f(1,0,0));
|
||||
|
||||
// mesh.AddTriangle(Vector3i(0,1,2));
|
||||
|
||||
// mesh.PrintSelf(std::cout);
|
||||
|
||||
|
||||
// vtkTriangleMesh v_mesh(mesh);
|
||||
// v_mesh.Update();
|
||||
|
||||
// TestingRenderWidow(&v_mesh);
|
||||
// }
|
||||
|
||||
{ // SIMPLE TESTS //
|
||||
|
||||
TriangleMesh mesh;
|
||||
|
||||
vtkTriangleMesh v_mesh(mesh);
|
||||
|
||||
v_mesh.ReadFromStlFile("prova.stl");
|
||||
|
||||
mesh.PrintSelf(std::cout);
|
||||
|
||||
TestingRenderWidow(&v_mesh);
|
||||
}
|
||||
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Math/VoxImage.h"
|
||||
#include "Vtk/vtkVoxImage.h"
|
||||
#include "Vtk/uLibVtkViewer.h"
|
||||
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
struct TestVoxel {
|
||||
Scalarf Value;
|
||||
unsigned int Count;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
BEGIN_TESTING(Vtk Vox Image);
|
||||
|
||||
TestVoxel zero = {0,0};
|
||||
TestVoxel nonzero = {5.5*1E-6,100};
|
||||
|
||||
// { // SIMPLE TESTS //
|
||||
// VoxImage<TestVoxel> img(Vector3i(10,10,10));
|
||||
// img.SetSpacing(Vector3f(3,3,3));
|
||||
|
||||
// img.InitVoxels(zero);
|
||||
// img[Vector3i(3,3,3)] = nonzero;
|
||||
|
||||
// Vtk::vtkVoxImage vtk_img(img);
|
||||
|
||||
// vtk_img.SaveToXMLFile("test.vti");
|
||||
// vtk_img.setShadingPreset(0);
|
||||
|
||||
// // vtk_img.ReadFromVKTFile("error.vtk");
|
||||
|
||||
// // VoxImage<TestVoxel> img2 = img;
|
||||
|
||||
// // Vtk::vtkVoxImage vtk_img2(img2);
|
||||
|
||||
// // img2.ExportToVtk("error_saved.vtk",0);
|
||||
|
||||
// // vtk_img2.SaveToXMLFile("error_saved.vti");
|
||||
|
||||
// Vtk::Viewer viewer;
|
||||
// viewer.AddPuppet(vtk_img);
|
||||
// viewer.Start();
|
||||
// }
|
||||
|
||||
{ // SIMPLE TESTS //
|
||||
VoxImage<TestVoxel> img(Vector3i(10,10,1));
|
||||
img.SetSpacing(Vector3f(3,3,3));
|
||||
|
||||
img.InitVoxels(zero);
|
||||
img[Vector3i(3,3,0)] = nonzero;
|
||||
|
||||
Vtk::vtkVoxImage vtk_img(img);
|
||||
|
||||
vtk_img.ReadFromVKTFile("test.vtk");
|
||||
vtk_img.Update();
|
||||
|
||||
// vtk_img.SaveToXMLFile("test.vti");
|
||||
// vtk_img.setShadingPreset(0);
|
||||
|
||||
// Vtk::vtkVoxImage vtk_img2(img2);
|
||||
// img2.ExportToVtk("error_saved.vtk",0);
|
||||
// vtk_img2.SaveToXMLFile("error_saved.vti");
|
||||
|
||||
Vtk::Viewer viewer;
|
||||
viewer.AddPuppet(vtk_img);
|
||||
viewer.Start();
|
||||
}
|
||||
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <vtkBoxWidget.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkCommand.h>
|
||||
|
||||
|
||||
#include <Detectors/MuonScatter.h>
|
||||
#include <Math/VoxRaytracer.h>
|
||||
|
||||
#include "Vtk/vtkMuonScatter.h"
|
||||
#include "Vtk/vtkStructuredGrid.h"
|
||||
#include "Vtk/vtkVoxRaytracerRepresentation.h"
|
||||
#include "Vtk/uLibVtkViewer.h"
|
||||
|
||||
// remove
|
||||
#include <vtkCornerAnnotation.h>
|
||||
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
|
||||
|
||||
class vtkWidgetCallback : public vtkCommand
|
||||
{
|
||||
public:
|
||||
static vtkWidgetCallback *New() { return new vtkWidgetCallback; }
|
||||
|
||||
void SetTracer(Vtk::vtkVoxRaytracerRepresentation *parent)
|
||||
{
|
||||
this->vtk_raytr = parent;
|
||||
}
|
||||
|
||||
void SetMuon (uLib::MuonScatter *muon) { this->muon = muon; }
|
||||
|
||||
void SetAnnotation ( vtkCornerAnnotation *annotation) {
|
||||
this->annotation = annotation;
|
||||
}
|
||||
|
||||
virtual void Execute(vtkObject *caller, unsigned long, void*)
|
||||
{
|
||||
char str[40];
|
||||
vtk_raytr->SetMuon(*muon);
|
||||
if(annotation)
|
||||
{
|
||||
sprintf(str,"total length = %f",vtk_raytr->GetRay().TotalLength());
|
||||
annotation->SetText(1,str);
|
||||
for(int i=0; i<vtk_raytr->GetRay().Data().size(); ++i)
|
||||
{
|
||||
std::cout << "L[" << i << "] = "
|
||||
<< vtk_raytr->GetRay().Data().at(i).L << "\n";
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
vtkWidgetCallback() :
|
||||
vtk_raytr(NULL),
|
||||
muon(NULL),
|
||||
annotation(NULL) {}
|
||||
|
||||
uLib::VoxRaytracer *raytracer;
|
||||
Vtk::vtkVoxRaytracerRepresentation *vtk_raytr;
|
||||
uLib::MuonScatter *muon;
|
||||
vtkCornerAnnotation *annotation;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
BEGIN_TESTING(vtk VoxRaytracer);
|
||||
|
||||
|
||||
// muon scatter //
|
||||
MuonScatter muon;
|
||||
muon.LineIn().origin << -6, 12, -6, 1;
|
||||
muon.LineIn().direction << 1 , -1 , 1 , 0;
|
||||
muon.LineOut().origin << 6 , -4 , 6 , 1;
|
||||
muon.LineOut().direction << 1 , -1 , 1 , 0;
|
||||
|
||||
Vtk::vtkMuonScatter v_muon(muon);
|
||||
|
||||
|
||||
// structured grid //
|
||||
StructuredGrid grid(Vector3i(12,10,12));
|
||||
grid.SetSpacing(Vector3f(1,1,1));
|
||||
grid.SetPosition(Vector3f(0,0,0));
|
||||
|
||||
|
||||
Vtk::vtkStructuredGrid v_grid(grid);
|
||||
|
||||
|
||||
// voxraytracer //
|
||||
VoxRaytracer rt(grid);
|
||||
HPoint3f pt;
|
||||
rt.GetEntryPoint(muon.LineIn(),pt);
|
||||
std::cout << pt.transpose() << "\n";
|
||||
|
||||
Vtk::vtkVoxRaytracerRepresentation v_rt(rt);
|
||||
v_rt.SetMuon(muon);
|
||||
v_rt.SetRayColor(Vector4f(1,0,0,1));
|
||||
|
||||
// // renderer //
|
||||
Vtk::Viewer viewer;
|
||||
|
||||
// widget //
|
||||
vtkBoxWidget *widget = v_grid.GetWidget();
|
||||
|
||||
|
||||
vtkWidgetCallback *cbk = vtkWidgetCallback::New();
|
||||
cbk->SetTracer(&v_rt);
|
||||
cbk->SetMuon(&muon);
|
||||
cbk->SetAnnotation(viewer.GetAnnotation());
|
||||
widget->AddObserver(vtkCommand::InteractionEvent, cbk);
|
||||
widget->SetInteractor(viewer.GetInteractor());
|
||||
widget->PlaceWidget();
|
||||
widget->On();
|
||||
|
||||
viewer.AddPuppet(v_grid);
|
||||
viewer.AddPuppet(v_rt);
|
||||
viewer.AddPuppet(v_muon);
|
||||
viewer.Start();
|
||||
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
Reference in New Issue
Block a user