36 #include "Exception.hpp" 37 #include "RegularGrid.hpp" 38 #include "DistanceMap.hpp" 39 #include "NetworkToImage.hpp" 40 #include "UnitCollection.hpp" 41 #include "BaseUnits.hpp" 42 #include "UblasIncludes.hpp" 43 #include "UblasVectorInclude.hpp" 45 template<
unsigned DIM>
47 : mpImage(vtkSmartPointer<vtkImageData>::New()),
49 mGridSpacing(
BaseUnits::Instance()->GetReferenceLengthScale()),
50 mPaddingFactors(zero_vector<double>(DIM)),
56 template<
unsigned DIM>
63 template<
unsigned DIM>
69 template<
unsigned DIM>
78 EXCEPTION(
"No output set. Did you run 'Update()' ?");
82 template<
unsigned DIM>
88 template<
unsigned DIM>
94 template<
unsigned DIM>
105 template<
unsigned DIM>
111 template<
unsigned DIM>
116 EXCEPTION(
"No input vessel network set.");
120 c_vector<double, DIM> range = ublas::element_prod(scalar_vector<double>(DIM, 1.0) + 2.0*
mPaddingFactors, (extents.second - extents.first).GetLocation(
mGridSpacing));
125 std::vector<unsigned> final_extents;
126 final_extents.push_back(
unsigned(range[0])+1);
127 final_extents.push_back(
unsigned(range[1])+1);
130 final_extents.push_back(
unsigned(range[2])+1);
134 final_extents.push_back(1);
136 p_grid->SetExtents(final_extents);
140 p_distance_map->SetVesselNetwork(
mpNetwork);
141 p_distance_map->SetGrid(p_grid);
142 p_distance_map->SetUseSegmentRadii(
true);
143 p_distance_map->Setup();
144 p_distance_map->Solve();
146 std::vector<double> point_solution = p_distance_map->GetSolution(p_grid);
147 for(
unsigned idx=0; idx<point_solution.size();idx++)
149 if(point_solution[idx]==0.0)
151 point_solution[idx] = 1.0;
155 point_solution[idx] = 0.0;
159 p_grid->SetUpVtkGrid();
160 p_grid->SetPointValues(point_solution);
161 mpImage = p_grid->GetVtkGrid();
162 mpImage->GetPointData()->SetScalars(
mpImage->GetPointData()->GetArray(
"Point Values"));
void SetPaddingFactors(double paddingX, double paddingY, double paddingZ)
void SetImageDimension(unsigned dimension)
static boost::shared_ptr< DistanceMap< DIM > > Create()
boost::shared_ptr< VesselNetwork< DIM > > mpNetwork
vtkSmartPointer< vtkImageData > mpImage
static boost::shared_ptr< RegularGrid< DIM > > Create()
void SetGridSpacing(units::quantity< unit::length > spacing)
void SetNetwork(boost::shared_ptr< VesselNetwork< DIM > > pNetwork)
units::quantity< unit::length > mGridSpacing
vtkSmartPointer< vtkImageData > GetOutput()
c_vector< double, DIM > mPaddingFactors
static boost::shared_ptr< NetworkToImage< DIM > > Create()