From 38dd416ced963d59510861edee66c0960a29715a Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Sat, 7 Mar 2026 09:07:07 +0000 Subject: [PATCH] vix raytracer representation --- src/Math/VoxRaytracer.h | 9 ++++++++- .../HEP/MuonTomography/testing/vtkVoxRaytracerTest.cpp | 2 +- .../HEP/MuonTomography/vtkVoxRaytracerRepresentation.cpp | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Math/VoxRaytracer.h b/src/Math/VoxRaytracer.h index 098c7da..6c9debd 100644 --- a/src/Math/VoxRaytracer.h +++ b/src/Math/VoxRaytracer.h @@ -63,9 +63,16 @@ public: inline size_t Count() const { return this->m_Count; } + inline size_t size() const { return this->m_Count; } + inline const Scalarf &TotalLength() const { return this->m_TotalLength; } - inline void SetCount(size_t c) { this->m_Count = c; } + inline void SetCount(size_t c) { + this->m_Count = c; + if (this->m_Data.size() != c) { + this->m_Data.resize(c); + } + } inline void SetTotalLength(Scalarf tl) { this->m_TotalLength = tl; } diff --git a/src/Vtk/HEP/MuonTomography/testing/vtkVoxRaytracerTest.cpp b/src/Vtk/HEP/MuonTomography/testing/vtkVoxRaytracerTest.cpp index 04bc919..be4d220 100644 --- a/src/Vtk/HEP/MuonTomography/testing/vtkVoxRaytracerTest.cpp +++ b/src/Vtk/HEP/MuonTomography/testing/vtkVoxRaytracerTest.cpp @@ -62,7 +62,7 @@ public: 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) { + for (int i = 0; i < vtk_raytr->GetRay().size(); ++i) { std::cout << "L[" << i << "] = " << vtk_raytr->GetRay().Data().at(i).L << "\n"; } diff --git a/src/Vtk/HEP/MuonTomography/vtkVoxRaytracerRepresentation.cpp b/src/Vtk/HEP/MuonTomography/vtkVoxRaytracerRepresentation.cpp index 7e5293b..2f36157 100644 --- a/src/Vtk/HEP/MuonTomography/vtkVoxRaytracerRepresentation.cpp +++ b/src/Vtk/HEP/MuonTomography/vtkVoxRaytracerRepresentation.cpp @@ -249,13 +249,14 @@ void vtkVoxRaytracerRepresentation::SetRay(VoxRaytracer::RayData *ray) { Vector3i idv = m_Content->GetImage()->UnMap(id); vtkSmartPointer cube = vtkSmartPointer::New(); cube->SetBounds(idv(0), idv(0) + 1, idv(1), idv(1) + 1, idv(2), idv(2) + 1); -#if VTK_MAJOR_VERSION <= 5 cube->Update(); +#if VTK_MAJOR_VERSION <= 5 appender->AddInput(cube->GetOutput()); #else appender->AddInputData(cube->GetOutput()); #endif } + appender->Modified(); } void vtkVoxRaytracerRepresentation::SetVoxelsColor(Vector4f rgba) {