Chaste
Build::
|
#include <RegularGrid.hpp>
Public Member Functions | |
RegularGrid () | |
~RegularGrid () | |
void | CalculateNeighbourData () |
void | GenerateFromPart (boost::shared_ptr< Part< DIM > > pPart, units::quantity< unit::length > gridSize) |
unsigned | Get1dGridIndex (unsigned xIndex, unsigned yIndex, unsigned zIndex) |
unsigned | GetNearestGridIndex (const DimensionalChastePoint< DIM > &rLocation) |
const std::vector< std::vector< unsigned > > & | GetNeighbourData () |
std::vector< unsigned > | GetExtents () |
DimensionalChastePoint< DIM > | GetLocation (unsigned xIndex, unsigned yIndex, unsigned zIndex) |
DimensionalChastePoint< DIM > | GetLocationOf1dIndex (unsigned gridIndex) |
std::vector< DimensionalChastePoint< DIM > > | GetLocations () |
unsigned | GetNumberOfPoints () |
DimensionalChastePoint< DIM > | GetOrigin () |
std::vector< std::vector< unsigned > > | GetPointPointMap (std::vector< DimensionalChastePoint< DIM > > inputPoints) |
const std::vector< std::vector< CellPtr > > & | GetPointCellMap (bool update=true) |
const std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > & | GetPointNodeMap (bool update=true) |
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > | GetPointSegmentMap (bool update=true, bool useVesselSurface=false) |
bool | IsSegmentAtLatticeSite (unsigned index, bool update) |
units::quantity< unit::length > | GetSpacing () |
units::quantity< unit::length > | GetReferenceLengthScale () |
vtkSmartPointer< vtkImageData > | GetVtkGrid () |
std::vector< double > | InterpolateGridValues (std::vector< DimensionalChastePoint< DIM > > locations, std::vector< double > values, bool useVtk=false) |
bool | IsLocationInPointVolume (DimensionalChastePoint< DIM > point, unsigned gridIndex) |
bool | IsOnBoundary (unsigned gridIndex) |
bool | IsOnBoundary (unsigned xIndex, unsigned yIndex, unsigned zIndex) |
void | SetCellPopulation (AbstractCellPopulation< DIM > &rCellPopulation, units::quantity< unit::length > cellPopulationLengthScale) |
void | SetExtents (std::vector< unsigned > extents) |
void | SetOrigin (DimensionalChastePoint< DIM > origin) |
void | SetPointValues (std::vector< double > pointSolution) |
void | SetSpacing (units::quantity< unit::length > spacing) |
void | SetUpVtkGrid () |
void | SetVesselNetwork (boost::shared_ptr< VesselNetwork< DIM > > pNetwork) |
void | Write (boost::shared_ptr< OutputFileHandler > pFileHandler) |
Static Public Member Functions | |
static boost::shared_ptr< RegularGrid< DIM > > | Create () |
Private Attributes | |
units::quantity< unit::length > | mSpacing |
std::vector< unsigned > | mExtents |
DimensionalChastePoint< DIM > | mOrigin |
boost::shared_ptr< VesselNetwork< DIM > > | mpNetwork |
AbstractCellPopulation< DIM > * | mpCellPopulation |
units::quantity< unit::length > | mCellPopulationReferenceLength |
std::vector< std::vector< CellPtr > > | mPointCellMap |
std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > | mPointNodeMap |
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > | mPointSegmentMap |
std::vector< double > | mPointSolution |
vtkSmartPointer< vtkImageData > | mpVtkGrid |
bool | mVtkGridIsSetUp |
std::vector< std::vector< unsigned > > | mNeighbourData |
bool | mHasCellPopulation |
units::quantity< unit::length > | mReferenceLength |
A class for describing regular grids, calculating point and line to grid point relationships and storing cell and vessel to grid point maps.
Definition at line 59 of file RegularGrid.hpp.
RegularGrid< DIM >::RegularGrid | ( | ) |
Constructor
Definition at line 52 of file RegularGrid.cpp.
RegularGrid< DIM >::~RegularGrid | ( | ) |
Desctructor
Definition at line 80 of file RegularGrid.cpp.
void RegularGrid< DIM >::CalculateNeighbourData | ( | ) |
Calculate neighbour indices for each grid point
Definition at line 86 of file RegularGrid.cpp.
References RegularGrid< DIM >::Get1dGridIndex(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mExtents, and RegularGrid< DIM >::mNeighbourData.
Referenced by RegularGrid< DIM >::GetNeighbourData().
|
static |
Factory constructor method
Definition at line 72 of file RegularGrid.cpp.
Referenced by NetworkToImage< DIM >::Update().
void RegularGrid< DIM >::GenerateFromPart | ( | boost::shared_ptr< Part< DIM > > | pPart, |
units::quantity< unit::length > | gridSize | ||
) |
Generate a grid based on the bounding box of the supplied part
pPart | the part from which to get the bounding box |
gridSize | the grid spacing |
Definition at line 152 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
unsigned RegularGrid< DIM >::Get1dGridIndex | ( | unsigned | xIndex, |
unsigned | yIndex, | ||
unsigned | zIndex | ||
) |
Get the 1-D grid index for given x,y,z indices
xIndex | the grid x index |
yIndex | the grid y index |
zIndex | the grid z index |
Definition at line 171 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
Referenced by RegularGrid< DIM >::CalculateNeighbourData(), and RegularGrid< DIM >::GetNearestGridIndex().
std::vector< unsigned > RegularGrid< DIM >::GetExtents | ( | ) |
Return the grid extents in x, y, z. Always dimension 3.
Definition at line 479 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetLocation | ( | unsigned | xIndex, |
unsigned | yIndex, | ||
unsigned | zIndex | ||
) |
Get the location of a point on the grid for given x, y ,z indices
xIndex | the grid x index |
yIndex | the grid y index |
zIndex | the grid z index |
Definition at line 485 of file RegularGrid.cpp.
References RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
Referenced by RegularGrid< DIM >::GetNearestGridIndex(), RegularGrid< DIM >::GetPointNodeMap(), and RegularGrid< DIM >::GetPointPointMap().
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetLocationOf1dIndex | ( | unsigned | gridIndex | ) |
Get the location of a point on the grid for given 1-d grid index
gridIndex | the 1d grid index |
Definition at line 503 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
Referenced by RegularGrid< DIM >::GetLocations(), and RegularGrid< DIM >::GetPointSegmentMap().
std::vector< DimensionalChastePoint< DIM > > RegularGrid< DIM >::GetLocations | ( | ) |
Get all of the grid locations
Definition at line 526 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetLocationOf1dIndex(), and RegularGrid< DIM >::GetNumberOfPoints().
unsigned RegularGrid< DIM >::GetNearestGridIndex | ( | const DimensionalChastePoint< DIM > & | rLocation | ) |
Get the 1-D grid index for given x,y,z indices
rLocation | the point to get the nearest index to |
Definition at line 136 of file RegularGrid.cpp.
References RegularGrid< DIM >::Get1dGridIndex(), RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
const std::vector< std::vector< unsigned > > & RegularGrid< DIM >::GetNeighbourData | ( | ) |
Calculate neighbour indices for each grid point
Definition at line 126 of file RegularGrid.cpp.
References RegularGrid< DIM >::CalculateNeighbourData(), RegularGrid< DIM >::GetNumberOfPoints(), and RegularGrid< DIM >::mNeighbourData.
unsigned RegularGrid< DIM >::GetNumberOfPoints | ( | ) |
Return the number of points in the grid
Definition at line 537 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
Referenced by RegularGrid< DIM >::CalculateNeighbourData(), RegularGrid< DIM >::GetLocations(), RegularGrid< DIM >::GetNeighbourData(), RegularGrid< DIM >::GetPointCellMap(), RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointPointMap(), RegularGrid< DIM >::GetPointSegmentMap(), RegularGrid< DIM >::GetVtkGrid(), and RegularGrid< DIM >::InterpolateGridValues().
DimensionalChastePoint< DIM > RegularGrid< DIM >::GetOrigin | ( | ) |
Return the origin in x, y, z
Definition at line 543 of file RegularGrid.cpp.
References RegularGrid< DIM >::mOrigin.
const std::vector< std::vector< CellPtr > > & RegularGrid< DIM >::GetPointCellMap | ( | bool | update = true | ) |
Return the point cell map
update | update the map |
Definition at line 321 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mCellPopulationReferenceLength, RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mpCellPopulation, RegularGrid< DIM >::mPointCellMap, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
const std::vector< std::vector< boost::shared_ptr< VesselNode< DIM > > > > & RegularGrid< DIM >::GetPointNodeMap | ( | bool | update = true | ) |
Return the point node map
update | update the map |
Definition at line 274 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mpNetwork, RegularGrid< DIM >::mPointNodeMap, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
std::vector< std::vector< unsigned > > RegularGrid< DIM >::GetPointPointMap | ( | std::vector< DimensionalChastePoint< DIM > > | inputPoints | ) |
Return a vector of input point indices which in the bounding boxes of each grid point
inputPoints | a vector of point locations |
Definition at line 189 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
std::vector< std::vector< boost::shared_ptr< VesselSegment< DIM > > > > RegularGrid< DIM >::GetPointSegmentMap | ( | bool | update = true , |
bool | useVesselSurface = false |
||
) |
Return the point segments map
update | update the map |
useVesselSurface | use the vessel surface for distance calculations |
Definition at line 386 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mpNetwork, RegularGrid< DIM >::mPointSegmentMap, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
Referenced by RegularGrid< DIM >::IsSegmentAtLatticeSite().
units::quantity< unit::length > RegularGrid< DIM >::GetReferenceLengthScale | ( | ) |
Return the reference length scale
Definition at line 183 of file RegularGrid.cpp.
References RegularGrid< DIM >::mReferenceLength.
units::quantity< unit::length > RegularGrid< DIM >::GetSpacing | ( | ) |
Return the grid spacing
Definition at line 549 of file RegularGrid.cpp.
References RegularGrid< DIM >::mSpacing.
vtkSmartPointer< vtkImageData > RegularGrid< DIM >::GetVtkGrid | ( | ) |
Return the grid in vtk format
Definition at line 691 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mPointSolution, RegularGrid< DIM >::mpVtkGrid, RegularGrid< DIM >::mVtkGridIsSetUp, and RegularGrid< DIM >::SetUpVtkGrid().
Referenced by RegularGrid< DIM >::Write().
std::vector< double > RegularGrid< DIM >::InterpolateGridValues | ( | std::vector< DimensionalChastePoint< DIM > > | locations, |
std::vector< double > | values, | ||
bool | useVtk = false |
||
) |
Sample a function specified on the grid at the specified locations
locations | the sample locations |
values | the known values at the grid points |
useVtk | use VTK to do the sampling, faster but algorithm not clearly documented |
Definition at line 215 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::mpVtkGrid, RegularGrid< DIM >::mReferenceLength, RegularGrid< DIM >::mVtkGridIsSetUp, and RegularGrid< DIM >::SetUpVtkGrid().
bool RegularGrid< DIM >::IsLocationInPointVolume | ( | DimensionalChastePoint< DIM > | point, |
unsigned | gridIndex | ||
) |
Is the input location in the bounding box of the grid point
point | the location of interest |
gridIndex | the grid point of interest |
Definition at line 587 of file RegularGrid.cpp.
References DimensionalChastePoint< DIM >::GetLocation(), RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mReferenceLength, and RegularGrid< DIM >::mSpacing.
bool RegularGrid< DIM >::IsOnBoundary | ( | unsigned | gridIndex | ) |
Is the point on the outer boundary of the domain
gridIndex | the 1d grid index gridIndex |
Definition at line 555 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
bool RegularGrid< DIM >::IsOnBoundary | ( | unsigned | xIndex, |
unsigned | yIndex, | ||
unsigned | zIndex | ||
) |
Is the point on the outer boundary of the domain
xIndex | the grid x index |
yIndex | the grid y index |
zIndex | the grid z index |
Definition at line 566 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
bool RegularGrid< DIM >::IsSegmentAtLatticeSite | ( | unsigned | index, |
bool | update | ||
) |
Return true if the segment is at a lattice site
index | the lattice index |
update | update the segment-grid map |
Definition at line 371 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetPointSegmentMap(), and RegularGrid< DIM >::mPointSegmentMap.
void RegularGrid< DIM >::SetCellPopulation | ( | AbstractCellPopulation< DIM > & | rCellPopulation, |
units::quantity< unit::length > | cellPopulationLengthScale | ||
) |
Set the cell population
rCellPopulation | a reference to the cell population |
Definition at line 629 of file RegularGrid.cpp.
References RegularGrid< DIM >::mCellPopulationReferenceLength, and RegularGrid< DIM >::mpCellPopulation.
void RegularGrid< DIM >::SetExtents | ( | std::vector< unsigned > | extents | ) |
Set the grid extents in x, y, z
extents | the grid extents |
Definition at line 636 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents.
void RegularGrid< DIM >::SetOrigin | ( | DimensionalChastePoint< DIM > | origin | ) |
Set the origin in x, y, z
origin | the grid origin |
Definition at line 646 of file RegularGrid.cpp.
References RegularGrid< DIM >::mOrigin.
void RegularGrid< DIM >::SetPointValues | ( | std::vector< double > | pointSolution | ) |
Set the values of a field at all points on the grid
pointSolution | the value of the field |
Definition at line 177 of file RegularGrid.cpp.
References RegularGrid< DIM >::mPointSolution.
void RegularGrid< DIM >::SetSpacing | ( | units::quantity< unit::length > | spacing | ) |
Set the grid spacing
spacing | the grid spacing |
Definition at line 652 of file RegularGrid.cpp.
References RegularGrid< DIM >::mSpacing.
void RegularGrid< DIM >::SetUpVtkGrid | ( | ) |
Set the internal vtk representation of the grid
Definition at line 658 of file RegularGrid.cpp.
References RegularGrid< DIM >::mExtents, RegularGrid< DIM >::mOrigin, RegularGrid< DIM >::mpVtkGrid, RegularGrid< DIM >::mReferenceLength, RegularGrid< DIM >::mSpacing, and RegularGrid< DIM >::mVtkGridIsSetUp.
Referenced by RegularGrid< DIM >::GetVtkGrid(), and RegularGrid< DIM >::InterpolateGridValues().
void RegularGrid< DIM >::SetVesselNetwork | ( | boost::shared_ptr< VesselNetwork< DIM > > | pNetwork | ) |
Set the vessel network
pNetwork | the vessel network |
Definition at line 685 of file RegularGrid.cpp.
References RegularGrid< DIM >::mpNetwork.
void RegularGrid< DIM >::Write | ( | boost::shared_ptr< OutputFileHandler > | pFileHandler | ) |
Write the grid and any field to file as a VTI file
pFileHandler | a file handler for the write location |
Definition at line 714 of file RegularGrid.cpp.
References RegularGrid< DIM >::GetVtkGrid(), RegularGridWriter::SetFilename(), RegularGridWriter::SetImage(), and RegularGridWriter::Write().
|
private |
The reference length scale for the cellpopulation.
Definition at line 89 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointCellMap(), and RegularGrid< DIM >::SetCellPopulation().
|
private |
The number of grid points in each direction
Definition at line 69 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::CalculateNeighbourData(), RegularGrid< DIM >::GenerateFromPart(), RegularGrid< DIM >::Get1dGridIndex(), RegularGrid< DIM >::GetExtents(), RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNumberOfPoints(), RegularGrid< DIM >::GetPointCellMap(), RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointPointMap(), RegularGrid< DIM >::IsLocationInPointVolume(), RegularGrid< DIM >::IsOnBoundary(), RegularGrid< DIM >::SetExtents(), and RegularGrid< DIM >::SetUpVtkGrid().
|
private |
Has a cell population
Definition at line 129 of file RegularGrid.hpp.
|
private |
A vector of neighbour indices
Definition at line 124 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::CalculateNeighbourData(), and RegularGrid< DIM >::GetNeighbourData().
|
private |
The origin of the grid in x,y,z. Corresponds to location of front, bottom, left corner.
Definition at line 74 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GenerateFromPart(), RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNearestGridIndex(), RegularGrid< DIM >::GetOrigin(), RegularGrid< DIM >::GetPointCellMap(), RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointPointMap(), RegularGrid< DIM >::IsLocationInPointVolume(), RegularGrid< DIM >::SetOrigin(), and RegularGrid< DIM >::SetUpVtkGrid().
|
private |
The cell population. This memory pointed to is not managed in this class.
Definition at line 84 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointCellMap(), and RegularGrid< DIM >::SetCellPopulation().
|
private |
The vessel network
Definition at line 79 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointSegmentMap(), and RegularGrid< DIM >::SetVesselNetwork().
|
private |
A map of cells corresponding to a point on the grid
Definition at line 94 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointCellMap().
|
private |
A map of vessel nodes corresponding to a point on the grid
Definition at line 99 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointNodeMap().
|
private |
A map of vessel segments corresponding to a point on the grid
Definition at line 104 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetPointSegmentMap(), and RegularGrid< DIM >::IsSegmentAtLatticeSite().
|
private |
A field with specified value at each point in the grid
Definition at line 109 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetVtkGrid(), and RegularGrid< DIM >::SetPointValues().
|
private |
The grid in the form of vtk image data
Definition at line 114 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetVtkGrid(), RegularGrid< DIM >::InterpolateGridValues(), and RegularGrid< DIM >::SetUpVtkGrid().
|
private |
The reference length scale, default in microns.
Definition at line 134 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GenerateFromPart(), RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNearestGridIndex(), RegularGrid< DIM >::GetPointCellMap(), RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointPointMap(), RegularGrid< DIM >::GetPointSegmentMap(), RegularGrid< DIM >::GetReferenceLengthScale(), RegularGrid< DIM >::InterpolateGridValues(), RegularGrid< DIM >::IsLocationInPointVolume(), and RegularGrid< DIM >::SetUpVtkGrid().
|
private |
The spacing between grid points
Definition at line 64 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GenerateFromPart(), RegularGrid< DIM >::GetLocation(), RegularGrid< DIM >::GetLocationOf1dIndex(), RegularGrid< DIM >::GetNearestGridIndex(), RegularGrid< DIM >::GetPointCellMap(), RegularGrid< DIM >::GetPointNodeMap(), RegularGrid< DIM >::GetPointPointMap(), RegularGrid< DIM >::GetPointSegmentMap(), RegularGrid< DIM >::GetSpacing(), RegularGrid< DIM >::IsLocationInPointVolume(), RegularGrid< DIM >::SetSpacing(), and RegularGrid< DIM >::SetUpVtkGrid().
|
private |
Is the VTK grid set up
Definition at line 119 of file RegularGrid.hpp.
Referenced by RegularGrid< DIM >::GetVtkGrid(), RegularGrid< DIM >::InterpolateGridValues(), and RegularGrid< DIM >::SetUpVtkGrid().