|
Grid3
|
Class representing a 3D image grid, each voxel being of type T. More...
#include <Grid3.h>
Public Member Functions | |
| Grid3 () | |
| Default constructor. | |
| Grid3 (int width, int height, int depth=1, double x_spacing=1.0, double y_spacing=1.0, double z_spacing=1.0) | |
| Construct a grid with given dimensions. | |
| Grid3 (Vec3i dimensions, Vec3d spacing=Vec3d(1.0, 1.0, 1.0)) | |
| Construct a grid with given dimensions. | |
| void | Init (int width, int height, int depth=1, double x_spacing=1.0, double y_spacing=1.0, double z_spacing=1.0) |
| Initialize the grid with given dimensions. Any previous data in the grid will be overwritten. | |
| int | GetWidth () |
| Return the number of grid columns. | |
| int | GetHeight () |
| Return the number of grid rows. | |
| int | GetDepth () |
| Return the number of grid slices. | |
| Vec3i | GetDimensions () |
| Return a vector containing the grid dimensions. | |
| double | GetSpacingX () |
| Return the spacing along X. | |
| double | GetSpacingY () |
| Return the spacing along Y. | |
| double | GetSpacingZ () |
| Return the spacing along Z. | |
| Vec3d | GetSpacing () |
| Return the spacing along all three dimesions. | |
| void | SetSpacing (double x_spacing, double y_spacing, double z_spacing) |
| Set spacing. | |
| void | SetSpacing (Vec3d spacing) |
| Set spacing. | |
| Vec3d | WorldToGrid (Vec3d p) |
| Transform point p from world coordinates to grid coordinates. | |
| Vec3d | GridToWorld (Vec3d p) |
| Transform point p from grid coordinates to world coordinates. | |
| MetaDataContainer | GetMetaData () |
| Returns a MetaDataContainer with the current image meta data. | |
| void | SetMetaData (MetaDataContainer md) |
| Set image meta data. All current meta data is overwritten. | |
| int | NumberOfElements () |
| Return the total number of grid points. | |
| T * | Data () |
| Returns a pointer to the beginning of the internal data array. The called object owns the pointer. | |
| std::string | GetDataType () |
| Return a string representation of the voxel type. | |
| int | Offset (int x, int y, int z) |
| Returns the index of a specified coordinate in the internal data array. | |
| int | Offset (Vec3i p) |
| Returns the index of a specified coordinate in the internal data array. | |
| Vec3i | Coordinate (long index) |
| Returns the coordinate corresponding to a specified index in the internal data array. | |
| bool | IsInside (int x, int y, int z) |
| Test if the given grid point is within the bounds of the grid. | |
| bool | IsInside (Vec3i p) |
| Test if the given grid point is within the bounds of the grid. | |
| T & | operator[] (long index) |
| Access to the grid value at a specified index. The passed index is assumed to be within the grid bounds. | |
| T & | operator() (int x, int y, int z=0, bool Safe=false) |
| Access to the grid value at a specified coordinate. If "Safe" is false, the passed coordinate is assumed to be within the grid bounds. If "Safe" is true, a reference to the closest grid point is returned for out-of-bounds coordinates. | |
| T & | operator() (Vec3i p, bool Safe=false) |
| Access to the grid value at a specified coordinate. If "Safe" is false, the passed coordinate is assumed to be within the grid bounds. If "Safe" is true, a reference to the closest grid point is returned for out-of-bounds coordinates. | |
| T | LinearAt (double x, double y, double z) |
| Get the grid value at a specified coordinate using trilinear interpolation. | |
| T | LinearAt (Vec3d p) |
| Get the grid value at a specified coordinate using trilinear interpolation. | |
| void | Get6Neighbors (long index, vector< long > &n) |
| Fill the vector n with the indices of the 6-neighbors of the gridpoint at the specified index. | |
| void | Get6Neighbors (Vec3i p, vector< Vec3i > &n) |
| Fill the vector n with the coordinates of the 6-neighbors of the gridpoint at the specified coordinate. | |
| void | Fill (T value) |
| Set all points in the grid to a specified value. | |
| T | GetMaxValue () |
| Return the maximum value in the grid. | |
| T | GetMinValue () |
| Return the minimum value in the grid. | |
| void | CopyDataFrom (Grid3< T > &src) |
| Replace the current grid data with that of another grid. If the two grids do not have the same NumberOfElements(), nothing happens. | |
| void | SwapContentsWith (Grid3< T > &v) |
| Swap the contents of two grids. If the two grids do not have the same NumberOfElements(), nothing happens. | |
| bool | CreateFromFile (std::string filename) |
| Construct grid from an image file. | |
| bool | ReadVTK (std::string filename) |
| Construct grid from an image file in VTK legacy format. | |
| bool | WriteVTK (std::string filename) |
| Save grid in VTK legacy format. | |
| bool | ReadMetaImage (std::string filename) |
| Construct grid from an image file in MetaImage format. | |
| bool | WriteMetaImage (std::string filename) |
| Save grid in MetaImage format. | |
| bool | ReadNIFTI (std::string filename) |
| Construct grid from an image file in NIFTI format. | |
| bool | WriteNIFTI (std::string filename) |
| Save grid in NIFTI format. | |
| bool | ReadDICOM (std::string filename) |
| Construct grid from an image file in DICOM format. | |
| template<> | |
| std::string | GetDataType () |
| template<> | |
| std::string | GetDataType () |
| template<> | |
| std::string | GetDataType () |
| template<> | |
| std::string | GetDataType () |
| template<> | |
| std::string | GetDataType () |
| template<> | |
| std::string | GetDataType () |
Protected Attributes | |
| std::vector< T > | data |
| int | _width |
| int | _height |
| int | _depth |
| double | _spacingX |
| double | _spacingY |
| double | _spacingZ |
| MetaDataContainer | metadata |
Class representing a 3D image grid, each voxel being of type T.
1.8.9.1